This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes swing components problem 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 » Swing / AWT / SWT
Bookmark "swing components problem" Watch "swing components problem" New topic

swing components problem

oghenekaro EFEKODO
Ranch Hand

Joined: Oct 10, 2005
Posts: 56
pls i need help:am try to develop an application that handle balanced diet using various food list and price list.want them to be in a table such that once a food option is selected it display the price and the application should ask for amount you want to spend before the food option comes up. pls,advice on how to using the swing components to achieve this andpls with a sample code to help.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
this might be one way

a class called FoodItem
this class contains the item description, price and food options
add these "FoodItems" to a JList (or a JTable), displaying just the description and price
when a foodItem is selected, show a modal dialog asking for amount to spend
show the options (based on selection and price) - perhaps in a set of JLabels?

might get a better example if you post a sample food item, with price and
options, then describe what happens with the options when e.g. $5.00 is
selected for amount to spend and how the options would differ if spending was $50.00
subject: swing components problem