Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

JSpltPane - detecting divider movement issued by the user?

Thread view: 
Andreas Thiele - 09 Mar 2006 08:34 GMT
I'd like to know if the divider line was moved by the user. Installing a
PropertyChangeListener on JSplitPane.DIVIDER_LOCATION_PROPERTY does not
solve the problem because this event is also fired when the user resizes the
container so that the divider would be outside the container. In this case
the divider is automatically moved to fullfil the minimum size and
"dividerLocation" PropertyChange event gets fired.

Is there any chance to catch something like a divider drag end event?

Andreas
Bart Cremers - 09 Mar 2006 09:32 GMT
If the used l&f uses a SplitPaneUI extending from BasicSplitPaneUI, you
could add a MouseMotionListener to the divider you can get from the
BasicSplitPaneUI:

       SplitPaneUI ui = split.getUI();
       if (ui instanceof BasicSplitPaneUI) {
           BasicSplitPaneUI basicUI = (BasicSplitPaneUI) ui;
           basicUI.getDivider().addMouseMotionListener(new
MouseMotionListener() {
               public void mouseDragged(MouseEvent e) {
                   System.out.println("DividerTest.mouseDragged");
               }

               public void mouseMoved(MouseEvent e) {
               }
           });
       }

You can work from there on.

If not, you'll have to check on working directly on that UI and else
you're out of luck

Regards,

Bart
Andreas Thiele - 09 Mar 2006 10:36 GMT
> If the used l&f uses a SplitPaneUI extending from BasicSplitPaneUI, you
> could add a MouseMotionListener to the divider you can get from the
> BasicSplitPaneUI:
> ...

Exactly what I need. I already was searching in this direction but didn't
notice basicUI.getDivider().

Thanks, a great help.

Andreas


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.