Java Code Examples for javax.swing.JRootPane#repaint()

The following examples show how to use javax.swing.JRootPane#repaint() . 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: BERootPaneUI.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
/**
 * Uninstalls any state that <code>installClientDecorations</code> has
 * installed.
 * <p>
 * NOTE: This may be called if you haven't installed client decorations
 * yet (ie before <code>installClientDecorations</code> has been invoked).
 *
 * @param root the root
 */
private void uninstallClientDecorations(JRootPane root) 
{
	uninstallBorder(root);
	uninstallWindowListeners(root);
	setTitlePane(root, null);
	uninstallLayout(root);
	// We have to revalidate/repaint root if the style is JRootPane.NONE
	// only. When we needs to call revalidate/repaint with other styles
	// the installClientDecorations is always called after this method
	// imediatly and it will cause the revalidate/repaint at the proper
	// time.
	int style = root.getWindowDecorationStyle();
	if (style == JRootPane.NONE) 
	{
		root.repaint();
		root.revalidate();
	}
	// Reset the cursor, as we may have changed it to a resize cursor
	if (window != null) 
	{
		window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
	}
	window = null;
}
 
Example 2
Source File: SeaGlassRootPaneUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
/**
 * Installs the necessary state onto the JRootPane to render client
 * decorations. This is ONLY invoked if the <code>JRootPane</code> has a
 * decoration style other than <code>JRootPane.NONE</code>.
 *
 * @param root the JRootPane.
 */
private void installClientDecorations(JRootPane root) {
    installBorder(root);
    if (root.getParent() instanceof JFrame || root.getParent() instanceof JDialog) {
        if (PlatformUtils.isMac()) {
            makeFrameBackgroundTransparent(root);
        } else {
            shapeWindow(root);
        }
    }

    JComponent titlePane = createTitlePane(root);

    setTitlePane(root, titlePane);
    installWindowListeners(root, root.getParent());
    installLayout(root);
    if (window != null) {
        root.revalidate();
        root.repaint();
    }
}
 
Example 3
Source File: SeaGlassRootPaneUI.java    From seaglass with Apache License 2.0 6 votes vote down vote up
/**
 * Uninstalls any state that <code>installClientDecorations</code> has
 * installed.
 *
 * <p>NOTE: This may be called if you haven't installed client decorations
 * yet (ie before <code>installClientDecorations</code> has been invoked).
 * </p>
 *
 * @param root the JRootPane.
 */
private void uninstallClientDecorations(JRootPane root) {
    uninstallBorder(root);
    uninstallWindowListeners(root);
    setTitlePane(root, null);
    uninstallLayout(root);
    // We have to revalidate/repaint root if the style is JRootPane.NONE
    // only. When we needs to call revalidate/repaint with other styles
    // the installClientDecorations is always called after this method
    // imediatly and it will cause the revalidate/repaint at the proper
    // time.
    int style = root.getWindowDecorationStyle();

    if (style == JRootPane.NONE) {
        root.repaint();
        root.revalidate();
    }
    // Reset the cursor, as we may have changed it to a resize cursor
    if (window != null) {
        window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }

    window = null;
}
 
Example 4
Source File: Search.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
private void removeFloater() {
    if (mFloater != null) {
        JRootPane rootPane = getRootPane();
        Container parent   = mFloater.getParent();
        Rectangle bounds   = mFloater.getBounds();
        UIUtilities.convertRectangle(bounds, parent, rootPane);
        if (parent != null) {
            parent.remove(mFloater);
        }
        mFloater = null;
        if (rootPane != null) {
            rootPane.repaint(bounds);
        }
    }
}
 
Example 5
Source File: LuckRootPaneUI.java    From littleluck with Apache License 2.0 5 votes vote down vote up
protected void uninstallOther(JRootPane root)
{
    Container content = root.getContentPane();

    if (content != null && content instanceof LuckBackgroundPanel)
    {
        LuckBackgroundPanel bgPanel = (LuckBackgroundPanel) content;

        root.setContentPane(bgPanel.getContentPane());

        root.setJMenuBar(bgPanel.getJMenuBar());

        bgPanel.uninstallMenubar(true);
    }

    int style = root.getWindowDecorationStyle();

    if (style == JRootPane.NONE)
    {
        root.repaint();

        root.revalidate();
    }

    Window window = SwingUtilities.getWindowAncestor(root);

    if (window != null)
    {
        window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}
 
Example 6
Source File: BERootPaneUI.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
/**
	 * Installs the necessary state onto the JRootPane to render client
	 * decorations. This is ONLY invoked if the <code>JRootPane</code>
	 * has a decoration style other than <code>JRootPane.NONE</code>.
	 *
	 * @param root the root
	 */
	private void installClientDecorations(JRootPane root)
	{
		installBorder(root);

		JComponent titlePane = createTitlePane(root);

		setTitlePane(root, titlePane);
		installWindowListeners(root, root.getParent());
		installLayout(root);
		
		//只有在窗口边框是半透明的情况下,以下才需要设置窗口透明
		//* 注意:本类中的此处代码的目的就是为了实现半透明边框窗口的
		//* 正常显示,而且仅针对此目的。如果该边框不为透明,则此处也就不需要设置
		//* 窗口透明了,那么如果你的程序其它地方需要窗口透明的话,自行.setWindowOpaque(..)
		//* 就行了,由开发者自先决定,此处就不承载过多的要求了
		if (!BeautyEyeLNFHelper.__isFrameBorderOpaque() 
				&& window != null)
		{
			//** 20111222 by jb2011,让窗口全透明(用以实现窗口的透明边框效果)
//			AWTUtilities.setWindowOpaque(window, false);
			// TODO BUG:1)目前可知,在jdk1.7.0_u6下,JDialog的半透明边框的透明度比原设计深一倍
			// TODO BUG:2)目前可知,在jdk1.6.0_u33下+win7平台下,JFrame窗口被调置成透明后,
			//				该窗口内所在文本都会被反走样(不管你要没有要求反走样),真悲具,这应该
			//				是官方AWTUtilities.setWindowOpaque(..)bug导致的,1.7.0_u6同样存在该问题,
			//				使用BeautyEye时,遇到这样的问题只能自行使用__isFrameBorderOpaque中指定的
			//				不透明边框才行(这样此类的以下代码就不用执行,也就不用触发该bug了),但
			//				JDialog不受此bug影响,诡异!
			WindowTranslucencyHelper.setWindowOpaque(window, false);
			root.revalidate();
			root.repaint();
		}
	}