本文整理汇总了Java中com.sun.awt.AWTUtilities.setWindowOpaque方法的典型用法代码示例。如果您正苦于以下问题:Java AWTUtilities.setWindowOpaque方法的具体用法?Java AWTUtilities.setWindowOpaque怎么用?Java AWTUtilities.setWindowOpaque使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.awt.AWTUtilities
的用法示例。
在下文中一共展示了AWTUtilities.setWindowOpaque方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
/**
* 初始化
*/
public void init()
{
MyTools.setWindowsMiddleShow(this,width,height);//设置窗体居中显示
new MyLabel(lbl登录, "../img/button/button_login", "png").addEvent();
new MyLabel(lbl最小化, "../img/button/login_minsize", "png").addEvent();
new MyLabel(lbl退出, "../img/button/login_exit", "png").addEvent();
new MyLabel(lbl多账号, "../img/button/login_duozhanghao", "png").addEvent();
new MyLabel(lbl设置, "../img/button/login_setting", "png").addEvent();
new MyLabel(lbl注册账号).addEvent();
initUserStatus();
AWTUtilities.setWindowOpaque(this, false);//设置窗体完全透明
addEvent();
this.setVisible(true);
main=new Main();
}
示例2: createAndShowGUI
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
private static void createAndShowGUI() {
System.setProperty("sun.java2d.noddraw","true");
final JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setMinimumSize(new Dimension(400,400));
frame.setMaximumSize(new Dimension(400,400));
frame.setLocationRelativeTo(null);
frame.setUndecorated(true);
frame.setAlwaysOnTop(true);
AWTUtilities.setWindowOpaque(frame,false);
frame.setLayout(new BoxLayout(frame.getContentPane(),BoxLayout.Y_AXIS));
JButton button = new JButton("test");
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
panel.setMaximumSize(new Dimension(Integer.MAX_VALUE,100));
panel.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER));
frame.add(panel);
frame.pack();
}
});
frame.add(button);
frame.setVisible(true);
frame.pack();
}
示例3: initGUI
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
protected void initGUI()
{
// set dialog full transparent
setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
// init gui
JPanel contentPane = new JPanel();
contentPane.setLayout(new BorderLayout(0, 0));
contentPane.setOpaque(false);
setContentPane(contentPane);
// others setup
this.setFocusable(false);
this.setFocusableWindowState(false);
// this.setAlwaysOnTop(true);
this.setVisible(false);
}
示例4: main
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
public static void main(String[] args) {
JFrame frame=new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.setBounds(500,500,500,375);
AWTUtilities.setWindowOpaque(frame, false);
//设置窗口完全透明
JPanel pane = new JPanel(){
public void paint(Graphics g){
super.paint(g);
g.setColor(Color.LIGHT_GRAY);
g.fill3DRect(10, 10, 100, 100, true);
}
};
frame.setContentPane(pane);
frame.setVisible(true);
}
示例5: ScreenCapture
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
public ScreenCapture(Consumer<BufferedImage> onGet) {
this.onGet = onGet;
try {
robot = new Robot();
setUndecorated(true);
setExtendedState(JFrame.MAXIMIZED_BOTH);
AWTUtilities.setWindowOpaque(this, false);
addMouseMotionListener(this);
setAlwaysOnTop(true);
new Timer(10, event -> onGlobalMouseMove()).start();
hideCursor();
rawImage = robot.createScreenCapture(new Rectangle(0, 0, screenSize.width, screenSize.height));
addMouseListener(this);
} catch (AWTException e) {
e.printStackTrace();
}
}
示例6: main
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
public static void main(String[] args) {
JDialog w = new JDialog();
w.setPreferredSize(new Dimension(100,200));
w.setUndecorated(true);
// w.setFocusableWindowState(false);
w.add(new JTextField("Test"));
// w.add(new JComponent() {
// /**
// * This will draw a black cross on screen.
// */
// protected void paintComponent(Graphics g) {
// g.setColor(Color.BLACK);
// g.fillRect(0, getHeight() / 2 - 10, getWidth(), 20);
// g.fillRect(getWidth() / 2 - 10, 0, 20, getHeight());
// }
//
// public Dimension getPreferredSize() {
// return new Dimension(100, 100);
// }
// });
w.pack();
w.setLocationRelativeTo(null);
w.setVisible(true);
w.setAlwaysOnTop(true);
/**
* This sets the background of the window to be transparent.
*/
AWTUtilities.setWindowOpaque(w, false);
// AWTUtilities.setWindowOpacity(w, 0.5f);
setTransparent(w);
}
示例7: fixFlickering
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
private static void fixFlickering(Window wnd, boolean opaque) {
try {
if (UIUtil.isUnderDarcula() && SystemInfo.isMac && Registry.is("darcula.fix.native.flickering") && wnd != null) {
AWTUtilities.setWindowOpaque(wnd, opaque);
}
} catch (Exception ignore) {}
}
示例8: showNewFrame
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
public void showNewFrame()
{
if(dialogForShowingPhoto == null)
{
dialogForShowingPhoto = new JDialog(
// bug of JDK1.7: can't repaint!
// SwingUtilities.getWindowAncestor(org.jb2011.ninepatch4j.demos.photoframe.Demo.this)
);
// set dialog full transparent
dialogForShowingPhoto.setUndecorated(true);
AWTUtilities.setWindowOpaque(dialogForShowingPhoto, false);
// contentPane default is opaque in Java1.7+
((JComponent)(dialogForShowingPhoto.getContentPane())).setOpaque(false);
dialogForShowingPhoto.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
dialogForShowingPhoto.setLocation(100,100);
// dialogForShowingPhoto.setLocationRelativeTo(null);
dialogForShowingPhoto.setAlwaysOnTop(true);//
}
dialogForShowingPhoto.setSize(Integer.parseInt(txtPhotoframeDialogWidth.getText().trim())
, Integer.parseInt(txtPhotoframeDialogHeight.getText().trim()));
// this.remove(panePhotoframe);
dialogForShowingPhoto.add(panePhotoframe);
dialogForShowingPhoto.setVisible(true);
btnHideTheFrame.setEnabled(true);
btnShowInFrame.setEnabled(false);
}
示例9: initGUI
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
protected void initGUI()
{
// set dialog full transparent
this.setAlwaysOnTop(true);
this.setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
// this.setBackground(new Color(0,0,0,0));
// contentPane default is opaque in Java1.7+
((JComponent)(this.getContentPane())).setOpaque(false);
this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
// init main layout
toastPane = new ToastPane();
this.add(toastPane);
}
示例10: onFloatingBegin
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
@SuppressWarnings( "serial" )
@Override
public void onFloatingBegin( Tab draggedTab , Point grabPoint )
{
initialize( draggedTab , grabPoint );
if( dragImage != null )
{
if( dragImageWindow == null )
{
dragImageWindow = new Window( null )
{
@Override
public void paint( Graphics g )
{
Graphics2D g2 = ( Graphics2D ) g;
if( dragImage != null )
{
g2.drawImage( dragImage , 0 , 0 , null );
}
}
};
AWTUtilities.setWindowOpaque( dragImageWindow , false );
}
dragImageWindow.setSize( dragImage.getWidth( null ) , dragImage.getHeight( null ) );
dragImageWindow.setAlwaysOnTop( true );
}
}
示例11: ErrorDialog
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
public ErrorDialog(JFrame parent) {
super(parent, true);
setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
setTitle("Freebox Error");
JLabel label = new JLabel("Freebox disconnected ...");
label.setForeground(Color.WHITE);
label.setFont(new Font(label.getFont().getFontName(), Font.PLAIN, 20));
BackgroundPanel panel = new BackgroundPanel(new GridBagLayout(), Res.getImage("img/bg.png").getImage());
panel.add(label);
panel.setPreferredSize(new Dimension(400, 300));
// the following two lines are only needed because there is no
// focusable component in here, and the "hit espace to close" requires
// the focus to be in the dialog. If you have a button, a textfield,
// or any focusable stuff, you don't need these lines.
panel.setFocusable(true);
panel.requestFocusInWindow();
getContentPane().add(panel);
DialogUtils.createDialogBackPanel(this, parent.getContentPane());
DialogUtils.addEscapeToCloseSupport(this, true);
}
示例12: LoadingFrame
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
public LoadingFrame() {
super("KTV����ϵͳ");
setSize(300, 300);
loadingFrame = this;
setUndecorated(true);
setAlwaysOnTop(true);
setLocationRelativeTo(null);
AWTUtilities.setWindowOpaque(this, false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setIconImage(new ImageIcon(this.getClass().getResource(
"/images/icon.png")).getImage());
setVisible(true);
}
示例13: LauncherDialog
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
public LauncherDialog(Frame owner) {
super(owner, null, true);
setUndecorated(true);
try {
AWTUtilities.setWindowOpaque(this, false);
getRootPane().setBorder(new DropShadowBorder(Color.black, 4));
} catch (IllegalArgumentException ex) {
//OS doesn't support translucent windows- dumb dumb dumb
//Eat it and just don't do the drop shadow
}
((JPanel)getContentPane()).setOpaque(true);
}
示例14: JRecordingAreaFrame
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
/** Creates new form JRecordingAreaFrame */
public JRecordingAreaFrame() {
// The following two lines must be executed before the window
// heavyweight component is created.
setAlwaysOnTop(true);
setUndecorated(true);
getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE);
setBackground(backgroundColor);
JContentPane cp = new JContentPane();
setContentPane(cp);
getRootPane().setOpaque(true);
cp.setOpaque(false);
AWTUtilities.setWindowOpaque(this, false);
initComponents();
infoLabel.addMouseListener(handler);
infoLabel.addMouseMotionListener(handler);
cp.addMouseListener(handler);
cp.addMouseMotionListener(handler);
//infoLabel.setBackground(new Color(0, true));
infoLabel.setOpaque(false);
infoPanel.setBorder(new EraseBorder(new Insets(8, 10, 8, 10)));
//infoLabel.setBackground(new Color(0x88000000, true));
infoLabel.setForeground(new Color(0xffffff));
closeButton.setOpaque(false);
setSize(600, 400);
updateLabel();
}
示例15: IntroScreen
import com.sun.awt.AWTUtilities; //导入方法依赖的package包/类
public IntroScreen(){
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds((int)(screenSize.getWidth()-640)/2,(int)(screenSize.getHeight()-480)/2,640,480);
setUndecorated(true);
setAlwaysOnTop(true);
try{if(AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT))
AWTUtilities.setWindowOpaque(this, false);
else if(AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.TRANSLUCENT))
AWTUtilities.setWindowOpacity(this, 0.7f);}
catch(Exception e){e.printStackTrace();}
}