File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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: 2451
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: 3131


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: 20273

Swing is a proper noun

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Help required on Swings
It's not a secret anymore!