📄 jinternalframe.java
字号:
// The cast here forces the call to the instance method getLayer() // instead of the static method (this would lead to infinite // recursion). return pane.getLayer((Component) this); return -1; } /** * This method returns the LayeredPane for this JInternalFrame. * * @return The LayeredPane for this JInternalFrame. */ public JLayeredPane getLayeredPane() { return getRootPane().getLayeredPane(); } /** * This method is deprecated. This method returns the JMenuBar for this * JInternalFrame. * * @return The JMenuBar for this JInternalFrame. * * @deprecated 1.0.3 */ public JMenuBar getMenuBar() { return getJMenuBar(); } /** * This method returns the child Component that will receive focus when the * JInternalFrame is selected. If the JInternalFrame is selected, this * method returns getFocusOwner(). Otherwise, it will return the child * Component that most recently requested focus. If that is null, then the * initial focus Component is returned. If that is null, then the default * focus component is returned. * * @return The most recent focus owner. */ public Component getMostRecentFocusOwner() { if (isSelected()) return getFocusOwner(); else return defaultFocus; } /** * This method returns the bounds of the JInternalFrame if it is not * maximized. If it is maximized, it returns the bounds of the * JInternalFrame before it was maximized (the bounds that it will be * restored to). * * @return A Rectangle that contains this JInternalFrame's normal bounds (or * just its bounds if it is not maximized). */ public Rectangle getNormalBounds() { if (! isMaximum() && ! maxTransition) return getBounds(); else return storedBounds; } /** * This method returns the Root Pane for this JInternalFrame. * * @return The Root Pane for this JInternalFrame. */ public JRootPane getRootPane() { return rootPane; } /** * This method sets the title of the JInternalFrame. * * @return The String displayed in the TitlePane of this JInternalFrame. */ public String getTitle() { return title; } /** * This method returns the UI used to represent the JInternalFrame. * * @return The UI used to represent the JInternalFrame. */ public InternalFrameUI getUI() { return (InternalFrameUI) ui; } /** * This method returns a String identifier that is used to determine which * class acts as the JInternalFrame's UI. * * @return A String identifier to determine a UI class. */ public String getUIClassID() { return "InternalFrameUI"; } /** * This method returns null. * * @return null. */ public final String getWarningString() { // as defined. return null; } /** * This method deselects this JInternalFrame and hides it. */ public void hide() { JDesktopPane pane = getDesktopPane(); if (pane != null) pane.setSelectedFrame(null); else { try { setSelected(false); } catch (PropertyVetoException e) { // Do nothing. } } super.hide(); } /** * This method returns whether this JInternalFrame is closable. * * @return Whether this JInternalFrame is closable. */ public boolean isClosable() { return closable; } /** * This method returns whether this JInternalFrame has been closed. * * @return Whether this JInternalFrame is closed. */ public boolean isClosed() { return isClosed; } /** * This must always return true. * * @return always true * * @since 1.4 */ public final boolean isFocusCycleRoot() { return true; } /** * This method returns whether this JInternalFrame is currently iconified. * * @return Whether this JInternalFrame is currently iconified. */ public boolean isIcon() { return isIcon; } /** * This method returns whether the JInternalFrame can be iconified. * * @return Whether the JInternalFrame can be iconified. */ public boolean isIconifiable() { return iconable; } /** * This method returns whether this JInternalFrame can be maximized. * * @return Whether this JInternalFrame can be maximized. */ public boolean isMaximizable() { return maximizable; } /** * This method returns whether this JInternalFrame is currently maximized. * * @return Whether this JInternalFrame is maximized. */ public boolean isMaximum() { return isMaximum; } /** * This method returns whether this JInternalFrame is resizable. * * @return Whether this JInternalFrame is resizable. */ public boolean isResizable() { return resizable; } /** * This method returns whether root pane checking is enabled. If root pane * checking is enabled, then calls to addImpl and setLayout will throw * exceptions. * * @return Whether root pane checking is enabled. */ protected boolean isRootPaneCheckingEnabled() { return rootPaneCheckingEnabled; } /** * This method returns whether this JInternalFrame is selected. * * @return Whether this JInternalFrame is selected. */ public boolean isSelected() { return isSelected; } /** * A helper method that moves this JInternalFrame to the back if the parent * is a JLayeredPane. */ public void moveToBack() { if (getParent() instanceof JLayeredPane) ((JLayeredPane) getParent()).moveToBack(this); } /** * A helper method that moves this JInternalFrame to the front if the parent * is a JLayeredPane. */ public void moveToFront() { if (getParent() instanceof JLayeredPane) ((JLayeredPane) getParent()).moveToFront(this); } /** * This method causes the children of this JInternalFrame to be laid out. * Before it begins, if this JInternalFrame is an icon, then it will be * deiconified. If it is maximized, then it will be restored. If either * operation fails, then this method will return. */ public void pack() { try { if (isIcon()) setIcon(false); else if (isMaximum()) setMaximum(false); } catch (PropertyVetoException e) { // Do nothing if they don't want to be restored first. } setSize(getPreferredSize()); } /** * This method is overridden to allow for speedier painting while this * JInternalFramme is being dragged. * * @param g The Graphics object to paint with. */ protected void paintComponent(Graphics g) { super.paintComponent(g); } /** * This method returns a String describing this JInternalFrame. * * @return A String describing this JInternalFrame. */ protected String paramString() { return super.paramString(); } /** * This method removes the given Component from the Container. * * @param comp The Component to remove. */ public void remove(Component comp) { // If we're removing the root pane, use super.remove. Otherwise // pass it on to the content pane instead. if (comp==rootPane) super.remove(comp); else getContentPane().remove(comp); } /** * This method removes an InternalFrameListener from this JInternalFrame. * * @param l The listener to remove. */ public void removeInternalFrameListener(InternalFrameListener l) { listenerList.remove(InternalFrameListener.class, l); } /** * This method resizes and positions this JInternalFrame. It also forces a * relayout of the Container. * * @param x The x position of this JInternalFrame. * @param y The y position of this JInternalFrame. * @param width The width of this JInternalFrame. * @param height The height of this JInternalFrame. */ public void reshape(int x, int y, int width, int height) { super.reshape(x, y, width, height); revalidate(); } /** * This method gives focus to the last child Component that had focus. This * is used by the UI when this JInternalFrame is activated. */ public void restoreSubcomponentFocus() { Component c = getMostRecentFocusOwner(); if (c != null) c.requestFocus(); } /** * This method sets whether this JInternalFrame can be closed. * * @param b Whether this JInternalFrame can be closed. */ public void setClosable(boolean b) { closable = b; } /** * This method closes the JInternalFrame if the given boolean is true. If it * is false, then the result of this method is unspecified. If the * JInternalFrame is closed, this method does nothing. This method will * first fire an INTERNAL_FRAME_CLOSING event and give a chance for veto * listeners to cancel the close. If no listener vetoes the change, the * closed property is set to true and the JInternalFrame is hidden and * unselected. The method will finish by firing an INTERNAL_FRAME_CLOSED * event. * * @param b Whether the JInternalFrame will be closed. * * @throws PropertyVetoException If a VetoableChangeListener vetoes the change. */ public void setClosed(boolean b) throws PropertyVetoException { if (b && ! isClosed()) { fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSING); fireVetoableChange(IS_CLOSED_PROPERTY, false, true); isClosed = b; firePropertyChange(IS_CLOSED_PROPERTY, false, true); fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED); } } /** * This method sets the Container to be used as a Content Pane for this * JInternalFrame. * * @param c The Container to use as a Content Pane. */ public void setContentPane(Container c) { if (c != getContentPane()) { Container old = getContentPane(); getRootPane().setContentPane(c); firePropertyChange(CONTENT_PANE_PROPERTY, old, c); } } /** * This method sets the action taken when this JInternalFrame is closed. * * @param operation One of DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE or * DISPOSE_ON_CLOSE. * * @throws Error If the given operation is not one of the allowed modes. */ public void setDefaultCloseOperation(int operation) { /* Reference implementation allows invalid operations to be specified. In that case, behaviour defaults to DO_NOTHING_ON_CLOSE. processWindowEvent handles the behaviour. getDefaultCloseOperation must return the invalid operator code. */ defaultCloseOperation = operation; } /** * This method sets the JDesktopIcon that represents this JInternalFrame * while it is iconified. * * @param d The JDesktopIcon that represents this JInternalFrame while it is * iconified. */ public void setDesktopIcon(JDesktopIcon d) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -