This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help required on Swings  RSS feed

 
Viswanath Thulluru
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need your help in implementing a swings application. I have a JFrame containing 2 JPanels : Top & Bottom panel. Top panel has a Jcombobox, Botton panel contain a Graph plot. On changing value in combo box, graph plot should get updated.
I am new to Swings, can you please guide me how I can achieve this?.

I thought of adding actionlistener to Jcombobox. Not sure what to implement in its actionPerformed()

Thanks, Viswanath
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what to implement in its actionPerformed()


The code to update your Graph plot.

We know nothing about how your Graph works or how the combo box will affect the Graph, so only you can answer that question on how the Graph should be updated.
 
K. Tsang
Bartender
Posts: 3620
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy

The key to these kind of interaction is to make sure that the combo box and graph plot are in the same class or have some way to access one from the other.

Deciding where to put your components is a design issue somewhat. You don't want to be too cohesive or tightly coupled, yet just enough to function properly.

 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swing is a proper noun
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!