my dog learned polymorphism
The moose likes Swing / AWT / SWT and the fly likes JComboBox - listeners Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JComboBox - listeners" Watch "JComboBox - listeners" New topic

JComboBox - listeners

Bruce Quesenberry

Joined: Apr 02, 2001
Posts: 7
I have JCombo component with a list of items. When I change to a different item, I want a JScrollPane [see scrollPane] to show the update with new text. This does happen, but only when you click inside the scrollPane. Is there a way to fire an action to cause this update. I would think the itemStateChanged method would take care of it. I can rely on users to think about clicking in the scrollPane to see the updated text.

scrollPane = alignmentText.GetTextAndScroll(alignmentBox.getSelectedIndex());


public void itemStateChanged(ItemEvent ie)
//dump the old scrollPane
//get new scrollPane showing text related to the new
//JCombo index
scrollPane = alignmentText.GetTextAndScrollalignmentBox.getSelectedIndex());
//add it

//repaint does not work
//there is a replaceText method - but this is too cumbersome for
//the amount of text involved and even then I bet it will have the same functionality
I agree. Here's the link:
subject: JComboBox - listeners
jQuery in Action, 3rd edition