wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes assigning jcombobox items Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "assigning jcombobox items" Watch "assigning jcombobox items" New topic
Author

assigning jcombobox items

Wolfgang Rolf
Greenhorn

Joined: Aug 10, 2004
Posts: 2
hi,

i have a jcombobox with items ranging from 5 to -5. my idea is whenever a user selects an item, a point in the form of 'filloval' will be plotted in a rectangle on the jpanel. the problem right now is that when i select the 5 value from the material ratings combobox & press the plot button the 'filloval' isn't drawn at the correct place which is supposed to be at the top of the material ratings box.

my question is how can i assigned the values of the jcombobox let say 5 = 20. i tried using bigger numbers for the items but the results were the same.

probably my explaination isn't that clear. below is my code. please run it & you'll see the problem. if anyone out there has any idea of solving this problem please let me know. thanks in advance.


Sebastiaan Kortleven
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
You take the height of the rectangle, divide it by 10 (difference between MIN and MAX value) and you multiply the selection of the user by this nr.. that gives you a lineair connection between the combobox and the plotted point
Wolfgang Rolf
Greenhorn

Joined: Aug 10, 2004
Posts: 2
million thanks mate!

rolf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: assigning jcombobox items
 
Similar Threads
Multiple controls in a panel
What is wrong with my code?
refresh JPanel containing JTable
JFrame monitor of a calculation
I want help with display