Click to See Complete Forum and Search --> : Java combo box and ItemEvent question
JoeyJoeJo
02-23-2005, 04:10 AM
I have a combo box and an ItemEvent method. I need to make the options in the combo box execute code when they are selected. can someone give me a rough outline of how to do it? I'm familiar with actionevent, but I just can't get item event to work.
JoeyJoeJo
02-23-2005, 02:14 PM
I just got it. It was actually a problem with how my text box was defined. When I tried to get the data from the text box, it crashed because it couldn't find the text box. That made me think it was an itemevent problem. However, I do have one more question. How do you make scrollbars scroll? I have the scrollbars on the screen, but they don't scroll.
bwkaz
02-23-2005, 08:05 PM
What do you mean by scroll? Is the problem that the user can't scroll them, or is the problem that you don't know how to do it from code?
If the user can't use the scrollbar, then the problem is likely that you don't have enough text in the textbox to overflow its current size. Just put more text in there, and the scrollbar usually enables itself. You might need a <scrollbar>.setEnabled(true); call, but I doubt it.
If you don't know how to use the scrollbar, then may I suggest the java.sun.com documentation? ;)
If you're using AWT, then see this page:
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Scrollbar.html#setValue(int)
If you're using Swing, then see this page:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JScrollBar.html#setValue(int)