Java Code Examples for javax.swing.JRootPane#setBorder()
The following examples show how to use
javax.swing.JRootPane#setBorder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LuckRootPaneUI.java From littleluck with Apache License 2.0 | 6 votes |
/** * <p>给根窗格安装边框</p> * * <p>To install JRootPane border</p> * * @param root <code>JRootPane</code> */ protected void installBorder(JRootPane root) { int style = root.getWindowDecorationStyle(); // 这句必须,否则会出现无法安装边框的情况 // Sentence must, otherwise there will not be installed border situation root.setBorder(null); // if(LuckPlatformUtils.isWindows()) { root.setBorder(UIManager.getBorder(borderKeys[style])); } else { root.setBorder(LineBorder.createBlackLineBorder()); } }
Example 2
Source File: BERootPaneUI.java From beautyeye with Apache License 2.0 | 6 votes |
/** * Installs the appropriate <code>Border</code> onto the * <code>JRootPane</code>. * * @param root the root */ void installBorder(JRootPane root) { int style = root.getWindowDecorationStyle(); if (style == JRootPane.NONE) { LookAndFeel.uninstallBorder(root); } else { Border b = root.getBorder(); if (b == null || b instanceof UIResource) { root.setBorder(null); root.setBorder(UIManager.getBorder(borderKeys[style])); } } }
Example 3
Source File: LuckWindowAdapter.java From littleluck with Apache License 2.0 | 5 votes |
public void windowStateChanged(WindowEvent e) { Window window = (Window) e.getSource(); if (window instanceof JFrame) { JFrame frame = (JFrame) window; JRootPane rootPane = frame.getRootPane(); if(rootPane.getUI() instanceof LuckRootPaneUI) { LuckRootPaneUI rootPaneUI = (LuckRootPaneUI) rootPane.getUI(); rootPaneUI.getTitlePane().setState(e.getNewState()); } if (e.getNewState() == JFrame.MAXIMIZED_BOTH) { rootPane.setBorder(null); } else if (e.getNewState() == JFrame.NORMAL) { rootPane.setBorder(UIManager.getBorder(LuckRootPaneUIBundle.FRAME_BORDER)); } } }
Example 4
Source File: SeaGlassRootPaneUI.java From seaglass with Apache License 2.0 | 5 votes |
/** * Installs the appropriate <code>Border</code> onto the <code> * JRootPane</code>. * * @param root the root pane. */ public void installBorder(JRootPane root) { int style = root.getWindowDecorationStyle(); if (style == JRootPane.NONE) { LookAndFeel.uninstallBorder(root); } else { root.setBorder(new SeaGlassBorder(this, new Insets(0, 1, 1, 1))); } }
Example 5
Source File: BETitlePane.java From beautyeye with Apache License 2.0 | 4 votes |
/** * Sets the state of the window. If <code>updateRegardless</code> is * true and the state has not changed, this will update anyway. * * @param state the state * @param updateRegardless the update regardless */ private void setState(int state, boolean updateRegardless) { Window w = getWindow(); if (w != null && getWindowDecorationStyle() == JRootPane.FRAME) { if (this.state == state && !updateRegardless) { return; } Frame frame = getFrame(); if (frame != null) { JRootPane rootPane = getRootPane(); if (((state & Frame.MAXIMIZED_BOTH) != 0) && (rootPane.getBorder() == null || (rootPane .getBorder() instanceof UIResource)) && frame.isShowing()) { rootPane.setBorder(null); } else if ((state & Frame.MAXIMIZED_BOTH) == 0) { // This is a croak, if state becomes bound, this can // be nuked. rootPaneUI.installBorder(rootPane); } if (frame.isResizable()) { if ((state & Frame.MAXIMIZED_BOTH) != 0) { updateToggleButton(restoreAction, minimizeIcon, minimizeIcon_rover, minimizeIcon_pressed); maximizeAction.setEnabled(false); restoreAction.setEnabled(true); } else { updateToggleButton(maximizeAction, maximizeIcon, maximizeIcon_rover, maximizeIcon_pressed); maximizeAction.setEnabled(true); restoreAction.setEnabled(false); } if (toggleButton.getParent() == null || iconifyButton.getParent() == null) { add(toggleButton); add(iconifyButton); revalidate(); repaint(); } toggleButton.setText(null); } else { maximizeAction.setEnabled(false); restoreAction.setEnabled(false); if (toggleButton.getParent() != null) { remove(toggleButton); revalidate(); repaint(); } } } else { // Not contained in a Frame maximizeAction.setEnabled(false); restoreAction.setEnabled(false); iconifyAction.setEnabled(false); remove(toggleButton); remove(iconifyButton); revalidate(); repaint(); } closeAction.setEnabled(true); this.state = state; } }
Example 6
Source File: LuckRootPaneUI.java From littleluck with Apache License 2.0 | 3 votes |
/** * <p>去除窗格边框</p> * * <p>remove JRootPane border.</p> * * @param root */ protected void uninstallBorder(JRootPane root) { LookAndFeel.uninstallBorder(root); root.setBorder(null); }