Methods Summary |
---|
protected java.beans.PropertyChangeListener | createScrollBarSwapListener()
return new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (propertyName.equals("verticalScrollBar") ||
propertyName.equals("horizontalScrollBar")) {
JScrollBar oldSB = (JScrollBar)e.getOldValue();
if (oldSB != null) {
oldSB.putClientProperty(
MetalScrollBarUI.FREE_STANDING_PROP, null);
}
JScrollBar newSB = (JScrollBar)e.getNewValue();
if (newSB != null) {
newSB.putClientProperty(
MetalScrollBarUI.FREE_STANDING_PROP,
Boolean.FALSE);
}
}
else if ("border".equals(propertyName)) {
updateScrollbarsFreeStanding();
}
}};
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent x)
return new MetalScrollPaneUI();
|
public void | installListeners(javax.swing.JScrollPane scrollPane)
super.installListeners(scrollPane);
scrollBarSwapListener = createScrollBarSwapListener();
scrollPane.addPropertyChangeListener(scrollBarSwapListener);
|
public void | installUI(javax.swing.JComponent c)
super.installUI(c);
JScrollPane sp = (JScrollPane)c;
updateScrollbarsFreeStanding();
|
public void | uninstallListeners(javax.swing.JScrollPane scrollPane)
super.uninstallListeners(scrollPane);
scrollPane.removePropertyChangeListener(scrollBarSwapListener);
|
public void | uninstallUI(javax.swing.JComponent c)
super.uninstallUI(c);
JScrollPane sp = (JScrollPane)c;
JScrollBar hsb = sp.getHorizontalScrollBar();
JScrollBar vsb = sp.getVerticalScrollBar();
if (hsb != null) {
hsb.putClientProperty( MetalScrollBarUI.FREE_STANDING_PROP, null);
}
if (vsb != null) {
vsb.putClientProperty( MetalScrollBarUI.FREE_STANDING_PROP, null);
}
|
private void | updateScrollbarsFreeStanding()If the border of the scrollpane is an instance of
MetalBorders.ScrollPaneBorder , the client property
FREE_STANDING_PROP of the scrollbars
is set to false, otherwise it is set to true.
if (scrollpane == null) {
return;
}
Border border = scrollpane.getBorder();
Object value;
if (border instanceof MetalBorders.ScrollPaneBorder) {
value = Boolean.FALSE;
}
else {
value = Boolean.TRUE;
}
JScrollBar sb = scrollpane.getHorizontalScrollBar();
if (sb != null) {
sb.putClientProperty
(MetalScrollBarUI.FREE_STANDING_PROP, value);
}
sb = scrollpane.getVerticalScrollBar();
if (sb != null) {
sb.putClientProperty
(MetalScrollBarUI.FREE_STANDING_PROP, value);
}
|