wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes urgent:Problem with action event of JButton Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "urgent:Problem with action event of JButton" Watch "urgent:Problem with action event of JButton" New topic
Author

urgent:Problem with action event of JButton

Richa Goyal
Greenhorn

Joined: Aug 26, 2001
Posts: 18
hi freids,
i designing a chat server. When i click on send button to send the message to other users via chatserver i m getting lots of exceptions like-

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:912)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
etc.
what should i do for it.
its urgent. Please reply soon.
Richa.
Jes Sie
Ranch Hand

Joined: Jul 24, 2001
Posts: 188
Maybe you could elaborate on what are the classes involved or a bit more details of things. It's quite hard to find out your problem.
Perhaps, maybe you are mixing lightweight & heavy weight components in your chat server?

------------------
Thank you.
- Simon See
simon-ivy@usa.net
-after office hours-
necro-mani-cide


Thank you.<br /> <br />- Jess Sie<br /> <a href="mailto:jess@see-consulting.com" rel="nofollow">jess@see-consulting.com</a>
Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
Could you post the complete list of exceptions? It looks like the primary exception is missing.
Originally posted by Richa Goyal:
hi freids,
i designing a chat server. When i click on send button to send the message to other users via chatserver i m getting lots of exceptions like-

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:912)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
etc.
what should i do for it.
its urgent. Please reply soon.
Richa.


There's nothing more dangerous than a resourceful idiot. ---Dilbert
Richa Goyal
Greenhorn

Joined: Aug 26, 2001
Posts: 18
Originally posted by Simon See:
Maybe you could elaborate on what are the classes involved or a bit more details of things. It's quite hard to find out your problem.
Perhaps, maybe you are mixing lightweight & heavy weight components in your chat server?
I agree with you. Does mixing of lightweight & heavy weight components create some problem? what can be done for it?
I m using swing components and awt events in it.
The rest of errors are:
ERROR: java.lang.NullPointerException
java.lang.NullPointerException
at CRoom$1.actionPerformed(CRoom.java:58)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:14
50)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
ctButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250
)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3717)
at java.awt.Component.processEvent(Component.java:3546)
at java.awt.Container.proce
.java:378)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250
)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3717)
at java.awt.Component.processEvent(Component.java:3546)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451
)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:912)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:10
3)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)

Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Richa,
There is only one error happening. The rest of the lines are showing you a trace dump so you can see the current stack.
Usually a NullPointerException happens when you try and call a method of a null object. Inside your listener method make sure that all objects you are trying to use are non-null. For example:
if( ob != null )
{
// use it here because it is not null
ob.method();
}
Regards,
Manfred.
 
 
subject: urgent:Problem with action event of JButton