当前位置: 首页>>代码示例>>Java>>正文


Java GraphicsDevice.isWindowTranslucencySupported方法代码示例

本文整理汇总了Java中java.awt.GraphicsDevice.isWindowTranslucencySupported方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsDevice.isWindowTranslucencySupported方法的具体用法?Java GraphicsDevice.isWindowTranslucencySupported怎么用?Java GraphicsDevice.isWindowTranslucencySupported使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.GraphicsDevice的用法示例。


在下文中一共展示了GraphicsDevice.isWindowTranslucencySupported方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setWindowAlpha

import java.awt.GraphicsDevice; //导入方法依赖的package包/类
@Override
public void setWindowAlpha(Window w, float alpha) {
    GraphicsConfiguration gc = w.getGraphicsConfiguration();
    GraphicsDevice gd = gc.getDevice();
    if (gc.getDevice().getFullScreenWindow() == w) {
        return;
    }
    if (!gd.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) {
        return;
    }
    w.setOpacity(alpha);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:NoNativeAccessWindowSystem.java

示例2: setWindowMask

import java.awt.GraphicsDevice; //导入方法依赖的package包/类
@Override
public void setWindowMask(Window w, Shape mask) {
    GraphicsConfiguration gc = w.getGraphicsConfiguration();
    GraphicsDevice gd = gc.getDevice();
    if (gc.getDevice().getFullScreenWindow() == w) {
        return;
    }
    if (!gd.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) {
        return;
    }
    w.setShape(mask);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:NoNativeAccessWindowSystem.java

示例3: checkEffects

import java.awt.GraphicsDevice; //导入方法依赖的package包/类
private void checkEffects() {
    GraphicsDevice gd = getGraphicsConfiguration().getDevice();
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT)) {
        shapedCb.setEnabled(false);
    }
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
        transparencySld.setEnabled(false);
    }
    if (!gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
        nonOpaqueChb.setEnabled(false);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:TranslucentShapedFrameTest.java

示例4: main

import java.awt.GraphicsDevice; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice gd = ge.getDefaultScreenDevice();
        GraphicsDevice.WindowTranslucency mode = GraphicsDevice.WindowTranslucency.TRANSLUCENT;
        boolean translucencyCheck = gd.isWindowTranslucencySupported(mode);
        if(!translucencyCheck) {
            return;
    }

        Robot robot = new Robot();
        // create a GUI
        SwingUtilities.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                createAndShowGUI();
            }
        });
        robot.waitForIdle();
        Color opaque = robot.getPixelColor(dlgPos.x + 100, dlgPos.y + 100);

        // set Dialog Opacity
        SwingUtilities.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                dialog.setOpacity(OPACITY);
            }
        });
        robot.waitForIdle();

        // iconify frame
        SwingUtilities.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                frame.setExtendedState(JFrame.ICONIFIED);
            }
        });
        robot.waitForIdle();

        // deiconify frame
        SwingUtilities.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                frame.setExtendedState(JFrame.NORMAL);
            }
        });
        robot.waitForIdle();

        Color transparent = robot.getPixelColor(dlgPos.x + 100, dlgPos.y + 100);
        if (transparent.equals(opaque)) {
            frame.dispose();
            throw new RuntimeException("JDialog transparency lost "
                    + "upon iconify/deiconify sequence");
        }
        frame.dispose();
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:61,代码来源:TransparencyTest.java

示例5: BubbleWindow

import java.awt.GraphicsDevice; //导入方法依赖的package包/类
/**
 * Creates an instance with the given parameters. Should be called with the arguments gathered
 * from {@link BubbleWindowBuilder} implementations.
 *
 * @param owner
 *            the {@link Window} on which this {@link BubbleWindow} should be shown
 * @param style
 *            the style the bubble should have
 * @param preferredAlignment
 *            offer for alignment but the Class will calculate by itself whether the position is
 *            usable
 * @param i18nKey
 *            key of the message which should be shown
 * @param docKey
 *            key of the Dockable the BubbleWindow will attach to
 * @param moveable
 *            if {@code true} the user can drag the bubble around on screen
 * @param showCloseButton
 *            if {@code true} the user can close the bubble via an "x" button in the top right
 *            corner
 * @param titleFont
 *            the font for the title, can be {@code null}
 * @param bodyFont
 *            the font for the body, can be {@code null}
 * @param componentsToAdd
 *            Array of {@link JComponent}s which will be added to the Bubble (null instead of
 *            the array won't throw an error)
 * @param arguments
 *            arguments to pass thought to the I18N Object
 */
protected BubbleWindow(final Window owner, final BubbleStyle style, final AlignedSide preferredAlignment,
		final String i18nKey, final String docKey, final Font titleFont, final Font bodyFont, final boolean moveable,
		final boolean showCloseButton, final JComponent[] componentsToAdd, final Object... arguments) {
	super(owner);

	// if this check fails, the bubbles will look very ugly, but we can't change that I guess
	GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
	GraphicsDevice gd = ge.getDefaultScreenDevice();
	isPerPixelTranslucencySupported = gd
			.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSLUCENT);
	if (!isPerPixelTranslucencySupported) {
		LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.tools.bubble.BubbleWindow.per_pixel_not_supported");
	}

	this.i18nKey = i18nKey;
	this.arguments = arguments;
	this.myPerspective = RapidMinerGUI.getMainFrame().getPerspectiveController().getModel()
			.getSelectedPerspective().getName();
	this.preferredAlignment = preferredAlignment;
	this.moveable = moveable;
	if (docKey != null) {
		this.docKey = docKey;
		dockable = desktop.getContext().getDockableByKey(docKey);
	}

	this.style = style;
	if (titleFont != null) {
		this.titleFont = titleFont;
	} else {
		this.titleFont = style.getTitleFont();
	}
	if (bodyFont != null) {
		this.bodyFont = bodyFont;
	} else {
		this.bodyFont = style.getBodyFont();
	}

	if (componentsToAdd == null) {
		componentsInBubble = new JComponent[] {};
	} else {
		componentsInBubble = componentsToAdd;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:74,代码来源:BubbleWindow.java


注:本文中的java.awt.GraphicsDevice.isWindowTranslucencySupported方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。