The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Swing pane to pane interaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Swing pane to pane interaction" Watch "Swing pane to pane interaction" New topic

Swing pane to pane interaction

K. Tsang

Joined: Sep 13, 2007
Posts: 3134

Hello all, I have a questions about given I have 2 panes (left-right), when I click some action on the left pane I want the right pane to change accordingly. How do I do that?

I have a JPanel on the left and a JScrollPane/JTable on the right. The JTable has different table models for different data. Currently the event I trigger on the left works if I output to command prompt or if I open another JFrame. I want to achieve when left pane event triggers the right pane change accordingly whether its JScrollPane/JTable or JPanel. My main client class extends JFrame.

Also would it be easier if I used JSplitPane? If I use JSplitPane, is there a method to disable the movement of the location bar?


K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
You probably forgot to call a fire...Changed() when changing the table model of the presented table. Probably fireTableChanged() or fireTableDataChanged() should be called.

SCJP 1.4 100%
SCJD 99.5%
I agree. Here's the link:
subject: Swing pane to pane interaction
It's not a secret anymore!