Methods Summary |
---|
protected void | addImpl(java.awt.Component comp, java.lang.Object constraints, int index)Adds the specified child Component .
This method is overridden to conditionally forward calls to the
contentPane .
By default, children are added to the contentPane instead
of the frame, refer to {@link javax.swing.RootPaneContainer} for
details.
if(isRootPaneCheckingEnabled()) {
getContentPane().add(comp, constraints, index);
}
else {
super.addImpl(comp, constraints, index);
}
|
public void | addInternalFrameListener(javax.swing.event.InternalFrameListener l)Adds the specified listener to receive internal
frame events from this internal frame. // remind: sync ??
listenerList.add(InternalFrameListener.class, l);
// remind: needed?
enableEvents(0); // turn on the newEventsOnly flag in Component.
|
private static void | addPropertyChangeListenerIfNecessary()
if (AppContext.getAppContext().get(PROPERTY_CHANGE_LISTENER_KEY) ==
null) {
PropertyChangeListener focusListener =
new FocusPropertyChangeListener();
AppContext.getAppContext().put(PROPERTY_CHANGE_LISTENER_KEY,
focusListener);
KeyboardFocusManager.getCurrentKeyboardFocusManager().
addPropertyChangeListener(focusListener);
}
|
void | compWriteObjectNotify()
// need to disable rootpane checking for InternalFrame: 4172083
boolean old = isRootPaneCheckingEnabled();
try {
setRootPaneCheckingEnabled(false);
super.compWriteObjectNotify();
}
finally {
setRootPaneCheckingEnabled(old);
}
|
protected javax.swing.JRootPane | createRootPane()Called by the constructor to set up the JRootPane .
return new JRootPane();
|
public void | dispose()Makes this internal frame
invisible, unselected, and closed.
If the frame is not already closed,
this method fires an
INTERNAL_FRAME_CLOSED event.
The results of invoking this method are similar to
setClosed(true) ,
but dispose always succeeds in closing
the internal frame and does not fire
an INTERNAL_FRAME_CLOSING event.
if (isVisible()) {
setVisible(false);
}
if (isSelected()) {
try {
setSelected(false);
} catch (PropertyVetoException pve) {}
}
if (!isClosed) {
firePropertyChange(IS_CLOSED_PROPERTY, Boolean.FALSE, Boolean.TRUE);
isClosed = true;
}
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED);
|
public void | doDefaultCloseAction()Fires an
INTERNAL_FRAME_CLOSING event
and then performs the action specified by
the internal frame's default close operation.
This method is typically invoked by the
look-and-feel-implemented action handler
for the internal frame's close button.
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSING);
switch(defaultCloseOperation) {
case DO_NOTHING_ON_CLOSE:
break;
case HIDE_ON_CLOSE:
setVisible(false);
if (isSelected())
try {
setSelected(false);
} catch (PropertyVetoException pve) {}
/* should this activate the next frame? that's really
desktopmanager's policy... */
break;
case DISPOSE_ON_CLOSE:
try {
fireVetoableChange(IS_CLOSED_PROPERTY, Boolean.FALSE,
Boolean.TRUE);
isClosed = true;
setVisible(false);
firePropertyChange(IS_CLOSED_PROPERTY, Boolean.FALSE,
Boolean.TRUE);
dispose();
} catch (PropertyVetoException pve) {}
break;
default:
break;
}
|
protected void | fireInternalFrameEvent(int id)Fires an internal frame event.
Object[] listeners = listenerList.getListenerList();
InternalFrameEvent e = null;
for (int i = listeners.length -2; i >=0; i -= 2){
if (listeners[i] == InternalFrameListener.class){
if (e == null){
e = new InternalFrameEvent(this, id);
// System.out.println("InternalFrameEvent: " + e.paramString());
}
switch(e.getID()) {
case InternalFrameEvent.INTERNAL_FRAME_OPENED:
((InternalFrameListener)listeners[i+1]).internalFrameOpened(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
((InternalFrameListener)listeners[i+1]).internalFrameClosing(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSED:
((InternalFrameListener)listeners[i+1]).internalFrameClosed(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
((InternalFrameListener)listeners[i+1]).internalFrameIconified(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
((InternalFrameListener)listeners[i+1]).internalFrameDeiconified(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_ACTIVATED:
((InternalFrameListener)listeners[i+1]).internalFrameActivated(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED:
((InternalFrameListener)listeners[i+1]).internalFrameDeactivated(e);
break;
default:
break;
}
}
}
/* we could do it off the event, but at the moment, that's not how
I'm implementing it */
// if (id == InternalFrameEvent.INTERNAL_FRAME_CLOSING) {
// doDefaultCloseAction();
// }
|
public javax.accessibility.AccessibleContext | getAccessibleContext()Gets the AccessibleContext associated with this
JInternalFrame .
For internal frames, the AccessibleContext
takes the form of an
AccessibleJInternalFrame object.
A new AccessibleJInternalFrame instance is created if necessary.
if (accessibleContext == null) {
accessibleContext = new AccessibleJInternalFrame();
}
return accessibleContext;
|
public java.awt.Container | getContentPane()Returns the content pane for this internal frame.
return getRootPane().getContentPane();
|
public int | getDefaultCloseOperation()Returns the default operation that occurs when the user
initiates a "close" on this internal frame.
return defaultCloseOperation;
|
public javax.swing.JInternalFrame$JDesktopIcon | getDesktopIcon()Returns the JDesktopIcon used when this
JInternalFrame is iconified.
return desktopIcon;
|
public javax.swing.JDesktopPane | getDesktopPane()Convenience method that searches the ancestor hierarchy for a
JDesktop instance. If JInternalFrame
finds none, the desktopIcon tree is searched.
Container p;
// Search upward for desktop
p = getParent();
while(p != null && !(p instanceof JDesktopPane))
p = p.getParent();
if(p == null) {
// search its icon parent for desktop
p = getDesktopIcon().getParent();
while(p != null && !(p instanceof JDesktopPane))
p = p.getParent();
}
return (JDesktopPane)p;
|
public final java.awt.Container | getFocusCycleRootAncestor()Always returns null because JInternalFrame s
must always be roots of a focus
traversal cycle.
return null;
|
public java.awt.Component | getFocusOwner()If this JInternalFrame is active,
returns the child that has focus.
Otherwise, returns null .
if (isSelected()) {
return lastFocusOwner;
}
return null;
|
public javax.swing.Icon | getFrameIcon()Returns the image displayed in the title bar of this internal frame (usually
in the top-left corner).
return frameIcon;
|
public java.awt.Component | getGlassPane()Returns the glass pane for this internal frame.
return getRootPane().getGlassPane();
|
public javax.swing.event.InternalFrameListener[] | getInternalFrameListeners()Returns an array of all the InternalFrameListener s added
to this JInternalFrame with
addInternalFrameListener .
return (InternalFrameListener[])listenerList.getListeners(
InternalFrameListener.class);
|
public javax.swing.JMenuBar | getJMenuBar()Returns the current JMenuBar for this
JInternalFrame , or null
if no menu bar has been set.
return getRootPane().getJMenuBar();
|
public java.awt.Cursor | getLastCursor()Returns the last Cursor that was set by the
setCursor method that is not a resizable
Cursor .
return lastCursor;
|
public int | getLayer()Convenience method for getting the layer attribute of this component.
return JLayeredPane.getLayer(this);
|
public javax.swing.JLayeredPane | getLayeredPane()Returns the layered pane for this internal frame.
return getRootPane().getLayeredPane();
|
public javax.swing.JMenuBar | getMenuBar()Returns the current JMenuBar for this
JInternalFrame , or null
if no menu bar has been set.
return getRootPane().getMenuBar();
|
public java.awt.Component | getMostRecentFocusOwner()Returns the child component of this JInternalFrame
that will receive the
focus when this JInternalFrame is selected.
If this JInternalFrame is
currently selected, this method returns the same component as
the getFocusOwner method.
If this JInternalFrame is not selected,
then the child component that most recently requested focus will be
returned. If no child component has ever requested focus, then this
JInternalFrame 's initial focusable component is returned.
If no such
child exists, then this JInternalFrame 's default component
to focus is returned.
if (isSelected()) {
return getFocusOwner();
}
if (lastFocusOwner != null) {
return lastFocusOwner;
}
FocusTraversalPolicy policy = getFocusTraversalPolicy();
if (policy instanceof InternalFrameFocusTraversalPolicy) {
return ((InternalFrameFocusTraversalPolicy)policy).
getInitialComponent(this);
}
Component toFocus = policy.getDefaultComponent(this);
if (toFocus != null) {
return toFocus;
}
return getContentPane();
|
public java.awt.Rectangle | getNormalBounds()If the JInternalFrame is not in maximized state, returns
getBounds() ; otherwise, returns the bounds that the
JInternalFrame would be restored to.
/* we used to test (!isMaximum) here, but since this
method is used by the property listener for the
IS_MAXIMUM_PROPERTY, it ended up getting the wrong
answer... Since normalBounds get set to null when the
frame is restored, this should work better */
if (normalBounds != null) {
return normalBounds;
} else {
return getBounds();
}
|
public javax.swing.JRootPane | getRootPane()Returns the rootPane object for this internal frame.
return rootPane;
|
public java.lang.String | getTitle()Returns the title of the JInternalFrame .
return title;
|
public javax.swing.plaf.InternalFrameUI | getUI()Returns the look-and-feel object that renders this component.
return (InternalFrameUI)ui;
|
public java.lang.String | getUIClassID()Returns the name of the look-and-feel
class that renders this component.
return uiClassID;
|
public final java.lang.String | getWarningString()Gets the warning string that is displayed with this internal frame.
Since an internal frame is always secure (since it's fully
contained within a window that might need a warning string)
this method always returns null .
return null;
|
public void | hide()
if (isIcon()) {
getDesktopIcon().setVisible(false);
}
super.hide();
|
public boolean | isClosable()Returns whether this JInternalFrame can be closed by
some user action.
return closable;
|
public boolean | isClosed()Returns whether this JInternalFrame is currently closed.
return isClosed;
|
public final boolean | isFocusCycleRoot()Always returns true because all JInternalFrame s must be
roots of a focus traversal cycle.
return true;
|
public boolean | isIcon()Returns whether the JInternalFrame is currently iconified.
return isIcon;
|
public boolean | isIconifiable()Gets the iconable property,
which by default is false .
return iconable;
|
public boolean | isMaximizable()Gets the value of the maximizable property.
return maximizable;
|
public boolean | isMaximum()Returns whether the JInternalFrame is currently maximized.
return isMaximum;
|
public boolean | isResizable()Returns whether the JInternalFrame can be resized
by some user action.
// don't allow resizing when maximized.
return isMaximum ? false : resizable;
|
protected boolean | isRootPaneCheckingEnabled()Returns whether calls to add and
setLayout are forwarded to the contentPane .
return rootPaneCheckingEnabled;
|
public boolean | isSelected()Returns whether the JInternalFrame is the
currently "selected" or active frame.
return isSelected;
|
public void | moveToBack()Convenience method that moves this component to position -1 if its
parent is a JLayeredPane .
if (isIcon()) {
if (getDesktopIcon().getParent() instanceof JLayeredPane) {
((JLayeredPane)getDesktopIcon().getParent()).
moveToBack(getDesktopIcon());
}
}
else if (getParent() instanceof JLayeredPane) {
((JLayeredPane)getParent()).moveToBack(this);
}
|
public void | moveToFront()Convenience method that moves this component to position 0 if its
parent is a JLayeredPane .
if (isIcon()) {
if (getDesktopIcon().getParent() instanceof JLayeredPane) {
((JLayeredPane)getDesktopIcon().getParent()).
moveToFront(getDesktopIcon());
}
}
else if (getParent() instanceof JLayeredPane) {
((JLayeredPane)getParent()).moveToFront(this);
}
|
public void | pack()Causes subcomponents of this JInternalFrame
to be laid out at their preferred size. Internal frames that are
iconized or maximized are first restored and then packed. If the
internal frame is unable to be restored its state is not changed
and will not be packed.
try {
if (isIcon()) {
setIcon(false);
} else if (isMaximum()) {
setMaximum(false);
}
} catch(PropertyVetoException e) {
return;
}
setSize(getPreferredSize());
validate();
|
protected void | paintComponent(java.awt.Graphics g)Overridden to allow optimized painting when the
internal frame is being dragged.
if (isDragging) {
// System.out.println("ouch");
danger = true;
}
super.paintComponent(g);
|
protected java.lang.String | paramString()Returns a string representation of this JInternalFrame .
This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be null .
String rootPaneString = (rootPane != null ?
rootPane.toString() : "");
String rootPaneCheckingEnabledString = (rootPaneCheckingEnabled ?
"true" : "false");
String closableString = (closable ? "true" : "false");
String isClosedString = (isClosed ? "true" : "false");
String maximizableString = (maximizable ? "true" : "false");
String isMaximumString = (isMaximum ? "true" : "false");
String iconableString = (iconable ? "true" : "false");
String isIconString = (isIcon ? "true" : "false");
String resizableString = (resizable ? "true" : "false");
String isSelectedString = (isSelected ? "true" : "false");
String frameIconString = (frameIcon != null ?
frameIcon.toString() : "");
String titleString = (title != null ?
title : "");
String desktopIconString = (desktopIcon != null ?
desktopIcon.toString() : "");
String openedString = (opened ? "true" : "false");
String defaultCloseOperationString;
if (defaultCloseOperation == HIDE_ON_CLOSE) {
defaultCloseOperationString = "HIDE_ON_CLOSE";
} else if (defaultCloseOperation == DISPOSE_ON_CLOSE) {
defaultCloseOperationString = "DISPOSE_ON_CLOSE";
} else if (defaultCloseOperation == DO_NOTHING_ON_CLOSE) {
defaultCloseOperationString = "DO_NOTHING_ON_CLOSE";
} else defaultCloseOperationString = "";
return super.paramString() +
",closable=" + closableString +
",defaultCloseOperation=" + defaultCloseOperationString +
",desktopIcon=" + desktopIconString +
",frameIcon=" + frameIconString +
",iconable=" + iconableString +
",isClosed=" + isClosedString +
",isIcon=" + isIconString +
",isMaximum=" + isMaximumString +
",isSelected=" + isSelectedString +
",maximizable=" + maximizableString +
",opened=" + openedString +
",resizable=" + resizableString +
",rootPane=" + rootPaneString +
",rootPaneCheckingEnabled=" + rootPaneCheckingEnabledString +
",title=" + titleString;
|
public void | remove(java.awt.Component comp)Removes the specified component from the container. If
comp is not a child of the JInternalFrame
this will forward the call to the contentPane .
int oldCount = getComponentCount();
super.remove(comp);
if (oldCount == getComponentCount()) {
getContentPane().remove(comp);
}
|
public void | removeInternalFrameListener(javax.swing.event.InternalFrameListener l)Removes the specified internal frame listener so that it no longer
receives internal frame events from this internal frame. // remind: sync??
listenerList.remove(InternalFrameListener.class, l);
|
public void | reshape(int x, int y, int width, int height)Moves and resizes this component. Unlike other components,
this implementation also forces re-layout, so that frame
decorations such as the title bar are always redisplayed.
super.reshape(x, y, width, height);
validate();
repaint();
|
public void | restoreSubcomponentFocus()Requests the internal frame to restore focus to the
last subcomponent that had focus. This is used by the UI when
the user selected this internal frame --
for example, by clicking on the title bar.
if (isIcon()) {
SwingUtilities2.compositeRequestFocus(getDesktopIcon());
}
else {
// FocusPropertyChangeListener will eventually update
// lastFocusOwner. As focus requests are asynchronous
// lastFocusOwner may be accessed before it has been correctly
// updated. To avoid any problems, lastFocusOwner is immediately
// set, assuming the request will succeed.
lastFocusOwner = getMostRecentFocusOwner();
if (lastFocusOwner == null) {
// Make sure focus is restored somewhere, so that
// we don't leave a focused component in another frame while
// this frame is selected.
lastFocusOwner = getContentPane();
}
lastFocusOwner.requestFocus();
}
|
public void | setClosable(boolean b)Sets whether this JInternalFrame can be closed by
some user action.
Boolean oldValue = closable ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
closable = b;
firePropertyChange("closable", oldValue, newValue);
|
public void | setClosed(boolean b)Closes this internal frame if the argument is true .
Do not invoke this method with a false argument;
the result of invoking setClosed(false)
is unspecified.
If the internal frame is already closed,
this method does nothing and returns immediately.
Otherwise,
this method begins by firing
an INTERNAL_FRAME_CLOSING event.
Then this method sets the closed property to true
unless a listener vetoes the property change.
This method finishes by making the internal frame
invisible and unselected,
and then firing an INTERNAL_FRAME_CLOSED event.
Note:
To reuse an internal frame that has been closed,
you must add it to a container
(even if you never removed it from its previous container).
Typically, this container will be the JDesktopPane
that previously contained the internal frame.
if (isClosed == b) {
return;
}
Boolean oldValue = isClosed ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
if (b) {
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSING);
}
fireVetoableChange(IS_CLOSED_PROPERTY, oldValue, newValue);
isClosed = b;
if (isClosed) {
setVisible(false);
}
firePropertyChange(IS_CLOSED_PROPERTY, oldValue, newValue);
if (isClosed) {
dispose();
} else if (!opened) {
/* this bogus -- we haven't defined what
setClosed(false) means. */
// fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
// opened = true;
}
|
public void | setContentPane(java.awt.Container c)Sets this JInternalFrame 's contentPane
property.
Container oldValue = getContentPane();
getRootPane().setContentPane(c);
firePropertyChange(CONTENT_PANE_PROPERTY, oldValue, c);
|
public void | setCursor(java.awt.Cursor cursor){@inheritDoc}
if (cursor == null) {
lastCursor = null;
super.setCursor(cursor);
return;
}
int type = cursor.getType();
if (!(type == Cursor.SW_RESIZE_CURSOR ||
type == Cursor.SE_RESIZE_CURSOR ||
type == Cursor.NW_RESIZE_CURSOR ||
type == Cursor.NE_RESIZE_CURSOR ||
type == Cursor.N_RESIZE_CURSOR ||
type == Cursor.S_RESIZE_CURSOR ||
type == Cursor.W_RESIZE_CURSOR ||
type == Cursor.E_RESIZE_CURSOR)) {
lastCursor = cursor;
}
super.setCursor(cursor);
|
public void | setDefaultCloseOperation(int operation)Sets the operation that will happen by default when
the user initiates a "close" on this internal frame.
The possible choices are:
DO_NOTHING_ON_CLOSE
- Do nothing.
This requires the program to handle the operation
in the
windowClosing method
of a registered InternalFrameListener object.
HIDE_ON_CLOSE
- Automatically make the internal frame invisible.
DISPOSE_ON_CLOSE
- Automatically dispose of the internal frame.
The default value is DISPOSE_ON_CLOSE .
Before performing the specified close operation,
the internal frame fires
an INTERNAL_FRAME_CLOSING event.
this.defaultCloseOperation = operation;
|
public void | setDesktopIcon(javax.swing.JInternalFrame$JDesktopIcon d)Sets the JDesktopIcon associated with this
JInternalFrame .
JDesktopIcon oldValue = getDesktopIcon();
desktopIcon = d;
firePropertyChange("desktopIcon", oldValue, d);
|
public final void | setFocusCycleRoot(boolean focusCycleRoot)Does nothing because JInternalFrame s must always be roots of a focus
traversal cycle.
|
public void | setFrameIcon(javax.swing.Icon icon)Sets an image to be displayed in the titlebar of this internal frame (usually
in the top-left corner).
This image is not the desktopIcon object, which
is the image displayed in the JDesktop when
this internal frame is iconified.
Passing null to this function is valid,
but the look and feel
can choose the
appropriate behavior for that situation, such as displaying no icon
or a default icon for the look and feel.
Icon oldIcon = frameIcon;
frameIcon = icon;
firePropertyChange(FRAME_ICON_PROPERTY, oldIcon, icon);
|
public void | setGlassPane(java.awt.Component glass)Sets this JInternalFrame 's
glassPane property.
Component oldValue = getGlassPane();
getRootPane().setGlassPane(glass);
firePropertyChange(GLASS_PANE_PROPERTY, oldValue, glass);
|
public void | setIcon(boolean b)Iconifies or de-iconifies this internal frame,
if the look and feel supports iconification.
If the internal frame's state changes to iconified,
this method fires an INTERNAL_FRAME_ICONIFIED event.
If the state changes to de-iconified,
an INTERNAL_FRAME_DEICONIFIED event is fired.
if (isIcon == b) {
return;
}
/* If an internal frame is being iconified before it has a
parent, (e.g., client wants it to start iconic), create the
parent if possible so that we can place the icon in its
proper place on the desktop. I am not sure the call to
validate() is necessary, since we are not going to display
this frame yet */
firePropertyChange("ancestor", null, getParent());
Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
isIcon = b;
firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
if (b)
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
else
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
|
public void | setIconifiable(boolean b)Sets the iconable property,
which must be true
for the user to be able to
make the JInternalFrame an icon.
Some look and feels might not implement iconification;
they will ignore this property.
Boolean oldValue = iconable ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
iconable = b;
firePropertyChange("iconable", oldValue, newValue);
|
public void | setJMenuBar(javax.swing.JMenuBar m)Sets the menuBar property for this JInternalFrame .
JMenuBar oldValue = getMenuBar();
getRootPane().setJMenuBar(m);
firePropertyChange(MENU_BAR_PROPERTY, oldValue, m);
|
private void | setLastFocusOwner(java.awt.Component component)
lastFocusOwner = component;
|
public void | setLayer(java.lang.Integer layer)Convenience method for setting the layer attribute of this component.
if(getParent() != null && getParent() instanceof JLayeredPane) {
// Normally we want to do this, as it causes the LayeredPane
// to draw properly.
JLayeredPane p = (JLayeredPane)getParent();
p.setLayer(this, layer.intValue(), p.getPosition(this));
} else {
// Try to do the right thing
JLayeredPane.putLayer(this, layer.intValue());
if(getParent() != null)
getParent().repaint(getX(), getY(), getWidth(), getHeight());
}
|
public void | setLayer(int layer)Convenience method for setting the layer attribute of this component.
The method setLayer(Integer) should be used for
layer values predefined in JLayeredPane .
When using setLayer(int) , care must be taken not to
accidentally clash with those values.
this.setLayer(new Integer(layer));
|
public void | setLayeredPane(javax.swing.JLayeredPane layered)Sets this JInternalFrame 's
layeredPane property.
JLayeredPane oldValue = getLayeredPane();
getRootPane().setLayeredPane(layered);
firePropertyChange(LAYERED_PANE_PROPERTY, oldValue, layered);
|
public void | setLayout(java.awt.LayoutManager manager)Ensures that, by default, the layout of this component cannot be set.
Overridden to conditionally forward the call to the
contentPane .
Refer to {@link javax.swing.RootPaneContainer} for
more information.
if(isRootPaneCheckingEnabled()) {
getContentPane().setLayout(manager);
}
else {
super.setLayout(manager);
}
|
public void | setMaximizable(boolean b)Sets the maximizable property,
which determines whether the JInternalFrame
can be maximized by
some user action.
Some look and feels might not support maximizing internal frames;
they will ignore this property.
Boolean oldValue = maximizable ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
maximizable = b;
firePropertyChange("maximizable", oldValue, newValue);
|
public void | setMaximum(boolean b)Maximizes and restores this internal frame. A maximized frame is resized to
fully fit the JDesktopPane area associated with the
JInternalFrame .
A restored frame's size is set to the JInternalFrame 's
actual size.
if (isMaximum == b) {
return;
}
Boolean oldValue = isMaximum ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
fireVetoableChange(IS_MAXIMUM_PROPERTY, oldValue, newValue);
/* setting isMaximum above the event firing means that
property listeners that, for some reason, test it will
get it wrong... See, for example, getNormalBounds() */
isMaximum = b;
firePropertyChange(IS_MAXIMUM_PROPERTY, oldValue, newValue);
|
public void | setMenuBar(javax.swing.JMenuBar m)Sets the menuBar property for this JInternalFrame .
JMenuBar oldValue = getMenuBar();
getRootPane().setJMenuBar(m);
firePropertyChange(MENU_BAR_PROPERTY, oldValue, m);
|
public void | setNormalBounds(java.awt.Rectangle r)Sets the normal bounds for this internal frame, the bounds that
this internal frame would be restored to from its maximized state.
This method is intended for use only by desktop managers.
normalBounds = r;
|
public void | setResizable(boolean b)Sets whether the JInternalFrame can be resized by some
user action.
Boolean oldValue = resizable ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
resizable = b;
firePropertyChange("resizable", oldValue, newValue);
|
protected void | setRootPane(javax.swing.JRootPane root)Sets the rootPane property
for this JInternalFrame .
This method is called by the constructor.
if(rootPane != null) {
remove(rootPane);
}
JRootPane oldValue = getRootPane();
rootPane = root;
if(rootPane != null) {
boolean checkingEnabled = isRootPaneCheckingEnabled();
try {
setRootPaneCheckingEnabled(false);
add(rootPane, BorderLayout.CENTER);
}
finally {
setRootPaneCheckingEnabled(checkingEnabled);
}
}
firePropertyChange(ROOT_PANE_PROPERTY, oldValue, root);
|
protected void | setRootPaneCheckingEnabled(boolean enabled)Sets whether calls to add and
setLayout are forwarded to the contentPane .
rootPaneCheckingEnabled = enabled;
|
public void | setSelected(boolean selected)Selects or deselects the internal frame
if it's showing.
A JInternalFrame normally draws its title bar
differently if it is
the selected frame, which indicates to the user that this
internal frame has the focus.
When this method changes the state of the internal frame
from deselected to selected, it fires an
InternalFrameEvent.INTERNAL_FRAME_ACTIVATED event.
If the change is from selected to deselected,
an InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED event
is fired.
// The InternalFrame may already be selected, but the focus
// may be outside it, so restore the focus to the subcomponent
// which previously had it. See Bug 4302764.
if (selected && isSelected) {
restoreSubcomponentFocus();
return;
}
// The internal frame or the desktop icon must be showing to allow
// selection. We may deselect even if neither is showing.
if ((isSelected == selected) || (selected &&
(isIcon ? !desktopIcon.isShowing() : !isShowing()))) {
return;
}
Boolean oldValue = isSelected ? Boolean.TRUE : Boolean.FALSE;
Boolean newValue = selected ? Boolean.TRUE : Boolean.FALSE;
fireVetoableChange(IS_SELECTED_PROPERTY, oldValue, newValue);
/* We don't want to leave focus in the previously selected
frame, so we have to set it to *something* in case it
doesn't get set in some other way (as if a user clicked on
a component that doesn't request focus). If this call is
happening because the user clicked on a component that will
want focus, then it will get transfered there later.
We test for parent.isShowing() above, because AWT throws a
NPE if you try to request focus on a lightweight before its
parent has been made visible */
if (selected) {
restoreSubcomponentFocus();
}
isSelected = selected;
firePropertyChange(IS_SELECTED_PROPERTY, oldValue, newValue);
if (isSelected)
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ACTIVATED);
else
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED);
repaint();
|
public void | setTitle(java.lang.String title)Sets the JInternalFrame title. title
may have a null value.
String oldValue = this.title;
this.title = title;
firePropertyChange(TITLE_PROPERTY, oldValue, title);
|
public void | setUI(javax.swing.plaf.InternalFrameUI ui)Sets the UI delegate for this JInternalFrame .
boolean checkingEnabled = isRootPaneCheckingEnabled();
try {
setRootPaneCheckingEnabled(false);
super.setUI(ui);
}
finally {
setRootPaneCheckingEnabled(checkingEnabled);
}
|
public void | show()If the internal frame is not visible,
brings the internal frame to the front,
makes it visible,
and attempts to select it.
The first time the internal frame is made visible,
this method also fires an INTERNAL_FRAME_OPENED event.
This method does nothing if the internal frame is already visible.
Invoking this method
has the same result as invoking
setVisible(true) .
// bug 4312922
if (isVisible()) {
//match the behavior of setVisible(true): do nothing
return;
}
// bug 4149505
if (!opened) {
fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED);
opened = true;
}
/* icon default visibility is false; set it to true so that it shows
up when user iconifies frame */
getDesktopIcon().setVisible(true);
toFront();
super.show();
if (isIcon) {
return;
}
if (!isSelected()) {
try {
setSelected(true);
} catch (PropertyVetoException pve) {}
}
|
public void | toBack()Sends this internal frame to the back.
Places this internal frame at the bottom of the stacking order
and makes the corresponding adjustment to other visible
internal frames.
moveToBack();
|
public void | toFront()Brings this internal frame to the front.
Places this internal frame at the top of the stacking order
and makes the corresponding adjustment to other visible internal
frames.
moveToFront();
|
private static void | updateLastFocusOwner(java.awt.Component component)
if (component != null) {
Component parent = component;
while (parent != null && !(parent instanceof Window)) {
if (parent instanceof JInternalFrame) {
// Update lastFocusOwner for parent.
((JInternalFrame)parent).setLastFocusOwner(component);
}
parent = parent.getParent();
}
}
|
public void | updateUI()Notification from the UIManager that the look and feel
has changed.
Replaces the current UI object with the latest version from the
UIManager .
setUI((InternalFrameUI)UIManager.getUI(this));
invalidate();
if (desktopIcon != null) {
desktopIcon.updateUIWhenHidden();
}
|
void | updateUIWhenHidden()
setUI((InternalFrameUI)UIManager.getUI(this));
invalidate();
Component[] children = getComponents();
if (children != null) {
for(int i = 0; i < children.length; i++) {
SwingUtilities.updateComponentTreeUI(children[i]);
}
}
|
private void | writeObject(java.io.ObjectOutputStream s)See readObject and writeObject
in JComponent for more
information about serialization in Swing.
s.defaultWriteObject();
if (getUIClassID().equals(uiClassID)) {
byte count = JComponent.getWriteObjCounter(this);
JComponent.setWriteObjCounter(this, --count);
if (count == 0 && ui != null) {
boolean old = isRootPaneCheckingEnabled();
try {
setRootPaneCheckingEnabled(false);
ui.installUI(this);
} finally {
setRootPaneCheckingEnabled(old);
}
}
}
|