This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
 
 
subject: JComboBox
 
Similar Threads
How to connect multiple combo boxes?
Newbie: How to implement to tables with same structure
Combo boxes update
how to disable text area
How to iterate through an Array of objects and a file at the same time?