aspose file tools*
The moose likes Beginning Java and the fly likes JComboBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JComboBox" Watch "JComboBox" New topic
Author

JComboBox

Lydia Su
Greenhorn

Joined: Apr 27, 2001
Posts: 13
how do i use two combo boxes together? i want to draw either a line, rectangle or circle in either magenta, cyan, red, blue or green. i need to link these two up together, how can i do it using the combo box?
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Well, you could have 2 combo boxes and a "submit" button. When the user clicks the submit button you check the selected options on the combo boxes.
Is that even CLOSE to what you are asking?


"JavaRanch, where the deer and the Certified play" - David O'Meara
Lydia Su
Greenhorn

Joined: Apr 27, 2001
Posts: 13
well i don't mind the button but i have no idea on how to make the combo box draw the shapes...i've tried several ways with lots of errors,...anyone have any ideas?
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You would need to put an ActionListener on the Button, and then in the actionPerformed(ActionEvent e) method of the Listener you put in the code to call repaint() to refresh the screen. Then in the paint() method (that repaint will call for you) you put the actual code to do the drawing.
The stuff that you are talking about are methods in the Graphics class. There is a drawLine() method, and a drawRect() method etc. You can also set the color by using the setForeground(Color c) method of Component.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JComboBox