This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JSplitPane events  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JSplitPane events  " Watch "JSplitPane events  " New topic

JSplitPane events

seema prakash
Ranch Hand

Joined: Nov 17, 2004
Posts: 59
I'm using a JSplitPane component with two JPanels inside each side of the SplitPane.
I'm using OneTouchExpandable property of JSplitPane and setting it to true initially.
When the split pane is first shown, both the panels are visible.
Well, I want to add code when the divider is collapsed.
What is the action performed for this just like action performed for jbutton?
Please help.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
set your own UI, overriding the createRight/LeftOneTuchButtons to add an
actionListener to the button
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You can use a PropertyChangeListener and the DIVIDER_LOCATION_PROPERTY which you
can find listed in the Field Summary section of the JSplitPane api. For additional
information see Using PropertyChangeListener.

If you are not using oneTouchExpandable you would include the width of the minimumSize of
each component in the test to detect collapse.
seema prakash
Ranch Hand

Joined: Nov 17, 2004
Posts: 59
Thanks for the help. I'm posting a snippet of my code so that it may be useful for someone who might have the same problem. I added a componentListener. Here is the code:
subject: JSplitPane events
Similar Threads
Resizable border between text areas
Problem in JDialogBox
Resizing JPanel components
JSplitPane problem
dynamic JTable width (not column,table)