TextField get focus by mouse?

667 byte By little1981a at 2007-10-2 2:11:42
public void actionPerformed(ActionEvent actionevent) {if ( textField.isFocusOwner()==true){if(textField.getText().equals("Please input text") )textField.setText("");}}But TextField get focus by pressing "Enter key".How could i use mouse to get focus in TextField?Thanks a lot ...

Detecting JInternal Frame Closure

131 byte By henri_sergea at 2007-10-2 2:14:29
How can I determine if a user has closed a JInternalFrame? My Frame is a separate class outside the main class.Thanks

Value Change Listener

199 byte By tactusa2a at 2007-10-2 2:25:03
I need something like "value change listener" that immedialy call a function as soon as the value of i element of global array/vector changed. What should I use? Please help. Thank you.

how to create an event

600 byte By sameera at 2007-10-2 2:31:27
hi to all i m beginner in java programming and i want to do event handling on mouse click. i have a buttonJButton btnclose = new JButton("Close");//in main areabtnclose.addMouseListener(this); //in main area then after the main block i have this codepublic void actionPerformed( MouseEvent e ) ...

new window in event handling

198 byte By sameera at 2007-10-2 2:31:28
hi to all i m beginner in java programming and i want to do event handling on mouse click. i have a button and i want if i click that button a new window open can anyone help me

Help me in JTree event handling

978 byte By divyasria at 2007-10-2 2:39:19
I wrote the code in this way.public void tableChanged(TableModelEvent e) {int row = e.getFirstRow();String olduse=null;int column = e.getColumn();TableModel model = (TableModel)e.getSource();String columnName = model.getColumnName(column);String data = (String)model.getValueAt(row, ...

NullPointerException originating from java.awt.EventDispatchThread.pumpEve

3210 byte By usha_solankia at 2007-10-2 2:44:49
Hi,I am using jdk1.4 for my application development. I am getting following exception at runtime. Any idea how to fix this problem? Thanks,Ushajava.lang.NullPointerExceptionat javax.swing.plaf.basic.BasicTreeUI.paintRow(Unknown Source)at javax.swing.plaf.basic.BasicTreeUI.paint(Unknown ...

MouseEvent.CTRL_MASK is being masked as MouseEvent.SHIFT_MASK

1581 byte By senecaha at 2007-10-2 2:46:19
I am working on a legacy Java App that was written in the 1.1 era. We have recently upgraded enough components and keywords so that the applet is now compiling and executing under JDK 1.5 but it seems that the CTRL + Mouse click action is being masked as a SHIFT + Mouse click on our table ...

Avoiding the special character from backspace key when using keylistener

735 byte By Viveka at 2007-10-2 2:49:01
Hi,I am using a keylistener on a JTextField. Whenever the user types something in the textfield, the keylistener picks it up and shows it on a label, dynamically. The problem is that when the user hits backspace, the keylistener picks that up and shows it in the label as a special character (a ...

How can a JDialog capture KeyEvents?

499 byte By Ruboa at 2007-10-2 2:56:57
Hi, I want my JDialog to setVisible(false) when user presses Esc key. I've tried two ways but failed to make it.Method1:this.addKeyListener(...);// this method doesn't work at allMethod2:this.getRootPane().registrKeyboardAction(...), and I put this.setVisible(false) in the event handling ...

How to enable CTRL+C to perform action instead of coping to clipboard?

351 byte By anardeva at 2007-10-2 3:18:45
I have a problem with CTRL+C, CTRL+X, CTRL+V keystrokes.I have defined actions for this shortcuts but they are never triggered.This shortcuts have normal window behaviour, it means that CTRL+Ccopied selected item to clipboard instead of performing defined action.If I change it to some other ...

KeyListener problem with JApplet

894 byte By battassa at 2007-10-2 3:24:39
Hi Guys how are you doing?I developed an JApplet which is drag and drop enabled to upload local system file to server. In this JApplet in addition to DRAG and DROP i am trying to add PrintScreen image copy on to the applet. I did everything like getting the clipboard image and creating a image ...

catch a key event in JFrame

504 byte By BadCodera at 2007-10-2 3:25:59
hi,i am coding a GUI application for some FSM(Finite State Machine) simulation purpose. the app can load the FSM and display it. i can selecte some part of FSM and using "delete" key to delete the selected states. i did register the KeyEventListener to the the JFrame. but when i try to press ...

info about images using MouseMotionListener

765 byte By _innerSilencea at 2007-10-2 3:32:07
hi,I am drawing a couple of images using Graphics.drawImage() in the paint() method in my JApplet that i registered a MouseMotionListener. I update global xCoordinate and yCoordinate attributes of my applet and call repaint() in mouseMoved() method. Inside paint() method, i check if the mouse ...

Swap numpad comma for period

787 byte By equexa at 2007-10-2 3:55:22
Hi. This is my first posting here, though i cannot find anything on the web or these forums to help.Scenario:I have a JTable in my GUI, and the users wants to be able to do all the cell input via the Numpad. Thing is, an API i am depending on, does not like it when someone uses "," (comma) for ...

The reflection answer to event handling?

2280 byte By Drake_Duna at 2007-10-2 3:55:32
I have been playing with reflection answers to the question of how to handle ActionEvent events in Swing... like using a single instance of one member class as a reflection switch:private class Listener implements ActionListener {public void actionPerformed (ActionEvent action) {try ...

user-definded Events and Compents

176 byte By MIlea at 2007-10-2 3:58:46
Hi all:i want to use user-denfinded compnets to recieve user-definded events,how can i achive it or who can give me some hints?Thanks for your help.

TableModelListener

1782 byte By henri_sergea at 2007-10-2 4:07:09
I want to add Event functionality to my Table which is a subclass of JTable in order to be able to edit the JavaBean values displayed in the Table. I used the addTableModelListener() method but it does not compile here.Please see the link to get an idea of what I am trying to ...

Updating the columnnames i a JTable

713 byte By Fluida at 2007-10-2 4:10:50
HelloI posted this question in new to java, without much response. Hoping for more here.I have a class (tm) that implements TableModel. Another class show the JTable using this tablemodel. In the JTable user can change the Strings that is returned by the tm.getColumnName(int col), and I was ...

UncaughtExceptionHandler for the event dispatch thread?

1529 byte By coryb891a at 2007-10-2 4:13:35
The default behavior of the event dispatch thread in response to an uncaught exception is to print a stack trace of the exception and then terminate (a new event dispatch thread will start in its place when more events are generated). I found this out from reading the source code comments ...

Actions and mnemonic keys

259 byte By ogami_ittoa at 2007-10-2 4:20:02
Hi allI have a JToolBar with some Actions (classes that extend AbstractAction) and I would like to associate shortcut keys to those Actions, something like ctrl + n to open a new window. How can I do that? Any pointers or ideas would be welcome.

ComboBox event handling..

360 byte By ahgana at 2007-10-2 4:26:24
if let say my comboBox got "A","B","C"...then i got name field and ID field.how can i make it where the comboBox "C" is choosen and it will record down?so that when i open that particular record back..it show "C"i can save the name and ID but do not know how to save the content of ComboBOx ...

cell handling...

327 byte By ahgana at 2007-10-2 4:27:17
i got a collection of data in table cell...then i got button of deletehow can i make it when i click the particular cell data at the table and then click button delete,the particular data that i wan delete will delete?how to make the delete button know the cell i clicked is the thing i wan to ...

What event handling code do I need to access a web site ?

7419 byte By SteveJosepha at 2007-10-2 4:37:16
Hello I am doing program with a driver class that accesses programs and a web site. What event handling code do I need to accessa web site when I press a button?I have in my actionPerformed() methd:ActionListener myActionListener = new ActionListener() {public void actionPerformed(ActionEvent ...

how to register mouselistener for custom class?

457 byte By z_idanea at 2007-10-2 4:43:18
i m trying to create a custom class (extending java.awt.Rectangle)which responds to mouse gestures.i m using it as an object on my drawpad which responds to mouse behaviorlike rollover.the rollover color change is achieved using canvas' graphics object triggerd by my cutom classi m not able to ...

JRadioButton itemListener infinite loop

414 byte By chamerlinga at 2007-10-2 4:49:35
Hi,I'm new to swing development, here is my problem.I have a JRadioButton with an itemListener, the listener works fine and it do what it have to do but i need to access to it and to change it's selection mode with the setSelected(boolean b) method and not just with the mouse... and of ...

selectAll() on focus of JFormattedTextField doesn't respond

418 byte By tango1383a at 2007-10-2 4:51:41
Hello everybody, I want my JFormattedTextFields to select all of their content on focusing. While this is no problem with normat JTextFields, the formatted ones don't respond to slectAll(). I found the a workaround, but an ugly one: it works if I first change the content of the Field: ...

Window maximize block

381 byte By ricardo_ralona at 2007-10-2 4:52:30
Hi all!I'm kinda new to Java, and I need some help.I want to block the maximize option for my window, is that possible?It's more a stylish problem, really, 'cause when the window is maximized the whole format disapears and the pictures get mixed with the text, and stuff like that. And I want ...

UR a Genius...If u solve my problem.besides the reward is this cool program

37004 byte By unsafepilota at 2007-10-2 5:02:09
Well, if u copy something from the textarea and paste agin on the textarea it does not respond.How ever, if u paste somewhere else on the system it works perfectly.please....help..and one more thing can anyone tell me how u underline something in JTextArea and also superscript...any help wud be ...

AWTKeyStoke error?

3292 byte By thijsbroa at 2007-10-2 5:13:23
Hi all,While writing some code that would override the method 'processKeyEvent' in JComponent, i needed to find a way to know of which type (e.g. pressed, typed of released ) a fired keyevent was. I thought i found it in the 'getKeyEventType()' method of AWTKeyStoke (see code below), but ...

Problem With Assignment, Need Tips

1262 byte By 0rtona at 2007-10-2 5:28:05
Hi, i'll try and keep the code to a minimum. My assignment (at UNI) is to create a JUG Program (Java Ultimate Graphist) which works like a paint program.So far ive done most of it. But im having problems with combo boxes. Basically its required to have a combo box at the bottom where you ...

Overloading setActionCommand

469 byte By nikeairja at 2007-10-2 5:37:44
How can I inherit setActionCommand for JButton and overload it? I want to make a new setActionCommand with more parameters, but I couldn't figure out how to do it. For example, the default method parameter is:setActionCommand(String command);I want it to do something like ...

Keylistener in JPanel and JApplet

2063 byte By shreyama at 2007-10-2 5:50:34
Hi i am trying to work with KeyListener in a JPanel which is called from an applet. But i am unable to get any key events on the panel. Here is the code of sketch so that when one clicks on arrow keys it draws shape on the Panel. Can any one help me where is the problemimport ...

How to create hot key?

12104 byte By wei_ninga at 2007-10-2 5:54:50
Hi all,I'm creating an application by using the J2SE v 1.4.2_10 SDK with NetBeans 4.1 Bundle. I have created 4 button and handles event each. I would like to create a hotkey for each button, "F2" key for jButtton2, "F3" key for jButton3, "F8" key for jButton4, "F1" key for jButton5, once i ...

Separte GUI and application code

1653 byte By shreyama at 2007-10-2 5:56:26
Below is my code to separate GUI and application code. When i try to execute the code i get message applet not initiated. Can any one point what mistake i am doing in the code. import javax.swing.*;import java.awt.event.*;import java.awt.*;class ColorAction extends AbstractAction{public ...

calling another method from the actionPerformed method.

1318 byte By arudolea at 2007-10-2 6:13:08
Hi,I have a clss with the following code -public class ABC extends JFrame implements ActionListener{String myAge;JButton jb;JTextBox ageInput;In the constructor,//Create panelspublic void actionPerformed(ActionEvent e){String name = (Strng) ...

Colour problem

743 byte By fwabblya at 2007-10-2 6:13:12
I need to use use the elements package to draw a picture and colour it in. Unfortunately this package doesnt let you just draw a triangle you have to define 3 lines. I can do this but then i need to colour it in and im not sure what im doing wrong. Im pretty sure that im just getting something ...

Animation

4480 byte By fwabblya at 2007-10-2 6:14:15
This is my code:import element.*;import java.awt.Color;public class jonesp_assign1{static DrawingWindow d;public static void main(String[] args){d = new DrawingWindow(800,800);int i;for(i=1; i < 4000; i = i + 20){sky();tree();bush();road();sun(i);car(i);}}public static void sky(){Rect sky = ...

urgent help on GUI

3305 byte By socxa at 2007-10-2 6:31:26
Hello,I am a newbie to GUIs in java. I am writing an application that has 4 buttons. You can run the codes below to see how it looks.I need it to connect to an oracle server when the "Connect to Server" button is clickedIf the connection is successful,It should set the text on lblStatus to ...

Beginner Help

1820 byte By sofaspud622a at 2007-10-2 6:38:09
I am using Murach's Beginning Java 2 book, and am learning how to code GUIs. It said to use the following code to close a frame properly.*** testFrame.java *****************************************************import javax.swing.*;public class testFrame extends JFrame{public ...

How to get information from an array of buttons w/ a single action event

329 byte By ToStuLaba at 2007-10-2 6:44:36
I have a 2 dimensional array of JButtons and whenever the user clicks on one of them I need to know what location that button is. I have the action listener class writen right, but what would code and heading would the action performed method have. The array is called arrayOfUserButtons and ...

long actionPerformed event kills valueChanged event. is it a bug?

5676 byte By Nagypapia at 2007-10-2 6:49:33
My situation (jre1.5_04, windows):I have a JList and an editable(!) JComboBox.I want to do something when the list Selection changes, in this case I want to show a messagebox that says which item I have selected. To be sure I don't show the messageBox twice, I don't do anything if ...

Hi how to convert arraylist to integer value

226 byte By misterraoa at 2007-10-2 6:51:36
hi.. plz provide code for "converting an arraylist to integer value" i tried with api but unable to get it properly.... i have an arraylist temp1 ....... and i have int uid .. so how to convert thnx

Math.power(...) help!!

698 byte By gurdz_studenta at 2007-10-2 6:56:46
Help!!I need to raise 2 to the power of another number, simple as it sounds im having a little trouble. The problem is I am raising 2 to the power of a very large number i.e. 2^1100 or even higher, and am recieving the error java.lang.NumberFormatException: Infinite or NaNwhich I am guessing is ...

BigDecimal divide Problem

463 byte By gurdz_studenta at 2007-10-2 7:01:48
Hello all,I am using the BigDecimal Objects and need to divide one number by a second both of type object BigDecimal, returning the answer ina new BigDecimal Object i.e.:BigDecimal returnThis = topLine.divide(bottomLine, BigDecimal.ROUND_UNNECESSARY);The problem I am having is that I only need ...

SQLException: Io exception: Got minus one from a read call

1449 byte By vtownbarriesa at 2007-10-2 7:07:54
Hi,I get this error from the following code:<%@page contentType="text/html; charset=GBK"%><%@ page import="java.sql.*" %><%@ page import="java.io.*" %><%Connection conn = null;try {Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection( ...

use of constructor

209 byte By misterraoa at 2007-10-2 7:21:37
hi could u explain the use of constructors.... in one class i have 2 constructors ..one is no argument constructor and second one is with arguments...... what these two constructors will do?....

No enclosing instance of the type AClass is accessible in scope

963 byte By marka971a at 2007-10-2 7:22:25
Hi all,Below is a file that defines AClass and CClass. I was told to use the construction CClass toRet = (CClass) AClass.this.createDClass(); in method method in CClass, but I can't get it to work. I get the message "No enclosing instance of the type AClass is accessible in scope". What does ...

how to declare an arraylist with "dynamic size"

269 byte By misterraoa at 2007-10-2 7:24:07
hi how to declare an arraylist with "dynamic size" .... means i have an arraylist but i do not know the size of an array... dynamically it may increase or decrease.... so how can i declare the arraylist size for getting dynamically..... plz help me

dynamic size

459 byte By misterraoa at 2007-10-2 7:24:11
hello here is my code ... db[] dbapp = new db[];compile:[javac] Compiling 12 source files to D:\PADMA\work\APPLIC~1\PRINTING\SOURCE~1\build[javac] D:\PADMA\work\APPLIC~1\PRINTING\SOURCE~1\Source\DbController.java:156: array dimension missing[javac] DbApplication[] dbapp = new DbApplication[]; ...