Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with the JTable

2 views
Skip to first unread message

Dirk Wenke

unread,
Apr 28, 2000, 3:00:00 AM4/28/00
to
Hi there,

I have a problem with the JTable.
I have a JTable with many columns.
For some columns I defined a JComboBox and set it as CellEditor.

My problem is the following.
Sometimes the items of the JComboBox depend on entries in the table.
So I'd like to define the items of the JComboBox, just before it pops
up.
For doing that, I defined a FocusListener to redefine my JComboBox.
So far this seems to be no problem.
But when I execute my program and select this cell with the JComboBox, I
get the following error :

Exception occurred during event dispatching:
java.awt.IllegalComponentStateException: component must be showing on
the screen to determine its location
at java.awt.Component.getLocationOnScreen(Component.java:1202)
at javax.swing.JPopupMenu.show(JPopupMenu.java:690)
at
javax.swing.plaf.basic.BasicComboPopup.show(BasicComboPopup.java:127)
at
javax.swing.plaf.basic.BasicComboPopup.togglePopup(BasicComboPopup.java:809)

at
javax.swing.plaf.basic.BasicComboPopup$InvocationMouseHandler.mousePressed(BasicComboPopup.java:446)

at java.awt.Component.processMouseEvent(Component.java:3609)
at java.awt.Component.processEvent(Component.java:3441)
at java.awt.Container.processEvent(Container.java:1253)
at java.awt.Component.dispatchEventImpl(Component.java:2529)
at java.awt.Container.dispatchEventImpl(Container.java:1302)
at java.awt.Component.dispatchEvent(Component.java:2443)
at
javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.repostEvent(BasicTableUI.java:430)

at
javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mousePressed(BasicTableUI.java:458)

at
java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:224)
at java.awt.Component.processMouseEvent(Component.java:3609)
at java.awt.Component.processEvent(Component.java:3441)
at java.awt.Container.processEvent(Container.java:1253)
at java.awt.Component.dispatchEventImpl(Component.java:2529)
at java.awt.Container.dispatchEventImpl(Container.java:1302)
at java.awt.Component.dispatchEvent(Component.java:2443)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2504)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:2282)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2191)
at java.awt.Container.dispatchEventImpl(Container.java:1289)
at java.awt.Window.dispatchEventImpl(Window.java:854)
at java.awt.Component.dispatchEvent(Component.java:2443)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:302)
at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:95)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:86)

I don't know why this error occurs.
Or is there another possibility of changing the items of this JComboBox,
just before it pops up??

It would be great, if someone could help me out.

greetings

Dirk
--
Dirk Wenke
Email : Dirk....@stud.uni-karlsruhe.de

lacou

unread,
Apr 29, 2000, 3:00:00 AM4/29/00
to
You can add all your elements in your DefaultComboBoxModel before
showing your ComboBox. Just use the ComboBox.setModel or create your
combo box with the constructor that uses ComboBoxModel with the model
you just populated.


In article <3909EEF7...@rz.uni-karlsruhe.de>,


Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages