Java Reference
In-Depth Information
// Attach listener
splitPane.addPropertyChangeListener(propertyChangeListener);
frame.add(splitPane, BorderLayout.CENTER);
frame.setSize(300, 150);
frame.setVisible(true);
}
};
EventQueue.invokeLater(runner);
}
}
As the following sample output demonstrates, when you run the previous program, you'll
notice that the lastDividerLocation property changes to reflect the divider's being dragged.
When the user stops dragging the divider, the last setting is set to the prior setting for the
dividerLocation property, not to the initial last value (prior current value) when the drag started. As
the divider is being dragged, the current value travels first to the last value and then to the prior
last value. When the dragging stops, the final last setting (29 in this case) is set to the initial last
setting to reflect the current value when the dragging started. The last three sets of output reflect
the changes after pressing the one-touch expandable button.
Current: 11
Last: -1
Prior last: 0
Current: 12
Last: 11
Prior last: -1
Current: 12
Last: 12
Prior last: 11
Current: 12
Last: 11
Prior last: 12
Current: 15
Last: 12
Prior last: 11
Current: 15
Last: 15
Prior last: 12
Current: 15
Last: 12
Prior last: 15
Current: 112
Last: 15
Prior last: 12
Current: 112
Last: 112
Search WWH ::




Custom Search