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


Java AWTUtilities.setWindowOpaque方法代码示例

本文整理汇总了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();
}
 
开发者ID:sxei,项目名称:myqq,代码行数:19,代码来源:Login.java

示例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();
}
 
开发者ID:Exslims,项目名称:MercuryTrade,代码行数:27,代码来源:PackTesting.java

示例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);
	}
 
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:20,代码来源:FloatableDialog.java

示例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);
	 

}
 
开发者ID:XYZWorks,项目名称:ELMSParent,代码行数:25,代码来源:Login.java

示例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();
    }
}
 
开发者ID:kciray8,项目名称:IronBrain,代码行数:23,代码来源:ScreenCapture.java

示例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);
    }
 
开发者ID:Exslims,项目名称:MercuryTrade,代码行数:32,代码来源:TestOpaque.java

示例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) {}
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PopupComponent.java

示例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);
	}
 
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:29,代码来源:Demo.java

示例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);
	}
 
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:16,代码来源:Toast.java

示例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 );
	}
}
 
开发者ID:DJVUpp,项目名称:Desktop,代码行数:32,代码来源:DefaultFloatingTabHandler.java

示例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);
}
 
开发者ID:Drusy,项目名称:freebox-v6-monitor,代码行数:29,代码来源:ErrorDialog.java

示例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);
}
 
开发者ID:Lanfei,项目名称:KTV,代码行数:14,代码来源:LoadingFrame.java

示例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);
}
 
开发者ID:TechnicPack,项目名称:LauncherUICore,代码行数:16,代码来源:LauncherDialog.java

示例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();
}
 
开发者ID:sebkur,项目名称:montemedia,代码行数:34,代码来源:JRecordingAreaFrame.java

示例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();}
}
 
开发者ID:twister,项目名称:twister.github.io,代码行数:12,代码来源:IntroScreen.java


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