3,978 Topics

Member Avatar for
Member Avatar for sirlink99

I am working if application and I cannot figure out how to make a box move forward one at a time when the spacebar is pressed. Here are my codes: [CODE] package DrawingInApplications; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.*; import javax.swing.JFrame; public class Program extends Drawing implements KeyListener{ Drawing d; …

Member Avatar for JamesCherrill
0
993
Member Avatar for MWE_QUE

Any help would be appreciated. I have a working command line program (trivia question) and decided to try to put it in a Gui. I got the user menu to print, but it gets to line 162 and blows up (going line by line) where I'm thinking it should do …

Member Avatar for MWE_QUE
0
320
Member Avatar for tultul

Sorry.... i have posted this question before in JavaRanch Forum but i did not get any satisfactory answer to my question. probably no one notices there. I am posting here with the hope that someone will come forward and give me some suggestion. i am using java swing and i …

Member Avatar for tultul
0
887
Member Avatar for tracieam

I am trying to write the code for a face that winks. My code doesn't give me any errors however when I try to run it the window comes up as a blank window. It does have the corredt title but no face is drawn in it and I'm not …

Member Avatar for tracieam
0
104
Member Avatar for emc22

I'm trying to create a class that calculates for the next possible coordinate for a Bishop Piece for my chess program and I encountered this problem. I used a JOptionPane to test for the results and I can't understand how it got that result. The first JOptionPane shows false because …

Member Avatar for emc22
0
169
Member Avatar for drummershuff

[CODE]import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.io.*; public class MuseumPanel extends JPanel { private JLabel label; private JPanel buttonPanel; private JButton week, day, hour, output; private Museum museumArray = new Museum(); private int numb; int[] weekArray = new int[3]; int[] dayArray = new int[7]; int[] hourArray = …

Member Avatar for parry_kulk
0
279
Member Avatar for sirlink99

I am tying to use Gridbag layout, but I cannot seem to get it working. [URL="http://img703.imageshack.us/img703/1461/photo00002y.jpg"]here[/URL] is the plan. and here is the code: [CODE] import java.awt.event.*; import java.awt.*; import javax.swing.*; import java.net.*; import java.nio.*; public class Chatroom implements ActionListener { public Chatroom (){ JFrame frame = new JFrame ("Warrior …

Member Avatar for mKorbel
0
171
Member Avatar for cabosun

So im doing this swing java gui project where the admin can login and search, modify and add users to the database mysql. Im having trouble putting in the right getParameter to get: type = radio group button of 2 with 1 as Doctor and 1 as Nurse Specialty = …

Member Avatar for Ezzaral
0
109
Member Avatar for rbjq

Could I enquire, how do I check for the time complexity for the program below? (: Thank you! [code] import javax.swing.*; import java.awt.*; import java.math.*; /** * * @author Jia */ public class tilePanel extends JPanel { int numSquares; int increment; private frame app; Integer buff; String x=" "; public …

Member Avatar for Rashakil Fol
0
152
Member Avatar for FlightOfGrey

I'm am reasonably new at coding and am currently studying it at College. While in my break I found Project Euler a neat little site with problems which I have been working through for an extra challenge. This is the question that I am stuck on: [url]http://projecteuler.net/index.php?section=problems&id=8[/url] basically you are …

Member Avatar for jon.kiparsky
0
179
Member Avatar for fragtech

Hey guys I have been having lots of problems getting my animation to not flicker. I have read that double buffering is a good way to stop the flickering but everything I have tried doesn't do anything to help. If you could please help me understand what I am doing …

Member Avatar for quuba
0
230
Member Avatar for coolbeanbob

Hi, I am getting a null pointer exception with the code below. From what I have read, it seems like something is null, but I do not understand how this could be a problem? The error is occurring on line 205 of the StudentContainer class. (This is at the very …

Member Avatar for jon.kiparsky
0
717
Member Avatar for carinlynchin

here is my one class (controller) and the other (GUI) what is happening is inside the SearchListener inner class for the button, I am calling a method from the controller class (i have already tested the parameter sent and that part works fine) but when i click on a code …

Member Avatar for carinlynchin
0
3K
Member Avatar for moerpheus

hi, When I was writing my post, I knew very little about IT, let alone programming. Few years later, I know something: [LIST] [*]PHP [*]JSP [*]JAVA(Swing) [/LIST] Thank you DaniWeb. The story still continues...

Member Avatar for moerpheus
1
53
Member Avatar for toferdagofer

I had a gui set up that displayed menu items a window and some buttons at the bottom. i am having it communicate with an outside program using commands. i recieved a strange error msg after i tried to have it communicate with the other program. I know the gui …

Member Avatar for JamesCherrill
0
188
Member Avatar for GolfGr

Hello guys im working on a project for my class and im stuck. i dont have much of experience with linked list and my book isn't helpful with this project. Here is what the project is about: Develop an interactive program to implement basic linked list operations including: 1. Add …

Member Avatar for GolfGr
0
172
Member Avatar for unrealj

What I am doing here is in one class reading in a file where the first line contains info about the number of rows and columns in a grid to be made in a GUI representation. I made the first class read in the file, and returns a value "e" …

Member Avatar for unrealj
0
186
Member Avatar for softswing

Hai friends, Am using swing for GUI, using gridbaglayout, for combobox width is changing by the size of items loaded, i want particular size as per above field, setprefferdsize,setmaximumsize, setminimum sizes having no effect in gridbag layout. [CODE] GridBagConstraints ComboConstraints = new GridBagConstraints(); ComboConstraints.gridy = 1; ComboConstraints.gridx = 1; ComboConstraints.anchor …

0
64
Member Avatar for StudentUoP

This is my calculator. I am trying to add the user input option. The combo box works with the calculate button, however, the user input option does not work with the calculate button. I only get $oo as the output in the Payment text field. Could someone please give me …

Member Avatar for mKorbel
0
844
Member Avatar for sakurayana

[code]import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.util.*; public class Cinema extends JFrame { private JLabel lblName,lblIC, lblPN, lblPerson, lblTicket, lblTP; private JTextField txtName, txtIC, txtPN, txtPerson, txtTicket, txtTP; private JRadioButton rbA, rbB, rbC, rbD, rbE, rbF; private ButtonGroup radioGroup; private JCheckBox cbxA1, cbxA2, cbxA3, cbxA4, cbxA5, cbxA6, …

Member Avatar for jwenting
0
145
Member Avatar for sakurayana

hi, can u help me.when i click at the checkbox,the data in the checkbox should appear in the number ofperson textbox..but i cannot pass the data to the textbox.any solution...thanx in advance..here's the codes: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.util.*; public class Cinema extends JFrame implements …

Member Avatar for sakurayana
1
218
Member Avatar for catpoints

Hi. I am trying to display a JFrame containing a JLabel with an image, and I can't get the image to display. The text appears fine. I've done this before with no problem, so I have no idea what is wrong. I've tried everything I can think of to fix …

Member Avatar for catpoints
0
2K
Member Avatar for Naruto1

Level 2 Version B - Level 2 above plus  Use of classes and objects to store and manipulate the item data Example • Write a new class ‘Event’ to represent details of sports event objects. A sports event consists of (for example) the event title, year and venue (“Olympic …

Member Avatar for Naruto1
0
701
Member Avatar for SilentHunter13

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at DatabaseTwo.manufacturerSearch(DatabaseTwo.java:81) at SearchManufacturerScreen.searchForManufacturer(SearchManufacturerScreen.java:241) at SearchManufacturerScreen.actionPerformed(SearchManufacturerScreen.java:192) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6263) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:6028) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4630) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at …

Member Avatar for JamesCherrill
0
228
Member Avatar for TinyBelly

I dont know what the problem...seems the button didnt work at all..~ help me find the problem plss... [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class listOfMovies extends JFrame implements ActionListener { private JLabel jlbWelcome, jlbPick; private JButton jbtBatman, jbtAngels, jbtDue, jbtFaster, jbtFour, jbtHuman, jbtWarrior, jbtWater, jbtHarry; public listOfMovies () …

Member Avatar for JamesCherrill
0
213
Member Avatar for BOOMBOOMF

Hey i have a project that i have put the Questation at the end of this message i am a newbie to java and have make this my mainly Questation how do i put somethin in my arrays from GUI ?? and how do i search in name or id …

Member Avatar for mKorbel
0
140
Member Avatar for surfdude167

Hi this isnt wrking i need help!!!! [code] import javax.swing.*; import java.awt.event.*; import java.awt.*; //used for layout manager import java.util.Random;; class GuessGame extends JFrame { private JButton newButton; private JTextField gField; //stands for guess field private JLabel firstPrompt, enterLabel, userMessageLabel; private int randomNumber, userGuess; private int counter = 0; private …

Member Avatar for stephen84s
0
142
Member Avatar for TinyBelly

I have this error --------------------Configuration: <Default>-------------------- Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at java.awt.Container.addImpl(Container.java:1041) at java.awt.Container.add(Container.java:959) at javax.swing.JFrame.addImpl(JFrame.java:540) at java.awt.Container.add(Container.java:365) at ticketReservation.<init>(ticketReservation.java:114) at bookAngels.actionPerformed(bookAngels.java:163) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6267) at javax.swing.JComponent.processMouseEvent(JComponent.java:3267) at java.awt.Component.processEvent(Component.java:6032) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4630) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4460) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577) at …

Member Avatar for stephen84s
0
149
Member Avatar for TinyBelly

Hye guys...im trying to create ScrollBar Horizontal on whole frame, i keep trying and do some research but still fail...Please help me...What should i add. This is the code. [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; public class listOfMovies extends JFrame implements ActionListener { private JButton jbtBatman, jbtAngels, jbtFaster, jbtDueDate, jbtHuman, …

Member Avatar for mKorbel
0
208
Member Avatar for laitingfei

I have a Computer Science project due Monday. We have to make a game and use GUI in order to ensure ourselves a good score. I decided to make Hang Man. The class reads in a txt file of common SAT words (I'm a sophomore in high school, so I …

Member Avatar for rebecca94
0
2K
Member Avatar for TheQuad

Hi I'm making the mastermind game but using numbers instead of colours. The one part that I'm stuck on is when the right number is guessed but in the wrong position, it seems to count it too many times. for example; generated number: 4234 guess: 2122 real answer should be …

Member Avatar for peter_budo
0
1K
Member Avatar for guru_iyer

Hey here's my code for functioning like MS Paint. But JLabels are just not visible. Please Help. [CODE] import java.awt.event.*; import javax.swing.*; import java.awt.*; import java.awt.image.*; public class MSPaint { JFrame frame; JPanel panel; Painting paint = new Painting(); public MSPaint() { frame = new JFrame("MS Paint"); frame.setSize(1024,768); panel = …

Member Avatar for guru_iyer
0
1K
Member Avatar for rithish

hello i use eclipse when i add action listener for button it marks as redline iam using swing component what is the problem ?what is the actual problem in that

Member Avatar for jon.kiparsky
0
94
Member Avatar for guru_iyer

I am trying to change the background color of the JPanel every 3 seconds (3000 ms) when I click START button till I press STOP button. [CODE] import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Random; class TimerBackground implements ActionListener { JFrame frame; JPanel panel; JButton btnStart; JButton btnRed; JButton btnGreen; …

Member Avatar for guru_iyer
0
1K
Member Avatar for rithish

[CODE]import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public abstract class login extends JFrame implements ActionListener { public static void main(String[] args) { JTextField firstField = new JTextField(10); JPasswordField middleField = new JPasswordField(10); JButton b1=new JButton("ok"); JLabel firstLabel = new JLabel("username", JLabel.RIGHT); firstLabel.setDisplayedMnemonic('F'); firstLabel.setLabelFor(firstField); JLabel middleLabel = new JLabel("password", JLabel.RIGHT); …

Member Avatar for rithish
0
167
Member Avatar for Tellalca

Hey; I'm trying to do a hang man game in Java. I newly learned some stuff about programming some GUI using Swing and AWT, but I'm not still clear with it. The problem is that all the drawing is done by a single function paintComponent() from the JPanel that I …

Member Avatar for mKorbel
0
178
Member Avatar for TinyBelly

I've tried many time to solve this problem...but still not successful, I'm newbie..so anyone of guys can help me check this problem... [LIST] [*]Button "Back" is big as frame [*]Seems no TextField for NoOfTicket [/LIST] [CODE]import javax.swing.*; import java.awt.*; //import java.awt.event.*; public class ticketReservation extends JFrame { private JLabel jlbWelcome, …

Member Avatar for TinyBelly
0
173
Member Avatar for CorruptionInc

I have to create a Pizza GUI that shows pizza size choices and topping choices for pepperoni and mushrooms and then calculate the total. I'm having trouble constructing the GUI. Down in the createCenterPanel method Eclipse is tell me that radioButtonPanel, checkBoxPanel, and pricePanel cannot be resolved to a type. …

Member Avatar for CorruptionInc
0
5K
Member Avatar for Kuroshi

I want to learn how to connect computers so I created a game for 2 players that was played on the same computer, now I want it to be played on a network. I have been trying to do this with sockets. I have a server class: [CODE]public class WordsGameServer …

0
97
Member Avatar for thes0mething

Hello everyone on Daniweb!:) I'm all new with working with swing and I'm having some problems making my paint method work:/. Atm I'm just tryin to make it write a ball, which I can control into different directions. Right now there is quite alot of unnecessary stuff in my code …

Member Avatar for JamesCherrill
0
2K
Member Avatar for shyla

Hello, i need help on how to create a JLabel as a status bar that display count representing the number of each shape display in addition i need to create a class called MyShape and make it a superclass this my code for for al shapes : [CODE]package Lab8; import …

Member Avatar for shyla
0
254
Member Avatar for TinyBelly

Help me guys..im trying to make event handling for button "Report" to display Value and Result on another window... i dont know what the problem...~ help me guys.. and can someone teach me how to do the meter to kilometer if i press "Convert" button.. p/s : sry for my …

Member Avatar for JamesCherrill
0
132
Member Avatar for Chitru

i googled for awt learnings then found a thread that awt is not necessary, you can directly go to swing. then i started swing, but i can't underdtand it that easily. now i know the very basic in swing, will you please help me to increase my accuracy by giving …

Member Avatar for JamesCherrill
0
318
Member Avatar for thedalek

Hello, I've written a fairly simple program to print a string in a window...But my Java compiler (JGrasp) will not compile it. It says: JDemoGraphics.java:7: cannot find symbol symbol : method String(java.lang.String) location: class JDemoGraphics String companyName = String("Event Handlers Incorporated"); ^ I've checked my capitalization, run a debugging program, …

Member Avatar for yancouto
0
216
Member Avatar for Amoryethel

Hi, I'm in the midst of creating a BrickBreaker game, and I'm having a bit of trouble repainting the Ball back to where it originally started at the beginning of the game. Which only happens when the ball hits the bottom of the screen (initY == bottomBound || initX == …

0
59
Member Avatar for lynnajoe

Hi, I am confused as to all the posts by newbies. If they are new (which I am) how do they know all this code they post? I have a question and it is very basic. All I want to do is to get one JButton to pull up an …

Member Avatar for yancouto
0
136
Member Avatar for stupid guy

hi all, i m trying to insert a textfield's value in a table through applet.The table name is samp and it has only one column named 'name'.I did following control panel->admin tools->data source->and then i have added a 'bike2' as new data source. I have 4 files created. 1.Entry.java 2.Bikinfa.java …

Member Avatar for mKorbel
0
397
Member Avatar for unkn0wnStu

Hi, I'm trying to create a highscore database for my game, and would like to start off with a view high score frame. When the user clicks this frame will pop up, but for some reason I can't set the player and score information to my JLabels. I'm not sure …

Member Avatar for JamesCherrill
0
3K
Member Avatar for sj5536

hi i want to create swing application that has google map i searched on net but i hanot got any useful resource

Member Avatar for peter_budo
0
314
Member Avatar for sumprit

Hi..., i have a problem. if anyone can please give me some suggestion then i could able to proceed further. My problem is that i need to show database values in JTable. i have two database table and i query to display data in a JTable. I am just sending …

Member Avatar for javaAddict
0
158

The End.