| Methods from java.awt.Component: |
|---|
|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventTypeEnabled, findNextFocusComponent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, generateName, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getGraphicsConfigurationImpl, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setPeer, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, translateEvent, update, validate |
| Method from javax.swing.plaf.basic.BasicInternalFrameTitlePane Detail: |
protected void addSubComponents() {
add(menuBar);
add(iconButton);
add(maxButton);
add(closeButton);
}
|
protected void addSystemMenuItems(JMenu systemMenu) {
JMenuItem mi = (JMenuItem)systemMenu.add(restoreAction);
mi.setMnemonic('R");
mi = (JMenuItem)systemMenu.add(moveAction);
mi.setMnemonic('M");
mi = (JMenuItem)systemMenu.add(sizeAction);
mi.setMnemonic('S");
mi = (JMenuItem)systemMenu.add(iconifyAction);
mi.setMnemonic('n");
mi = (JMenuItem)systemMenu.add(maximizeAction);
mi.setMnemonic('x");
systemMenu.add(new JSeparator());
mi = (JMenuItem)systemMenu.add(closeAction);
mi.setMnemonic('C");
}
|
protected void assembleSystemMenu() {
menuBar = createSystemMenuBar();
windowMenu = createSystemMenu();
menuBar.add(windowMenu);
addSystemMenuItems(windowMenu);
enableActions();
}
|
ActionMap createActionMap() {
ActionMap map = new ActionMapUIResource();
map.put("showSystemMenu", new ShowSystemMenuAction(true));
map.put("hideSystemMenu", new ShowSystemMenuAction(false));
return map;
}
|
protected void createActions() {
maximizeAction = new MaximizeAction();
iconifyAction = new IconifyAction();
closeAction = new CloseAction();
restoreAction = new RestoreAction();
moveAction = new MoveAction();
sizeAction = new SizeAction();
}
|
protected void createButtons() {
iconButton = new NoFocusButton(
"InternalFrameTitlePane.iconifyButtonAccessibleName",
"InternalFrameTitlePane.iconifyButtonOpacity");
iconButton.addActionListener(iconifyAction);
if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) {
iconButton.setToolTipText(iconButtonToolTip);
}
maxButton = new NoFocusButton(
"InternalFrameTitlePane.maximizeButtonAccessibleName",
"InternalFrameTitlePane.maximizeButtonOpacity");
maxButton.addActionListener(maximizeAction);
closeButton = new NoFocusButton(
"InternalFrameTitlePane.closeButtonAccessibleName",
"InternalFrameTitlePane.closeButtonOpacity");
closeButton.addActionListener(closeAction);
if (closeButtonToolTip != null && closeButtonToolTip.length() != 0) {
closeButton.setToolTipText(closeButtonToolTip);
}
setButtonIcons();
}
|
protected LayoutManager createLayout() {
return getHandler();
}
|
protected PropertyChangeListener createPropertyChangeListener() {
return getHandler();
}
|
protected JMenu createSystemMenu() {
return new JMenu(" ");
}
|
protected JMenuBar createSystemMenuBar() {
menuBar = new SystemMenuBar();
menuBar.setBorderPainted(false);
return menuBar;
}
|
protected void enableActions() {
restoreAction.setEnabled(frame.isMaximum() || frame.isIcon());
maximizeAction.setEnabled(
(frame.isMaximizable() && !frame.isMaximum() && !frame.isIcon()) ||
(frame.isMaximizable() && frame.isIcon()));
iconifyAction.setEnabled(frame.isIconifiable() && !frame.isIcon());
closeAction.setEnabled(frame.isClosable());
sizeAction.setEnabled(false);
moveAction.setEnabled(false);
}
|
protected String getTitle(String text,
FontMetrics fm,
int availTextWidth) {
return SwingUtilities2.clipStringIfNecessary(
frame, fm, text, availTextWidth);
}
|
protected void installDefaults() {
maxIcon = UIManager.getIcon("InternalFrame.maximizeIcon");
minIcon = UIManager.getIcon("InternalFrame.minimizeIcon");
iconIcon = UIManager.getIcon("InternalFrame.iconifyIcon");
closeIcon = UIManager.getIcon("InternalFrame.closeIcon");
selectedTitleColor = UIManager.getColor("InternalFrame.activeTitleBackground");
selectedTextColor = UIManager.getColor("InternalFrame.activeTitleForeground");
notSelectedTitleColor = UIManager.getColor("InternalFrame.inactiveTitleBackground");
notSelectedTextColor = UIManager.getColor("InternalFrame.inactiveTitleForeground");
setFont(UIManager.getFont("InternalFrame.titleFont"));
closeButtonToolTip =
UIManager.getString("InternalFrame.closeButtonToolTip");
iconButtonToolTip =
UIManager.getString("InternalFrame.iconButtonToolTip");
restoreButtonToolTip =
UIManager.getString("InternalFrame.restoreButtonToolTip");
maxButtonToolTip =
UIManager.getString("InternalFrame.maxButtonToolTip");
}
|
protected void installListeners() {
if( propertyChangeListener == null ) {
propertyChangeListener = createPropertyChangeListener();
}
frame.addPropertyChangeListener(propertyChangeListener);
}
|
protected void installTitlePane() {
installDefaults();
installListeners();
createActions();
enableActions();
createActionMap();
setLayout(createLayout());
assembleSystemMenu();
createButtons();
addSubComponents();
}
|
public void paintComponent(Graphics g) {
paintTitleBackground(g);
if(frame.getTitle() != null) {
boolean isSelected = frame.isSelected();
Font f = g.getFont();
g.setFont(getFont());
if(isSelected)
g.setColor(selectedTextColor);
else
g.setColor(notSelectedTextColor);
// Center text vertically.
FontMetrics fm = SwingUtilities2.getFontMetrics(frame, g);
int baseline = (getHeight() + fm.getAscent() - fm.getLeading() -
fm.getDescent()) / 2;
int titleX;
Rectangle r = new Rectangle(0, 0, 0, 0);
if (frame.isIconifiable()) r = iconButton.getBounds();
else if (frame.isMaximizable()) r = maxButton.getBounds();
else if (frame.isClosable()) r = closeButton.getBounds();
int titleW;
String title = frame.getTitle();
if( BasicGraphicsUtils.isLeftToRight(frame) ) {
if (r.x == 0) r.x = frame.getWidth()-frame.getInsets().right;
titleX = menuBar.getX() + menuBar.getWidth() + 2;
titleW = r.x - titleX - 3;
title = getTitle(frame.getTitle(), fm, titleW);
} else {
titleX = menuBar.getX() - 2
- SwingUtilities2.stringWidth(frame,fm,title);
}
SwingUtilities2.drawString(frame, g, title, titleX, baseline);
g.setFont(f);
}
}
|
protected void paintTitleBackground(Graphics g) {
boolean isSelected = frame.isSelected();
if(isSelected)
g.setColor(selectedTitleColor);
else
g.setColor(notSelectedTitleColor);
g.fillRect(0, 0, getWidth(), getHeight());
}
Invoked from paintComponent.
Paints the background of the titlepane. All text and icons will
then be rendered on top of this background. |
protected void postClosingEvent(JInternalFrame frame) {
InternalFrameEvent e = new InternalFrameEvent(
frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
// Try posting event, unless there's a SecurityManager.
if (JInternalFrame.class.getClassLoader() == null) {
try {
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
return;
} catch (SecurityException se) {
// Use dispatchEvent instead.
}
}
frame.dispatchEvent(e);
}
Post a WINDOW_CLOSING-like event to the frame, so that it can
be treated like a regular Frame. |
protected void setButtonIcons() {
if(frame.isIcon()) {
if (minIcon != null) {
iconButton.setIcon(minIcon);
}
if (restoreButtonToolTip != null &&
restoreButtonToolTip.length() != 0) {
iconButton.setToolTipText(restoreButtonToolTip);
}
if (maxIcon != null) {
maxButton.setIcon(maxIcon);
}
if (maxButtonToolTip != null && maxButtonToolTip.length() != 0) {
maxButton.setToolTipText(maxButtonToolTip);
}
} else if (frame.isMaximum()) {
if (iconIcon != null) {
iconButton.setIcon(iconIcon);
}
if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) {
iconButton.setToolTipText(iconButtonToolTip);
}
if (minIcon != null) {
maxButton.setIcon(minIcon);
}
if (restoreButtonToolTip != null &&
restoreButtonToolTip.length() != 0) {
maxButton.setToolTipText(restoreButtonToolTip);
}
} else {
if (iconIcon != null) {
iconButton.setIcon(iconIcon);
}
if (iconButtonToolTip != null && iconButtonToolTip.length() != 0) {
iconButton.setToolTipText(iconButtonToolTip);
}
if (maxIcon != null) {
maxButton.setIcon(maxIcon);
}
if (maxButtonToolTip != null && maxButtonToolTip.length() != 0) {
maxButton.setToolTipText(maxButtonToolTip);
}
}
if (closeIcon != null) {
closeButton.setIcon(closeIcon);
}
}
|
protected void showSystemMenu() {
// windowMenu.setPopupMenuVisible(true);
// windowMenu.setVisible(true);
windowMenu.doClick();
}
|
protected void uninstallDefaults() {
}
|
protected void uninstallListeners() {
frame.removePropertyChangeListener(propertyChangeListener);
handler = null;
}
|