javax.swing.JWindow.setOpacity()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中javax.swing.JWindow.setOpacity()方法的一些代码示例,展示了JWindow.setOpacity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JWindow.setOpacity()方法的具体详情如下:
包路径:javax.swing.JWindow
类名称:JWindow
方法名:setOpacity

JWindow.setOpacity介绍

暂无

代码示例

代码示例来源:origin: chatty/chatty

/**
 * Sets the opacity of the window, if supported.
 * 
 * @param opacity 
 */
private void setOpacity(float opacity) {
  if (translucencySupported) {
    if (opacity < 0) {
      opacity = 0;
    }
    window.setOpacity(opacity);
  }
}

代码示例来源:origin: stackoverflow.com

mediaPlayerComponent = new EmbeddedMediaPlayerComponent() {
     @Override
     protected Window onGetOverlay() {
       final JWindow transparentWindow = new JWindow();
       // Set basic window opacity if required - the window system must support WindowTranslucency (i.e. PERPIXEL_TRANSLUCENT)!
       transparentWindow.setOpacity(0.8f);
       // White with transparent alpha channel - WindowTranslucency is required for translucency.
       transparentWindow.setBackground(new Color(1.0f, 1.0f, 1.0f, 0.0f));
       final JLabel superImposedLightweigtLabel = new JLabel("Hello, VLC.", JLabel.CENTER);
       superImposedLightweigtLabel.setOpaque(false);
       transparentWindow.getContentPane().add(superImposedLightweigtLabel);
       return transparentWindow;
     }
   ...
  }

代码示例来源:origin: stackoverflow.com

JWindow window = new JWindow();
window.setSize(300,200);
window.setOpacity(0.5f); //this will make the window half-transparent

代码示例来源:origin: stackoverflow.com

ImageIcon icon = new ImageIcon("images/ajax-loader.gif");
 JLabel label=new JLabel(icon);
 JWindow myJFrame=new JWindow();
 myJFrame.setLayout(new BorderLayout());
 myJFrame.add(label,BorderLayout.CENTER);
 myJFrame.setLocationRelativeTo(null);
 myJFrame.setOpacity(0.5f);
 myJFrame.setAlwaysOnTop(true);
 label.setOpaque(false);
 AWTUtilities.setWindowOpaque(myJFrame, false);
 myJFrame.pack();
 myJFrame.setVisible(true);

代码示例来源:origin: stackoverflow.com

JWindow subFrame = new JWindow();           
subFrame.setBounds(0, 0, 500, 500);
subFrame.setAlwaysOnTop(true);
subFrame.setOpacity(0.50f);
subFrame.setBackground(new Color(1.0f, 1.0f, 1.0f, 0.05f));

JButton button = new JButton("Hello");
button.setBounds(20, 180, 100, 40);

subFrame.getContentPane().setLayout(null);
subFrame.getContentPane().add(button);
subFrame.setVisible(true);

代码示例来源:origin: stackoverflow.com

window.add(but);
window.add(new JLabel(""), BorderLayout.SOUTH);
window.setOpacity(0.5f);
window.setBackground(new Color(0, 0, 0, 0));
window.setSize(new Dimension(200, 100));

相关文章