117 byte By
micealja at 2007-10-2 9:05:48
is there anyone that is very familiar with the tree selection listener in jtree. i really stuck at the moment.
356 byte By
micealja at 2007-10-2 9:05:51
i have an application where i have tree with different nodes.When i click a node i want a chart to appear.i have the chart working where it comes up in the app straight away.now i want to change this so it works off the tree.so when i click different nodes i want different charts to appear on ...
334 byte By
zurka at 2007-10-2 9:08:28
i want to listen for a keybord input(not in textfield), when the user press button on the keybord i want to know what button he pressed.can anybody help me? show me please an example how to use it in a program.* i want to do this when it focused on JPanel but this is not he point.sorry for my ...
187 byte By
201Bella at 2007-10-2 9:23:03
suppose i have a tabbed pane with several tabs,,Every time a new tabbed is chosen,, i want my program to be informed(listen to some generated event), would that be possible?
my anonymous class is not working.i keep gettin an invalid method declaration. i think im either mispelling something somewhwere or missing a curly. public SpouseGUI(){add(new JButton("test"){addActionListener(new ActionListener(){public void actionPerformed(ActionEvent ...
Hy,I have a problem with the treeselectionlistener.I want to show data from a database using a JTree but the problem is that some nodes have the same name. So the methodepublic void valueChanged(TreeSelectionEvent event){TreePath path = tree.getSelectionPath();String test = ...
1604 byte By
mvpa at 2007-10-2 9:40:59
Hi all!I have this code: Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener(){public void eventDispatched(AWTEvent event){KeyEvent ke = (KeyEvent)event;if(ke.getID() == KeyEvent.KEY_RELEASED){System.out.println("released");}else if(ke.getID() == ...
How do I do the following code without generating an item selected event?employeeModel.removeAllElements();for (Employee employee : employeeList) {employeeModel.addElement(employee); // FIXME generates event at index ...
19682 byte By
Shmraa at 2007-10-2 9:47:38
I'm trying to create a simplified version of Suduko using a few arrays of JButtons, one dimensional and two dimensional. Finally got everything to compile and managed to overcome the NullPointerException, but now the buttons simply don't do anything. JGrasp doesn't report any errors. I ...
339 byte By
Somayaa at 2007-10-2 9:54:28
Hi everyone,I want to add a logging panel to my frame. I want to use it in order to diplay text messages displayed by the program rather than printing it to the console.I don't know how to direct the text to this panel. Would plz tell me how to do this? or give me a reference to read?Many ...
Hi guys, I haven't done this for ages and I can't figure out whats wrong with my code (below). I've got a button in my GUI, jButton6 which is meant to close the application when clicked. It doesn't like my addActionListener line, anyone spot the problem?public class close implements ...
I've got a main JFrame and another JInternal Frame that I would like to call when a button on my main JFrame is pressed. Could someone advise me on how to do this?Thanks.
Could someone please have a look at my NetBeans code below and tell me why the program freezes if you click on the Quit menu item under the File menu. I tried commenting out the JOptionPane code and it works fine so its something to do with that, but i can't figure out what./* * mapperGUI.java ...
Hi there,I am producing an interactive program / game in an applet for a client as part of my dissertation project in my final year at university. The game will be multiplayer and controlled using a mouse. The main idea is to have three people playing at a time as this is part of the ...
213 byte By
JNooreza at 2007-10-2 10:29:54
In JTable, if you double click on a cell, you can edit it....Instead i want to have a dialog popup, for more complex editing,how can i listen for the double click on a cell to do my own thing?
I made a small game[url= http://sc4r.battleschool.frih.net]Play it here[/url]It works fine in Firefox but the KeyListener doesn't work in Internet Explorer.I include the applet with this code:<!--[if !IE]>--><object classid="java:Shotgun.class" ...
781 byte By
Taajea at 2007-10-2 10:40:26
Hello,I'm having a problem with a mouselistener on a JButton. I have put some logging on the mousePressed, mouseReleased and mouseClicked events and the pressed and released events get triggered but the clicked event sometimes isn't.There is also an actionListener attached to the JButton ...
Everytime i shut down my java program i still have the dos window giving the press any key to continue message. How do i make sure i don't have to do this everytime?Thanks.
I am writing an input field class for a totally text-based application (so no JInputField, etc.). Everything works except deleting characters with the backspace key. I am using a class that extends KeyAdapter. I would like to ust use the keyTyped(KeyEvent) method to detect backspace, but I ...
Im a swing Noob.Here is what I have done. I have created a pane that holds other panes. I will call the panes that are added to the main pain childPanes. (are this what people refer to aswidgets?). Anyway the child panes have buttons on them and what I want to do is some how be able to assign ...
We have a problem when using the KeyListener. When a key is pressed (and held down) we use it to navigate an object, and therefor the delay that happens will create a stuttering effect. We would like to remove this delay so that when we keep a button pressed it keep happening without the ...
I will attempt to pear this down as finely as possible.I have a textfield that knows when people type in it - if enter is pressed on it - it will decode the text and get the information I want. It then takes this information and redraws different letters on canvases.Example:Typing move 1,8 into ...
139 byte By
jolaa at 2007-10-2 11:25:31
If my program taking inputs and i want to stop taking input if user entre entre key or number or any thing. How can i do such thing.
HI EVERYONE. I HAVE TO CREATE A TEXAS HOLDEM POKER GAME IN JAVA FOR A COLLEGE PROJECT. I AM HAPPY WITH MY GUI'S BUT MY IMMEDIATE PROBLEM IS DEALING THE CARDS. I AM UNDECIDED AS TO HOW TO DO THIS. IS IT POSSIBLE TO PLACE THE PICTURES OF ALL 52 CARDS INTO AN ARRAY AND THEN RANDOMLY GENERATE 2 ...
654 byte By
pria at 2007-10-2 11:42:04
HiI am in the process of migrating from version 1.3 to 1.4.2I have a screen on which I I have a button which is disabled when teh screen initializes. There are other items to which I can navigate through TAB.If i keep pressing Tab so that the focus comes to the disabled object, then it just ...
895 byte By
thaeeza at 2007-10-2 12:10:16
I have a JScrollPane that I want to be able to click (in it's canvas) and drag to scroll. I have a MouseMotionListener that captures MouseDrag events within the canvas, then adjusts the ScrollBars depending on the difference between the current mouseDragEvent.getX/Y() and the last event's x,y ...
I am new to working with FocusListener and I am trying to use it validate the input of a textfield to be an integer. This seems like a seemingly simple thing to do, but I am getting errors.Here is a portion of the code where I make the textfield and assign it to a focus listener.InputValidator ...
I have JPanel that implements Action Listener, then a few JButtons that receive an action listerner to (this). I noticed that evertime any button is clicked, the action associated to the button is repeated twice...public class GenerateFileView extends JPanel implements ActionListener ...
430 byte By
smily6a at 2007-10-2 12:25:18
hi!i'm jus starting to learn swing and i have come at the stage where i double click in a jTABLE n change the data there..but now i need to save all the changes in the table in a database, i have a Jbutton 'Save' but i dunno what to write as from there to save the new data. i've used ...
1580 byte By
patucosa at 2007-10-2 12:29:20
Hi everyone,here is my problem, for the moment in my opinion enormous.I am creating an application and one of its parts should be a Text Area whish shows (only read-only) the messages as the console(MSDOs or the one of eclipse, that is the one i磎 using) does.I am using eclipse and it has a ...
I've been trying to find out about making custom events in Java for a silly "freezer simulation" assignment.The problem is this: My main GUI uses a nested panel for data input, which is a separate class. When the data has been entered by the user into this panel, he/she presses the 'OK' ...
I am trying to practice both drawing and mouse event methods in Java. I am attemtping to make a program that creates a 10x10 grid, and whenever the user clicks inside one of the squares created by the grid, I want the click event to turn that square black.However, I am at a lost of how to even ...
Hi,I am trying to find out how to "look ahead" if a mouseReleased event is about to happen, from within a mousePressed method. Here is the pseudocode:mousePressed(....){ while( mouseNotreleased){ //perform some long running task here.}}mouseReleased(....){mouseNotReleased = false;}from this ...
285 byte By
igcoola at 2007-10-2 12:39:14
1) How do we select a component? For example, we want to be able to draw multiple lines or rectangles and be able to select one of them or multiple with a mouse click. How can the user tell what one he selected?2) When you select a component, how do we add handles to it?
2779 byte By
jjg.a at 2007-10-2 12:40:50
Hello:I have a general question about components specifically adding them to containers and removing them from the container.When I create multiple instances of some custom component and add them to a container and eventually remove all components from the container, my memory is not reclaimed. ...
Alright i have a basic form that has some text fields and a combobox. Now the information in my combo box is dependant on what was typed in one of the text fields.. For instance, my combo box contains a list of arrangements, and the user is to pick just one.. the list is composed of ...
2191 byte By
Mag9102a at 2007-10-2 12:42:35
Hi, I am trying to make my game respond to the key arrows. I can't get the keylistener to acknowledge that the key has been pressed and I think I need to focus the listener. I can't figure out how to do that. Here is some of the code:public ...
860 byte By
HIM666a at 2007-10-2 12:45:25
Hi, Im wanting to loop inside a mouseListener's mousePressed function. Basically, when you click an arrow, and hold it, I want it to keep moving an image in that direction. I've tried simply using a while loop, and having the mouseReleased function cause the while loop to stop, but, when it;s ...
I am looking for a way to check input fields for zero values in my action listener and bring up a message dialog if it finds one. I can get it to look for null or alpha characters but I can't figure out how to look for zero. Any suggestion would be appreciated. My action listener code is ...
I would like to use both the ListSelectionListener and MouseListener on my JTable. The problem I am running into is this:I need the ListSelectionListener to return me a value from the row that is selected, but I only want that listener to fire if and only if my MouseListener notices a double ...
Simple one here - Have a simple login box consisting of login name and password field, and underneath a submit button, and underneath that a progress bar.Basically I would like the progress bar to complete once the 'submit' button has been pressed! What is the code I need to use to invoke it ...
Hello everyone!I have a strange problem concerning glasspane used to block user input. The situation is the following:I use a JDesktopPane inside a JFrame. In the desktop pane there are placed multiple JInternalFrames. I use a JPanel as glasspane with dummy listeners to block the controls in ...
An event handling pattern that I have used is combining the Command pattern with a Mediator. I make classes for my graphical Components and have them implement a Command interface with an execute() method. I have a private class embedded in my top-level JFrame class that casts Event objects ...
2173 byte By
wilca at 2007-10-2 13:19:36
Hello.I need to create multiple JWindow with same owner(JFrame) that are all visible(including JFrame). But a behavior that is like creating multiple JFrame(when a JFrame was clicked, other JFrame will not move to top even they are visible)try check this code...CODE 1://multiple JWindow with ...
I am new in Java. Idon't khow how yo event. Plz tell me about event handling.
I am new in Java. I don't khow how to handle event. Plz tell me about event handling.
This code is intended to work kinda like Google Suggest.But it has one bug that I can't figure out. Whenever I manually select an item using the dropdown box it either blanks the text.As I stated in the topic, it seems insertUpdate is being called before the text is actually put into the ...
281 byte By
Swedera at 2007-10-2 13:37:01
Hi,my app has two identical tables with different content, same columns. If the user changes the width of a column, I want to make the same column in the other table also to resize. Anyone knows how to do this?Your help is much appriciated.Sweder
Hi, I had a application created with 3 JTextfield, one checkbox and one submit button. Instead of using TAB to focus on next field, i like to use arrow as well, maybe i know how can i do this ?
I apologize if I'm way off base on this. I'm quite new to Java, and this project may have been a little too ambitious for my first foray. I also think I'm having some trouble dropping old (bad) VB/ASP habits.I'm attempting to implement an app that consists of three main classes. The first ...