Java – detect jsplitpane separation motion
•
Java
Is there any way to detect when to move the jsplitpane separator? Is there any way to add a divider motion listener?
JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,panel1,panel2); // What do I put here to be notified if the divider in sp is moved?
Solution
I think you are looking for addpropertychangelistener from the container Such a thing
sp.addPropertychangelistener(JSplitPane.DIVIDER_LOCATION_PROPERTY,new Propertychangelistener() { @Override public void propertyChange(PropertyChangeEvent pce) {} });
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码