Problems_using_JSplitPane

using JSplitPane, how can I do to avoid that one of the two panel covers the other panel totally? For example, considering the example SplitPaneDemo in the JavaTutorial, how can I do to avoid that the list of files .gif covers totally the panel that shows photos when I expand it?
if the problem isn't clear, please tell me!
thanks in advance!!!!!
lucignolo
Message was edited by:
lucignolo

In the future, Swing related questions should be posted in the Swing forum.
The following code is from the demo program:
        splitPane.setOneTouchExpandable(true);
        splitPane.setDividerLocation(150);
        //Provide minimum sizes for the two components in the split pane.
        Dimension minimumSize = new Dimension(100, 50);
        listScrollPane.setMinimumSize(minimumSize);
        pictureScrollPane.setMinimumSize(minimumSize);When you drag the divider with the mouse, the minimum size is respected. So you could turn the one touch expandable off.
If you feel you need one touch expandable then you could add a PropertyChangeListener to check for a change in divider location. When the location is below or above a certain value, you reset it to your minimum value.
public void propertyChange(PropertyChangeEvent e)
     if ("dividerLocation".equals(e.getPropertyName()))
          JSplitPane source = (JSplitPane)e.getSource();
          int location = ((Integer)e.getNewValue()).intValue();
          if (location < someValue)
               source.setDividerLocation( someValue );
}

Similar Messages

Maybe you are looking for

  • Mounting external HD with Mac OS extended jornaled

    I bought and installed a new HD on my macbook pro running Mountain Lion OS. Now I'm trying to copy the data from my old HD wich also have Mountain Lion installed but I can't mount my old HD throught USB as an external HD. The format is not been recog

  • "is in use and could not be ejected"

    I want to eject an external hard drive (actually my time machine hard drive). Time Machine is finished but the drive activity has not and is sucking the speed out of my computer (as it always does when Time Machine is active). When I try to eject the

  • Recordsets per message - only works with RECORDSET

    I have previously got recordsets per message working when I use RECORDSET.  I now have a scenario that uses "row" instead of "RECORDSET". This is working for RECORDSET - it splits into a new message every 100 records........ Recordset Name   RECORDSE

  • Intermittent problem saving a pdf form

    I have created a 17 page PDF form in LiveCycle Es with many dynamic features, such as adding or subtracting more lines to a table.  The whole document is about 700KB ( 800 after being partially filled in) in size.  I put fillable password protection

  • Time Zone issue

    I'm a new BB owner in Seattle and just returned from a Denver conference. Before leaving, I'd entered dozens of meetings/receptions/etc. that were synched via my Outlook calendar. When I got to Denver and figured out that I had to manually change tim