| Method from javax.swing.plaf.basic.BasicToolBarUI$Handler Detail: |
public void componentAdded(ContainerEvent evt) {
Component c = evt.getChild();
if (toolBarFocusListener != null) {
c.addFocusListener(toolBarFocusListener);
}
if (isRolloverBorders()) {
setBorderToRollover(c);
} else {
setBorderToNonRollover(c);
}
}
|
public void componentRemoved(ContainerEvent evt) {
Component c = evt.getChild();
if (toolBarFocusListener != null) {
c.removeFocusListener(toolBarFocusListener);
}
// Revert the button border
setBorderToNormal(c);
}
|
public void focusGained(FocusEvent evt) {
Component c = evt.getComponent();
focusedCompIndex = toolBar.getComponentIndex(c);
}
|
public void focusLost(FocusEvent evt) {
}
|
public void mouseClicked(MouseEvent evt) {
}
|
public void mouseDragged(MouseEvent evt) {
if (!tb.isEnabled()) {
return;
}
isDragging = true;
Point position = evt.getPoint();
if (origin == null) {
origin = evt.getComponent().getLocationOnScreen();
}
dragTo(position, origin);
}
|
public void mouseEntered(MouseEvent evt) {
}
|
public void mouseExited(MouseEvent evt) {
}
|
public void mouseMoved(MouseEvent evt) {
}
|
public void mousePressed(MouseEvent evt) {
if (!tb.isEnabled()) {
return;
}
isDragging = false;
}
|
public void mouseReleased(MouseEvent evt) {
if (!tb.isEnabled()) {
return;
}
if (isDragging == true) {
Point position = evt.getPoint();
if (origin == null)
origin = evt.getComponent().getLocationOnScreen();
floatAt(position, origin);
}
origin = null;
isDragging = false;
}
|
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if (propertyName == "lookAndFeel") {
toolBar.updateUI();
} else if (propertyName == "orientation") {
// Search for JSeparator components and change it's orientation
// to match the toolbar and flip it's orientation.
Component[] components = toolBar.getComponents();
int orientation = ((Integer)evt.getNewValue()).intValue();
JToolBar.Separator separator;
for (int i = 0; i < components.length; ++i) {
if (components[i] instanceof JToolBar.Separator) {
separator = (JToolBar.Separator)components[i];
if ((orientation == JToolBar.HORIZONTAL)) {
separator.setOrientation(JSeparator.VERTICAL);
} else {
separator.setOrientation(JSeparator.HORIZONTAL);
}
Dimension size = separator.getSeparatorSize();
if (size != null && size.width != size.height) {
// Flip the orientation.
Dimension newSize =
new Dimension(size.height, size.width);
separator.setSeparatorSize(newSize);
}
}
}
} else if (propertyName == IS_ROLLOVER) {
installNormalBorders(toolBar);
setRolloverBorders(((Boolean)evt.getNewValue()).booleanValue());
}
}
|