📄 jrootpane.java
字号:
protected Component glassPane; /** DOCUMENT ME! */ protected JLayeredPane layeredPane; /** DOCUMENT ME! */ protected JMenuBar menuBar; /** DOCUMENT ME! */ protected Container contentPane; protected JButton defaultButton; /** * This field is unused since JDK1.3. To override the default action you * should modify the JRootPane's ActionMap. * * @deprecated since JDK1.3 * * @specnote the specs indicate that the type of this field is * a package private inner class * javax.swing.JRootPane.DefaultAction. I assume that the closest * public superclass is javax.swing.Action. */ protected Action defaultPressAction; /** * This field is unused since JDK1.3. To override the default action you * should modify the JRootPane's ActionMap. * * @deprecated since JDK1.3 * * @specnote the specs indicate that the type of this field is * a package private inner class * javax.swing.JRootPane.DefaultAction. I assume that the closest * public superclass is javax.swing.Action. */ protected Action defaultReleaseAction; /** * @since 1.4 */ private int windowDecorationStyle = NONE; /** * DOCUMENT ME! * * @param m DOCUMENT ME! */ public void setJMenuBar(JMenuBar m) { JLayeredPane jlPane = getLayeredPane(); if (menuBar != null) jlPane.remove(menuBar); menuBar = m; if (menuBar != null) jlPane.add(menuBar, JLayeredPane.FRAME_CONTENT_LAYER); } /** * @deprecated Replaced by <code>setJMenuBar()</code> */ public void setMenuBar(JMenuBar m) { setJMenuBar(m); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public JMenuBar getJMenuBar() { return menuBar; } /** * @deprecated Replaced by <code>getJMenuBar()</code> */ public JMenuBar getMenuBar() { return getJMenuBar(); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public boolean isValidateRoot() { return true; } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public Container getContentPane() { if (contentPane == null) setContentPane(createContentPane()); return contentPane; } /** * Sets the JRootPane's content pane. The content pane should typically be * opaque for painting to work properly. This method also * removes the old content pane from the layered pane. * * @param p the Container that will be the content pane * @throws IllegalComponentStateException if p is null */ public void setContentPane(Container p) { if (p == null) throw new IllegalComponentStateException ("cannot " + "have a null content pane"); else { if (contentPane != null && contentPane.getParent() == layeredPane) layeredPane.remove(contentPane); contentPane = p; getLayeredPane().add(contentPane, JLayeredPane.FRAME_CONTENT_LAYER); } } /** * DOCUMENT ME! * * @param comp DOCUMENT ME! * @param constraints DOCUMENT ME! * @param index DOCUMENT ME! */ protected void addImpl(Component comp, Object constraints, int index) { super.addImpl(comp, constraints, index); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public Component getGlassPane() { if (glassPane == null) setGlassPane(createGlassPane()); return glassPane; } /** * DOCUMENT ME! * * @param f DOCUMENT ME! */ public void setGlassPane(Component f) { if (glassPane != null) remove(glassPane); glassPane = f; glassPane.setVisible(false); add(glassPane, 0); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public JLayeredPane getLayeredPane() { if (layeredPane == null) setLayeredPane(createLayeredPane()); return layeredPane; } /** * DOCUMENT ME! * * @param f DOCUMENT ME! */ public void setLayeredPane(JLayeredPane f) { if (layeredPane != null) remove(layeredPane); layeredPane = f; add(f, -1); } /** * Creates a new <code>JRootPane</code> object. */ public JRootPane() { setLayout(createRootLayout()); getGlassPane(); getLayeredPane(); getContentPane(); updateUI(); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ protected LayoutManager createRootLayout() { return new RootLayout(); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ protected Container createContentPane() { JPanel p = new JPanel(); p.setName(this.getName() + ".contentPane"); p.setLayout(new BorderLayout()); return p; } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ protected Component createGlassPane() { JPanel p = new JPanel(); p.setName(this.getName() + ".glassPane"); p.setVisible(false); p.setOpaque(false); return p; } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ protected JLayeredPane createLayeredPane() { JLayeredPane l = new JLayeredPane(); l.setLayout(null); return l; } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public RootPaneUI getUI() { return (RootPaneUI) ui; } /** * DOCUMENT ME! * * @param ui DOCUMENT ME! */ public void setUI(RootPaneUI ui) { super.setUI(ui); } /** * DOCUMENT ME! */ public void updateUI() { setUI((RootPaneUI) UIManager.getUI(this)); } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public String getUIClassID() { return "RootPaneUI"; } public JButton getDefaultButton() { return defaultButton; } public void setDefaultButton(JButton newButton) { if (defaultButton == newButton) return; JButton oldButton = defaultButton; defaultButton = newButton; firePropertyChange("defaultButton", oldButton, newButton); } /** * @since 1.4 */ public int getWindowDecorationStyle() { return windowDecorationStyle; } /** * @since 1.4 */ public void setWindowDecorationStyle(int style) { if (style != NONE && style != FRAME && style != INFORMATION_DIALOG && style != ERROR_DIALOG && style != COLOR_CHOOSER_DIALOG && style != FILE_CHOOSER_DIALOG && style != QUESTION_DIALOG && style != WARNING_DIALOG && style != PLAIN_DIALOG) throw new IllegalArgumentException("invalid style"); int oldStyle = windowDecorationStyle; windowDecorationStyle = style; firePropertyChange("windowDecorationStyle", oldStyle, style); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -