微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java.awt.GraphicsDevice.WindowTranslucency的实例源码

项目:TypeTalk    文件Toastwindow.java   
private Toastwindow() {
   setUndecorated(true);
   GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
   GraphicsDevice gd = ge.getDefaultScreenDevice();
   if (gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
      setopacity(0.55f);
   }
   setSize(250,100);
   setShape(new RoundRectangle2D.Double(0,getWidth(),getHeight(),10,10));
   addComponentListener(new ComponentAdapter() {
      @Override
      public void componentResized(ComponentEvent e) {
      }
   });
   Toolkit toolkit = Toolkit.getDefaultToolkit();
   Dimension resolution = toolkit.getScreenSize();
   int x = (int) resolution.getWidth() - getWidth() - MARGIN;
   int y = MARGIN;
   setLocation(x,y);
   setBackground(new Color(0f,0f,1f / 2f));
   messageLabel = new JLabel();
   messageLabel.setForeground(Color.WHITE);
   messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
   add(messageLabel);
}
项目:speechless    文件Toastwindow.java   
private Toastwindow() {
   setUndecorated(true);
   GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
   GraphicsDevice gd = ge.getDefaultScreenDevice();
   if (gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
      setopacity(0.55f);
   }
   setSize(250,1f / 2f));
   messageLabel = new JLabel();
   messageLabel.setForeground(Color.WHITE);
   messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
   add(messageLabel);
}
项目:praisenter    文件GeneralPreferencesPanel.java   
@Override
public void itemStateChanged(ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED) {
        if (e.getSource() == this.cmbDevices) {
            // get the new value
            GraphicsDevice device = (GraphicsDevice)e.getItem();
            // test for translucency support
            if (!device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
                // if this device doesn't support translucency,then the translucent color/image backgrounds will not work
                this.lblTranslucency.setText(Messages.getString("panel.general.preferences.display.translucent.warning"));
                this.lblTranslucency.setIcon(Icons.WARNING);
            } else {
                this.lblTranslucency.setText("");
                this.lblTranslucency.setIcon(null);
            }
        }
    }
}
项目:jNotifyOSD    文件DesktopNotify.java   
private void setopacityProp() {
    if (gDevice.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
        setopacity(ev.getopacity());
    } else {
        if (NotifyConfig.getDebug()) {
            System.out.println(CLASS_NAME+": Your System don't support the Opacity feature.");
        }
    }
}
项目:jNotifyOSD    文件DesktopNotify.java   
private void setBorderType() {
    switch (ev.getBorder()) {
    case ROUNDED:
        if (gDevice.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT)) {
            addComponentListener(new ComponentAdapter() {
                    @Override
                    public void componentResized(ComponentEvent e) {
                        setShape(new RoundRectangle2D.Double(0,15,15));
                    }
                });
        } else {
            if (NotifyConfig.getDebug()) {
                System.out.println(CLASS_NAME+": Your System don't support this Border feature.");

            }
        }
        break;
    case RAISED:
        panel.setBorder(BorderFactory.createraisedBevelBorder());
        break;
    case ETCHED:
        panel.setBorder(BorderFactory.createEtchedBorder());
        break;
    default: // NONE
        // do nothing
    }
}
项目:jdk8u-jdk    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:openjdk-jdk10    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:openjdk9    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:jdk8u_jdk    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:infobip-open-jdk-8    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:jdk8u-dev-jdk    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:praisenter    文件GeneralPreferencesPanel.java   
@Override
public void actionPerformed(ActionEvent e) {
    String command = e.getActionCommand();
    if ("identify".equals(command)) {
        // implementation note:
        // we use jdialog here instead of JFrame because we don't want the task bar
        // to show focusable windows.  Using a jdialog allows it to part of the application
        // and not a separate window.
        int n = this.devices.length;
        // identify the devices
        jdialog[] dialogs = new jdialog[n];
        // create the frames
        for (int i = 0; i < n; i++) {
            // get the device
            GraphicsDevice device = this.devices[i];
            // create a frame for each device
            jdialog dialog = dialogs[i] = new jdialog(WindowUtilities.getParentwindow(this),"",ModalityType.MODELESS,WindowUtilities.getTranslucentConfiguration(device));
            // create a label for each device
            JLabel lblName = new JLabel(WindowUtilities.getDeviceName(device,i,Messages.getString("display.name.format")));
            lblName.setFont(new Font(lblName.getFont().getName(),Font.PLAIN,50));
            lblName.setHorizontalAlignment(SwingConstants.CENTER);
            // make sure the frame is sized and positioned correctly
            GraphicsConfiguration gc = device.getDefaultConfiguration();
            Rectangle r = gc.getBounds();
            dialog.setUndecorated(true);
            dialog.setFocusable(false);
            dialog.setLayout(new BorderLayout());
            dialog.add(lblName,BorderLayout.CENTER);
            dialog.setLocation(r.x,r.y);
            dialog.setMinimumSize(new Dimension(r.width,r.height));
            // enable translucency if available
            if (device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
                dialog.setBackground(new Color(0.0f,0.0f,0.0f));
            }
            dialog.setVisible(true);
        }
        // close the frames in a different thread
        DelayCloseWindowTask.execute(1000,dialogs);
    }
}
项目:praisenter    文件PresentationWindow.java   
/**
 * Returns the translucency support for this window.
 * @return {@link WindowTranslucency}
 */
protected WindowTranslucency getwindowTranslucency() {
    if (this.device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
        return WindowTranslucency.PERPIXEL_TRANSLUCENT;
    } else if (this.device.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
        return WindowTranslucency.TRANSLUCENT;
    } else if (this.device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSPARENT)) {
        return WindowTranslucency.PERPIXEL_TRANSPARENT;
    } else {
        return null;
    }
}
项目:jdk7-jdk    文件Ruler.java   
private static void checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    if (!gd.isWindowTranslucencySupported(arg)) {
        System.err.println("'" + arg
                + "' translucency mode isn't supported.");
        System.exit(-1);
    }
}
项目:jdk7-jdk    文件Ruler.java   
/**
 * @param args the command line arguments are ignored
 */
public static void main(String[] args) throws InterruptedException,InvocationTargetException {

    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            checkTranslucencyMode(WindowTranslucency.PERPIXEL_TRANSLUCENT);
            checkTranslucencyMode(WindowTranslucency.PERPIXEL_TRANSPARENT);

            Ruler ruler = new Ruler();
            ruler.setVisible(true);
        }
    });
}
项目:jdk7-jdk    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:openjdk-source-code-learn    文件Ruler.java   
private static void checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    if (!gd.isWindowTranslucencySupported(arg)) {
        System.err.println("'" + arg
                + "' translucency mode isn't supported.");
        System.exit(-1);
    }
}
项目:openjdk-source-code-learn    文件Ruler.java   
/**
 * @param args the command line arguments are ignored
 */
public static void main(String[] args) throws InterruptedException,InvocationTargetException {

    SwingUtilities.invokeAndWait(new Runnable() {

        public void run() {
            checkTranslucencyMode(WindowTranslucency.PERPIXEL_TRANSLUCENT);
            checkTranslucencyMode(WindowTranslucency.PERPIXEL_TRANSPARENT);

            Ruler ruler = new Ruler();
            ruler.setVisible(true);
        }
    });
}
项目:openjdk-source-code-learn    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:OLD-OpenJDK8    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:JAVA_UNIT    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:openjdk-jdk7u-jdk    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:openjdk-icedtea7    文件TranslucentShapedFrameTest.java   
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);
    }
}
项目:Openjsharp    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:jdk8u-jdk    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:openjdk-jdk10    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:openjdk9    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:jdk8u_jdk    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:lookaside_java-1.8.0-openjdk    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:infobip-open-jdk-8    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:jdk8u-dev-jdk    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:praisenter    文件SystemDialog.java   
/**
 * Full constructor.
 * @param owner the dialog owner
 */
private SystemDialog(Window owner) {
    super(owner,Messages.getString("dialog.system.title"),ModalityType.MODELESS);

    // build the property listing
    List<Pair<String,String>> properties = new ArrayList<Pair<String,String>>();

    properties.add(Pair.of(Messages.getString("dialog.system.praisenter.version"),Version.getVersion()));
    properties.add(Pair.of(Messages.getString("dialog.system.java"),SystemUtilities.getJavaVersion()));
    properties.add(Pair.of(Messages.getString("dialog.system.vendor"),SystemUtilities.getJavavendor()));
    properties.add(Pair.of(Messages.getString("dialog.system.javaPath"),SystemUtilities.getJavaHomeDirectory()));
    properties.add(Pair.of(Messages.getString("dialog.system.args"),SystemUtilities.getJvmArguments()));
    properties.add(Pair.of(Messages.getString("dialog.system.os"),SystemUtilities.getoperatingSystem()));
    properties.add(Pair.of(Messages.getString("dialog.system.architecture"),SystemUtilities.getArchitecture()));
    properties.add(Pair.of(Messages.getString("dialog.system.cpus"),String.valueOf(Runtime.getRuntime().availableProcessors())));
    properties.add(Pair.of(Messages.getString("dialog.system.locale"),Locale.getDefault().toString()));
    properties.add(Pair.of(Messages.getString("dialog.system.separator"),FileUtilities.getSeparator()));
    properties.add(Pair.of(Messages.getString("dialog.system.currentDirectory"),new File("").getAbsolutePath()));
    properties.add(Pair.of(Messages.getString("dialog.system.userPath"),SystemUtilities.getUserHomeDirectory()));
    properties.add(Pair.of(Messages.getString("dialog.system.basePath"),Constants.BASE_PATH));
    properties.add(Pair.of(Messages.getString("dialog.system.desktopSupport"),String.valueOf(Desktop.isDesktopSupported())));
    properties.add(Pair.of(Messages.getString("dialog.system.defaultDevice"),WindowUtilities.getDefaultDevice().getIDstring()));
    GraphicsDevice[] devices = WindowUtilities.getDevices();
    properties.add(Pair.of(Messages.getString("dialog.system.deviceCount"),String.valueOf(devices.length)));
    for (GraphicsDevice device : devices) {
        properties.add(Pair.of(messageformat.format(Messages.getString("dialog.system.translucencySupport"),device.getIDstring()),String.valueOf(device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT))));
    }
    properties.add(Pair.of(Messages.getString("dialog.system.laf"),UIManager.getLookAndFeel().getName()));
    properties.add(Pair.of(Messages.getString("dialog.system.debugEnabled"),String.valueOf(Main.isDebugEnabled())));

    // create the verse queue table
    @SuppressWarnings("serial")
    JTable tblProperties = new JTable(new SystemTableModel(properties)) {
        @Override
        public String getToolTipText(MouseEvent event) {
            Point p = event.getPoint();
            int row = this.rowAtPoint(p);
            if (row < 0) return super.getToolTipText();
            // since sorting is allowed,we need to translate the view row index
            // into the model row index
            row = this.convertRowIndexToModel(row);

            // get the text column value
            TableModel model = this.getModel();
            Object object = model.getValueAt(row,1);
            if (object != null) {
                // get the text
                return object.toString();
            }

            return super.getToolTipText(event);
        }
    };
    tblProperties.setautocreateRowSorter(true);
    tblProperties.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    tblProperties.setColumnSelectionAllowed(false);
    tblProperties.setCellSelectionEnabled(false);
    tblProperties.setRowSelectionAllowed(true);
    tblProperties.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    tblProperties.getColumnModel().getColumn(0).setPreferredWidth(150);
    tblProperties.getColumnModel().getColumn(1).setPreferredWidth(250);

    JScrollPane scrProperties = new JScrollPane(tblProperties);
    scrProperties.setBorder(null);

    // set the size
    this.setPreferredSize(new Dimension(550,400));

    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());
    container.add(scrProperties,BorderLayout.CENTER);

    this.pack();
}
项目:praisenter    文件PresentationWindow.java   
/**
 * Creates a new display window for the given device.
 * @param device the device
 * @param fullScreen true if the window should be full screen
 * @param overlay true if the window should always be on top of other windows
 */
public PresentationWindow(GraphicsDevice device,boolean fullScreen,boolean overlay) {
    super((Frame)null,"Praisenter Presentation Window",false,WindowUtilities.getTranslucentConfiguration(device));
    // simple assignments
    this.device = device;
    this.fullScreen = fullScreen;
    this.overlay = overlay;

    // setup the dialog
    this.setUndecorated(true);
    // don't allow focus to transfer to the dialog
    this.setAutoRequestFocus(false);
    this.setFocusable(false);
    this.setFocusableWindowState(false);
    this.setFocusTraversalKeysEnabled(false);

    WindowTranslucency translucency = this.getwindowTranslucency();
    if (translucency == WindowTranslucency.PERPIXEL_TRANSLUCENT) {
        // this is the best since all transitions will work
        this.setBackground(new Color(0,0));
        LOGGER.debug("Per-pixel translucency supported (best).");
    } else if (translucency == WindowTranslucency.TRANSLUCENT) {
        LOGGER.debug("Only uniform translucency supported.");
    } else if (translucency == WindowTranslucency.PERPIXEL_TRANSPARENT) {
        LOGGER.debug("Only per-pixel transparency supported (only shaped windows possible).");
    } else {
        LOGGER.debug("Translucency/Transparency not supported.");
    }

    // get the device's default config
    GraphicsConfiguration gc = this.device.getDefaultConfiguration();
    // get its position and dimensions
    Rectangle r = gc.getBounds();

    // set the dialog location to the top left corner of the
    // target display device
    this.setLocation(r.x,r.y);

    // a full screen display window has its size set to the
    // height and width of the device
    Dimension size = new Dimension(r.width,r.height);
    this.setMinimumSize(size);
    this.setPreferredSize(size);

    // setup the display surface
    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());

    this.surface = new PresentationSurface();
    this.surface.addPresentListener(this);
    this.addWindowListener(this.surface);

    if (Main.isDebugEnabled()) {
        this.surface.setBorder(BorderFactory.createLineBorder(Color.RED,10));
    }

    container.add(this.surface,BorderLayout.CENTER);

    this.setAlwaysOnTop(overlay);

    // make sure the panel is resized to fit the layout
    this.pack();
}
项目:arget    文件GraphicsUtils.java   
public static boolean isPerpixelTransparencySupported () {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT);
}
项目:OLD-OpenJDK8    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:magarena    文件ImageHelper.java   
public static boolean isWindowTranslucencySupported() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT);
}
项目:openjdk-jdk7u-jdk    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:openjdk-icedtea7    文件Ruler.java   
private static boolean checkTranslucencyMode(WindowTranslucency arg) {
    GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    return gd.isWindowTranslucencySupported(arg);
}
项目:praisenter    文件Transitions.java   
/**
 * Returns true if transitions are supported by the given device.
 * @param device the device
 * @return boolean
 */
public static final boolean isTransitionSupportAvailable(GraphicsDevice device) {
    return device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。