SplitPane size

Dear all,

I have an application with horizontal JSplitpane.Indeed users are able to move this horizontal divider everywhere they want.

My needs are when users resize my frame application it shall be able to preserve horizontal proportion between top/bottom components.

How to move the divider location in order to maintain the good proportion?

I have tried to do :

splitPane =new JSplitPane(JSplitPane.VERTICAL_SPLIT);

splitPane.setBorder(BorderFactory.createCompoundBorder());

splitPane.setTopComponent(top);

splitPane.setBottomComponent(bottom);

splitPane.setContinuousLayout(true);

splitPane.setDividerLocation(0.65);

splitPane.setDividerSize(5);

splitPane.addComponentListener(new ComponentAdapter(){

publicvoid componentResized(ComponentEvent e){

if(bottom.isVisible()){

//HERE I NEED TO COMPARE SPLIT HEIGHT SIZE

//AND BOTTOM HEIGHT SIZE

//HOW TO DO

splitPane.setDividerLocation(0.65);

}

}

});

Another problem is when i maximize the frame the splitpane cursor is away

and i can't move the divider WHY?

How to do?

Thanks in advance..

[1651 byte] By [superman@a] at [2007-10-2 23:33:58]
# 1
setResizeWeight(0.65)And lose the ComponentListener.
itchyscratchya at 2007-7-14 16:15:44 > top of Java-index,Desktop,Core GUI APIs...
# 2
Dear all,Thanks you for your information, but for the bug, have you got an idea...Split cursor disappears when maximize JFrame?Thanks in advance .
superman@a at 2007-7-14 16:15:44 > top of Java-index,Desktop,Core GUI APIs...
# 3
There's a fair chance it's related to this, http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4861969
itchyscratchya at 2007-7-14 16:15:44 > top of Java-index,Desktop,Core GUI APIs...
# 4

The bug is in progress since 2004 HOOO!!!!

Is There another way to block cursor on split pane object..

I have tried with

public class SplitPane extends JSplitPane implements MouseInputListener{

private BasicSplitPaneDivider basicSplitPaneDivider;

//private final MetalSplitPaneUI ui;

/**

* @param horizontal_split

*/

public SplitPane(int orientation) {

super(orientation);

final MetalSplitPaneUI ui = (MetalSplitPaneUI)this.getUI();

basicSplitPaneDivider = ui.getDivider();

basicSplitPaneDivider.setBorder(BorderFactory.createLineBorder(Color.RED));

MouseListener[] mouseListeners = basicSplitPaneDivider.getMouseListeners();

for (int i = 0; i < mouseListeners.length; i++) {

basicSplitPaneDivider.removeMouseListener(mouseListeners[i]);

}

//MouseMotionListener[] mouseMotionListeners = basicSplitPaneDivider.getMouseMotionListeners();

//for (int i = 0; i < mouseMotionListeners.length; i++) {

//basicSplitPaneDivider.removeMouseMotionListener(mouseMotionListeners[i]);

//}

//basicSplitPaneDivider.addMouseListener(this);

//basicSplitPaneDivider.addMouseMotionListener(this);

}

public void mouseEntered(MouseEvent e) {

System.out.println("mouseEntered");

super.setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));

}

public void mouseExited(MouseEvent e) {

System.out.println("mouseExited");

super.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

}

public void mouseDragged(MouseEvent e) {

//System.out.println("mouseDragged");

//super.processMouseEvent(e);

//super.processMouseMotionEvent(e);

}

public void mouseClicked(MouseEvent e) {}

public void mousePressed(MouseEvent e) {}

public void mouseReleased(MouseEvent e) {}

public void mouseMoved(MouseEvent e) {}

}

No changement !!!

Thanks in advance..

superman@a at 2007-7-14 16:15:44 > top of Java-index,Desktop,Core GUI APIs...