| Method from javax.swing.plaf.basic.BasicTabbedPaneUI$Handler Detail: |
public void componentAdded(ContainerEvent e) {
JTabbedPane tp = (JTabbedPane)e.getContainer();
Component child = e.getChild();
if (child instanceof UIResource) {
return;
}
isRunsDirty = true;
updateHtmlViews(tp.indexOfComponent(child));
}
|
public void componentRemoved(ContainerEvent e) {
JTabbedPane tp = (JTabbedPane)e.getContainer();
Component child = e.getChild();
if (child instanceof UIResource) {
return;
}
// NOTE 4/15/2002 (joutwate):
// This fix is implemented using client properties since there is
// currently no IndexPropertyChangeEvent. Once
// IndexPropertyChangeEvents have been added this code should be
// modified to use it.
Integer indexObj =
(Integer)tp.getClientProperty("__index_to_remove__");
if (indexObj != null) {
int index = indexObj.intValue();
if (htmlViews != null && htmlViews.size() > index) {
htmlViews.removeElementAt(index);
}
tp.putClientProperty("__index_to_remove__", null);
}
isRunsDirty = true;
updateMnemonics();
validateFocusIndex();
}
|
public void focusGained(FocusEvent e) {
setFocusIndex(tabPane.getSelectedIndex(), true);
}
|
public void focusLost(FocusEvent e) {
repaintTab(focusIndex);
}
|
public void mouseClicked(MouseEvent e) {
}
|
public void mouseDragged(MouseEvent e) {
}
|
public void mouseEntered(MouseEvent e) {
setRolloverTab(e.getX(), e.getY());
}
|
public void mouseExited(MouseEvent e) {
setRolloverTab(-1);
}
|
public void mouseMoved(MouseEvent e) {
setRolloverTab(e.getX(), e.getY());
}
|
public void mousePressed(MouseEvent e) {
if (!tabPane.isEnabled()) {
return;
}
int tabIndex = tabForCoordinate(tabPane, e.getX(), e.getY());
if (tabIndex >= 0 && tabPane.isEnabledAt(tabIndex)) {
if (tabIndex != tabPane.getSelectedIndex()) {
// Clicking on unselected tab, change selection, do NOT
// request focus.
// This will trigger the focusIndex to change by way
// of stateChanged.
tabPane.setSelectedIndex(tabIndex);
}
else if (tabPane.isRequestFocusEnabled()) {
// Clicking on selected tab, try and give the tabbedpane
// focus. Repaint will occur in focusGained.
tabPane.requestFocus();
}
}
}
|
public void mouseReleased(MouseEvent e) {
}
|
public void propertyChange(PropertyChangeEvent e) {
JTabbedPane pane = (JTabbedPane)e.getSource();
String name = e.getPropertyName();
boolean isScrollLayout = scrollableTabLayoutEnabled();
if (name == "mnemonicAt") {
updateMnemonics();
pane.repaint();
}
else if (name == "displayedMnemonicIndexAt") {
pane.repaint();
}
else if (name =="indexForTitle") {
calculatedBaseline = false;
updateHtmlViews((Integer)e.getNewValue());
} else if (name == "tabLayoutPolicy") {
BasicTabbedPaneUI.this.uninstallUI(pane);
BasicTabbedPaneUI.this.installUI(pane);
calculatedBaseline = false;
} else if (name == "tabPlacement") {
if (scrollableTabLayoutEnabled()) {
tabScroller.createButtons();
}
calculatedBaseline = false;
} else if (name == "opaque" && isScrollLayout) {
boolean newVal = ((Boolean)e.getNewValue()).booleanValue();
tabScroller.tabPanel.setOpaque(newVal);
tabScroller.viewport.setOpaque(newVal);
} else if (name == "background" && isScrollLayout) {
Color newVal = (Color)e.getNewValue();
tabScroller.tabPanel.setBackground(newVal);
tabScroller.viewport.setBackground(newVal);
Color newColor = selectedColor == null ? newVal : selectedColor;
tabScroller.scrollForwardButton.setBackground(newColor);
tabScroller.scrollBackwardButton.setBackground(newColor);
} else if (name == "indexForTabComponent") {
if (tabContainer != null) {
tabContainer.removeUnusedTabComponents();
}
Component c = tabPane.getTabComponentAt(
(Integer)e.getNewValue());
if (c != null) {
if (tabContainer == null) {
installTabContainer();
} else {
tabContainer.add(c);
}
}
tabPane.revalidate();
tabPane.repaint();
calculatedBaseline = false;
} else if (name == "indexForNullComponent") {
isRunsDirty = true;
updateHtmlViews((Integer)e.getNewValue());
} else if (name == "font") {
calculatedBaseline = false;
}
}
|
public void stateChanged(ChangeEvent e) {
JTabbedPane tabPane = (JTabbedPane)e.getSource();
tabPane.revalidate();
tabPane.repaint();
setFocusIndex(tabPane.getSelectedIndex(), false);
if (scrollableTabLayoutEnabled()) {
int index = tabPane.getSelectedIndex();
if (index < rects.length && index != -1) {
tabScroller.tabPanel.scrollRectToVisible(
(Rectangle)rects[index].clone());
}
}
}
|