This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Help required on Swings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help required on Swings " Watch "Help required on Swings " New topic

Help required on Swings

Viswanath Thulluru

Joined: Mar 17, 2014
Posts: 9

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

Joined: Jun 13, 2009
Posts: 2372
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

Joined: Sep 13, 2007
Posts: 2985


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.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
Rob Spoor

Joined: Oct 27, 2005
Posts: 20077

Swing is a proper noun

How To Ask Questions How To Answer Questions
Have you checked out Aspose?
subject: Help required on Swings
jQuery in Action, 3rd edition