Problem with KeyAdapter and JButtons in a Jframe

4417 byte By ramon22a at 2007-10-1 21:37:54
yes hi i have searched almost most of the threads here but nothingam trying to make my frame accepts keypress and also have some button on the frame here is the code and thank you for the all the helpimport java.awt.*;import javax.swing.*;import java.awt.event.*;public class RPg extends JFrame ...

Why the same keyCode for 'A' and 'a' ?

675 byte By aboaventuraa at 2007-10-1 21:41:04
Hi,I wrote a program to test the behavior of keyTyped, keyPressed and keyReleased and I've noticed that the keyCode() method returned the same code for both 'A' and 'a', for example. In this case, the code returned for both was 65.Why does it happen ? Do I need to set something to change ...

incompatible in unix? calculating cpu time in swing ?

547 byte By ch_lia at 2007-10-1 21:42:55
I am confused about the fact that when I run my swing program in netbeans on windows xp platform. The buttons have the ability to traverse the focus around using TAB key. But when I run the program in unix, the TAB key has no effect on the focus at all. I really want the TAB key to work ...

Is using key events really that hard?

1683 byte By WhyNotFerzlea at 2007-10-1 21:51:28
I am trying to implement a keyListener for my application, and it seemsway harder than it should be. My application is simple: A JFramewith one button and one JPanel upon which I draw. When I clickin the JPanel and type, I want things to happen. After much looking, it seems I have to not only ...

unable to pass event from GUI to Business logic

5365 byte By on_rajua at 2007-10-1 21:51:37
This is my main Application GUIpublic class AppUI extends JFrame{= = = Container contentPane; // button panel/protected MyButtonPanel paneBU;// business logicAL99 al99;public AppUI() throws Exception {super();initAppUI();} // general stuffprivate void initAppUI() {contentPane= ...

Non-GUI Events?

820 byte By Kdanskya at 2007-10-1 21:53:50
I'm trying to create an event-handling structure which does not (directly) involve a GUI. To be more concrete, it does not fire off any GUI Event, but off an RPC call. The point is, I don't want the remote client to wait until the Server has finished with the call, as it's "only" doing some ...

Mouse Listener Problem...

606 byte By G-Rehukua at 2007-10-1 22:10:59
Hey all... I'm having probelms with mouse listeners.I have a JPanel (mainJPanel) that has a gridlayout (2, 2). To this I have added a mouse listener that gets the position of the mouse in this panel. To mainJPanel, I'm adding four JPanels (subPanels, were i is 0 - 3). Now I wanted to add ...

repaint() seems to work about %40 of the time

3282 byte By Ubarcha at 2007-10-1 22:11:36
Hello, I'm certain this is due to a misunderstanding of threading on my part. I have a JInternalFrame that displays a picture. When the user clicks the mouse, I would like to have this frame's GlassPane draw a line over the picture from the original click point to the current mouse location. ...

How to stop AWT converting drag event to mouse entered event?

719 byte By gmawsona at 2007-10-1 22:14:57
I have noticed that when my application pops up a modal dialog, then I click & drag the mouse on this dialog, AWT fires MOUSE_ENTERED events to listeners on components within the underlying frame.It determines which component's listener to inform via a call to ...

JMenu Scroll Button

233 byte By rupeshbka at 2007-10-1 22:22:53
SUN JDK on LinuxDoes SUN JDK have a Scroll button and scroll implementation when the Jmenu iteam are more than say 200+ ?I tried with SUN 142 and 1.5 but did not get a scroll to scroll down to the last menu item.

ItemListener for ComboBox

798 byte By coolera at 2007-10-1 22:23:11
I have this scenario: I want to pick up a particular item from a combo box using my up and down keys. After selecting the item, if I press enter, it should pop up a dialog.The combo box listener should also listen to mouse events.Can using itemStateChanged(ItemEvent e) of ItemListener for the ...

dateTime problem (java.util.*)

270 byte By ugpja at 2007-10-1 22:28:48
GregorianCalendar day=new GregorianCalendar();s=day.getTime().toString();System.out.println(s);// It displays like this//Wed Aug 31 13:33:19 GMT+06:00 2005//I want to get only this://Aug 31 2005HOW CAN I DO THIS..?

Progress bar

121 byte By pfigueiraa at 2007-10-1 22:39:36
Can someone gives me a simple code example of using a Progress bar while copying a file ?Thanks in advance.

reconstructing JPanel by an event

289 byte By HelpGrandixa at 2007-10-1 22:45:15
Hai there'i have an app , when a button clicked it should add a set of components in row wise in JPanel which is in a JScrollPane.I have problem that JPanel losts the previous components at each click.How could i make the Viewport to show components added previously.

valuechanged before focusgained

1600 byte By Nagypapia at 2007-10-1 22:47:50
I have a single cell selectable list and a text field.Writing something in the text filed changes the selected value of the list. This works fine. Let's call this selected index keypadSelection.Now if somebody wants to click with the mouse on an element in the list, I want valueChanged to ...

invokeLater()

181 byte By fazera at 2007-10-1 22:48:19
hi, i am creating an swing application, i like to use invokeLater() method .anybody can help me? when and how i have to use method in my applcation?fazer

Capture All Mouse and Keyboard events even if java window NOT in FOCUS

147 byte By SamSamSama at 2007-10-1 22:54:01
Could you guys please look into this link:- http://forum.java.sun.com/thread.jspa?threadID=660021&tstart=0RegardsSam

Newbie - need direction on adding a comport listener to batik application

1218 byte By mordancya at 2007-10-1 23:10:57
I need some direction for adding a commport listener to an existing gui application and displaying parsed pieces of the commport data within the current svg document. I am new to java and I am having problems working on this new project. I have between 25 and 30 java books that I am using as ...

How to wait until a event get processed !!!

412 byte By toosweetvasu@yahoo.coma at 2007-10-1 23:14:37
Hi,I'm working on a AWT based application in Java. In that, i got a scenario where in i need to wait until a event get processed and dispatched. I mean, I want to wait until the given event gets processed and then perform some other actions on appliccation. Is there a way to achieve this ? If ...

Trying to use "Back" button with java browser

7435 byte By java_greena at 2007-10-1 23:26:52
All:I'm trying to make the "Back" button in my Java web browser work. Any help would be greatly appreciated. Here is my code:import javax.swing.*;import java.net.*;import java.awt.*;import java.awt.event.*;import javax.swing.event.*;import java.util.*;import java.io.*;import ...

some component eat my F8 key

634 byte By qeba at 2007-10-1 23:27:16
Hello,I've got the problem with some component in my app. In menu bar I've got accelerators for F5, F6, F7, F8. what is funny F5 and F7 works, but F6 and F8 are eaten by some component.I've seen similar problems on Forum (with i.e. Ctrl-C issue)One solution is to clear ActionMap for ...

Animations and handling events

265 byte By chamalsla at 2007-10-1 23:28:46
Hi,I want to display an animation on a JPanel. But when I draw on JPanel using a threads run method, the JPanel stops responding to other events such as mouse clicks on JButtons.Can u plz tell me what is wrong.Thanks a lot,Chamal.

Simple problem updating GUI

1041 byte By joaomgcd1a at 2007-10-1 23:34:38
Hello.I have what looks like a simple problem, but I can't figure out a solution.private Progress progress = new Progress();final ProgressBar progressBar = new ProgressBar(composite, SWT.SMOOTH);I have created a class (Progress) and a progress bar. This bar should be updated with ...

MouseClicked problem....

1155 byte By ugpja at 2007-10-1 23:37:54
public void mouseClicked(MouseEvent e){int i=Integer.parseInt(jTextField1.getText());if(i<2100){System.out.println(i);}else if(i>2100){int j=JOptionPane.showConfirmDialog(null,"Please,Enter a vaild YEAR","YEAR NOT VALID !",JOptionPane.YES_NO_OPTION,JOptionPane.ERROR_MESSAGE);if(j==0){ ...

Adding inner class object

1311 byte By bssrbalajisua at 2007-10-1 23:52:52
Hello to allI have one doubt regarding eventhandling. Consider i am having one class named outer which extends applet and with in outer class i am having one class inner which extends panel.Now when i try to add the inner class object in action performed of outer class it doesnt get added. How ...

Timeout a client app

376 byte By nose-85a at 2007-10-2 0:14:59
I have a java GUI client/server application that uses swing classes and AWT . I need to timeout the client application after 4 hours. Does anyone have any tips of how to do this? Do I try to timeout the RMI socket connection or do I try to use some sort of listener to see if there has not been ...

Value of VK_SHIFT + VK_A

317 byte By mache_1999a at 2007-10-2 0:18:01
Hi everybody,If I want to send as an integer parameter the KeyEvent.VK_SHIFT + VK_A,is that possible to do?panel.add(makeLabelOption("-D", KeyEvent.VK_SHIFT + KeyEvent.VK_D));Should that work? Or should I use something else?thanks a ...

listener question on a checkboxjlist

502 byte By LORDs_diakonosa at 2007-10-2 0:21:15
I created a list that acts like checkboxes but I am having some trouble> See my post here for the code. http://forum.java.sun.com/thread.jspa?threadID=665163&tstart=15 on the I construct this my checkboxjlist on a panel and populate him. All is good. I click and the listener fires and if ...

Not handling button event?

5801 byte By qwerty987654a at 2007-10-2 0:32:11
//package com.ociweb.preferencestest;import java.awt.event.*;import java.util.prefs.*;import javax.swing.*;/*** A frame to test some basic functionality * in the Preferences API** @author Object Computing Inc.*/public class PreferenceTestFrame extends JFrame implements ActionListener {// A ...

how to handle doubleclick mouse event in java

271 byte By sanjaygarothayaa at 2007-10-2 0:32:19
i want to handle double click mouse event in java i use getClickCount() function but i want that on onetime click show othere windowsand on doubleclick show diif. windowbut problem is that onetime is occuer always if u click doubleclick

event to show Mouse pointer coordinates

1652 byte By Servant@AKa at 2007-10-2 0:42:21
Hi allI have an Applet that implements MouseListener and MouseMotionListener events.In mousePressed() method i'm writing code to draw a point on the location where the mouse was pressed.In mouseMoved() method (the problem) I'm trying to write code so that the coordinates of the mouse pointer ...

Tab Switching

365 byte By LexSeetoha at 2007-10-2 0:44:17
Hi,I have 2 JTextField and 2 Buttons.What I want to do is that when I press tab, the focus is passed on to the next control.For example, when I start the application, I'm at textField1. I press the tab button on the keyboard, the focus is passed to textFied2, later button1 and button2.Can ...

'you need a 'buttonClicked' method' problem

3106 byte By JavaNovice05a at 2007-10-2 0:48:26
The following program gives a clean compile. However, upon execution, I get a messageBox error.import java.awt.*;import BreezyGUI.*;import java.io.*;import java.awt.event.*; public class ProfileWriter extends GBFrame{LabelNameLabel= addLabel("Name", 1,1,1,1);TextField NameField= addTextField(" ...

TextField can't input word?

1477 byte By little1981a at 2007-10-2 0:49:22
The code as following:setLayout(new FlowLayout(2));add(MainPanel = new Panel());MainPanel.setLayout(new BorderLayout(1, 1));MainPanel.add("Center", ItemPanel = new Panel());//ItemPanel.setLayout(new GridLayout(2, 1, 0, 0));ItemPanel.setLayout(new BorderLayout(10, 30));Panel ...

JInternalFrame Problem

2848 byte By henri_sergea at 2007-10-2 0:53:13
I have created two JInternalFrame objects and placed them in a JDesktopPane. Only one JInternalFrame is visible at a time. I have a button that when clicked makes one disappear and the other become visible. It works the first time, but subsequently, when clicked, the same button does not make ...

ActionPerformed method

146 byte By deeps_inda at 2007-10-2 1:04:45
I have an array of JButtons. How do i get the index of the button which trigerred the action event(from inside the actionperformed method)?

Right Click Functionality with options like Refresh and Copy

237 byte By PashaGeeka at 2007-10-2 1:05:01
The scenario is like this, in a GUI JTable , when i right click on some cell. I should get the screen similar in windows but i should add the funtionality of copy and cancel . Can any one resolve this? Any one help is appreciated.

Context Menu on TABLE CELL when RIGHT CLICKED IN SWINGS GUI

154 byte By PashaGeeka at 2007-10-2 1:05:50
Can anybody tell how to place context menu in cell of jtable in GUI?The context menu should come when right clicked on one cell of a JTable.

how to add a row to database from tableModel

361 byte By i_virusa at 2007-10-2 1:08:13
hi friends,i wnt to know that is it possible that when i add some rows in a table which has been created by a table model to add those rows to database like what happen in MS Access when u add rows and close the window the rows are automatically added to databasei want to know where to add the ...

JTextArea

997 byte By aleanera at 2007-10-2 1:14:33
I have two questions:1. Why text is not showing on the other text area or on the command prompt? import javax.swing.*;import java.awt.*;import java.awt.event.*;public class Jta extends JFrame{JTextArea ta;JTextArea ta1;JPanel p;public Jta(){ta= new JTextArea(3,35);ta1= new JTextArea(3,35);p=new ...

dialog box to emulate windows lock'*** mechanism

315 byte By bobot_moradoa at 2007-10-2 1:23:51
is there a way to put up a dialog box or a simple panel with username and password that locks (sort of) locks windows and you cannot perform anything unless you enter something?it is assuming that we're not using the same entitlements as our windows login.please let me know if this is ...

How to use the method "getChildrenRemoved()" declared in ElementChange?

92 byte By donn_mma at 2007-10-2 1:27:07
How to use the method "getChildrenRemoved()" declared in DocumentEvent.ElementChange?

JTextArea Event

159 byte By Stuby085a at 2007-10-2 1:32:01
I am wondering what event listener to use to determine when the jtextarea is initially changed. I was thinking a keylistener, is this what i should use?

focusgained fires AFTER popupMenuWillBecomeVisible

3260 byte By Nagypapia at 2007-10-2 1:39:03
1. If I have an (editable) JComboBox. Why on earth does it's popupMenuWillBecomeVisible get fired BEFORE focusGained. I'd think logically a component first gains focus and then does it's stuff...2. Is there any way to change this?I want to change my combobox's model every time the popupmenu ...

Loading .EXE via event handling

353 byte By TDMKLa at 2007-10-2 1:49:08
I'm adding event handling to a GUI menu - the idea being that each menu item, when selected, would launch a .exe file (for test purposes 'notepad' but in reality, it could be any xp)The operating system is XP, and JDK 1.5.0 is being used.How do I do this? - there seems to be no information ...

HandleEvent for a Frame

2205 byte By CmanCPPa at 2007-10-2 1:56:00
Im very new too Java(Few Weeks). I have created a compression program in C++ and tried to convert it to Java. Just few mins after i started, i got a problem.Here it is. I cant close Frame frmMain. Does anybody knows what im doing wrong here?import java.awt.*;import java.awt.event.*;import ...

undefined variable: this in addActionListener()

5002 byte By pocniba at 2007-10-2 1:57:19
Why is this an undefined variable?import javax.swing.*;import java.awt.*; import java.awt.event.*;public class GUIPractice implements ActionListener {private static void createAndShowGUI() {JFrame frame = new JFrame("Address ...

valueChanged called multiple times

1788 byte By a_riota at 2007-10-2 1:58:52
Hi,I am having a problem with JTree events and wondered if someone has had the same problem. I have 3 JTrees that use the same DefaultTreeModel. Each however has its own selectionListener and willExpandListener. When a node is selected on one tree the valueChanged for all three Jtrees is called ...

How can I get events from a java program?

191 byte By Daniel5a at 2007-10-2 2:06:00
I want to make a monitor to watch a java program.How can I get the events from the GUI of this program some as mouse cliking, keyinput. So I can watch these in my monitor.Thanks

Thread issue

1756 byte By khalidoramaa at 2007-10-2 2:09:13
i have run this code .. but seems to have some problems in it ..It is an application for an electronic lottery engine... but it has to stop the processing given that the caption of the button is "stop" which is not happening .. what is wrong .. heelpimport javax.swing.*;import ...