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


Java AWTUtilities类代码示例

本文整理汇总了Java中com.sun.awt.AWTUtilities的典型用法代码示例。如果您正苦于以下问题:Java AWTUtilities类的具体用法?Java AWTUtilities怎么用?Java AWTUtilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getGC

import com.sun.awt.AWTUtilities; //导入依赖的package包/类
private static GraphicsConfiguration getGC() {
    GraphicsConfiguration transparencyCapableGC =
            GraphicsEnvironment.getLocalGraphicsEnvironment()
                    .getDefaultScreenDevice().getDefaultConfiguration();
    if (!AWTUtilities.isTranslucencyCapable(transparencyCapableGC)) {
        transparencyCapableGC = null;

        GraphicsEnvironment env =
                GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] devices = env.getScreenDevices();

        for (int i = 0; i < devices.length && transparencyCapableGC == null; i++) {
            GraphicsConfiguration[] configs = devices[i].getConfigurations();
            for (int j = 0; j < configs.length && transparencyCapableGC == null; j++) {
                if (AWTUtilities.isTranslucencyCapable(configs[j])) {
                    transparencyCapableGC = configs[j];
                }
            }
        }
    }
    return transparencyCapableGC;
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:23,代码来源:bug6683775.java

示例2: 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

示例3: 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

示例4: 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

示例5: actionPerformed

import com.sun.awt.AWTUtilities; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e)
{
	// fade out
	for(float i=1.0f; i>=0;i-=0.05f)
	try{
		AWTUtilities.setWindowOpacity(this, i);
		Thread.sleep(50);
	}
	catch (Exception e2){
	}
	
	// dispose it
	if(timer != null)
		timer.stop();
	this.dispose();
}
 
开发者ID:JackJiang2011,项目名称:Swing9patch,代码行数:18,代码来源:Toast.java

示例6: 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

示例7: mouseReleased

import com.sun.awt.AWTUtilities; //导入依赖的package包/类
public void mouseReleased () {
	if (isDrawRect) {
		servoList.add (mouseX, mouseY);
		isDrawRect = false;
	}
	servoList.removeOut ();
	servoList.checkOut ();
	servoList.checkClash ();
	servoList.removeOut ();//////////////
	servoList.fixInRange ();
	servoList.CheckIdClash ();
	timeLine.isBeginMove = false;
	isMoveWindow = false;
	AWTUtilities.setWindowOpacity(frame, 1.0f);

	//    for (int i=0; i < servoList.list.size (); i++) {
	//        Servo servo = servoList.list.get(i);
	//        println ("++"+servo.getPx1()+" "+servo.getPx2()+" "+servo.getPy1()+" "+ servo.getPy2());
	//    }
	if (isMoveFace)
		isMoveFace = false;
}
 
开发者ID:DFRobot,项目名称:Visual-Servo-Controller,代码行数:23,代码来源:visual_servo_controller.java

示例8: 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

示例9: setupDragMode

import com.sun.awt.AWTUtilities; //导入依赖的package包/类
private void setupDragMode(JComponent f) {
    JDesktopPane p = getDesktopPane(f);
    Container parent = f.getParent();
    dragMode = DEFAULT_DRAG_MODE;
    if (p != null) {
        String mode = (String)p.getClientProperty("JDesktopPane.dragMode");
        Window window = SwingUtilities.getWindowAncestor(f);
        if (window != null && !AWTUtilities.isWindowOpaque(window)) {
            dragMode = DEFAULT_DRAG_MODE;
        } else if (mode != null && mode.equals("outline")) {
            dragMode = OUTLINE_DRAG_MODE;
        } else if (mode != null && mode.equals("faster")
                && f instanceof JInternalFrame
                && ((JInternalFrame)f).isOpaque() &&
                   (parent == null || parent.isOpaque())) {
            dragMode = FASTER_DRAG_MODE;
        } else {
            if (p.getDragMode() == JDesktopPane.OUTLINE_DRAG_MODE ) {
                dragMode = OUTLINE_DRAG_MODE;
            } else if ( p.getDragMode() == JDesktopPane.LIVE_DRAG_MODE
                    && f instanceof JInternalFrame
                    && ((JInternalFrame)f).isOpaque()) {
                dragMode = FASTER_DRAG_MODE;
            } else {
                dragMode = DEFAULT_DRAG_MODE;
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:DefaultDesktopManager.java

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: AlertifyWindow

import com.sun.awt.AWTUtilities; //导入依赖的package包/类
/**
 * Construct a new window.
 *
 * @param theme The theme to construct from.
 * @param config The alert config.
 */
public AlertifyWindow(AlertifyTheme theme, AlertifyConfig config) {
	AlertifyColorPair colors = theme.getColors(config.getType());

	if (colors == null) {
		throw new IllegalArgumentException("Theme does not have support for " + config.getType());
	}

	JLabel label = config.getLabel();

	Optional<Font> font = Optional.ofNullable(config.getFont());

	label.setFont(font.isPresent() ? font.get() : theme.getFont()); //checking null state to see which font to use
	label.setForeground(colors.getForeground());

	JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5));
	content.setBackground(colors.getBackground());

	// Configure the unique theme properties
	theme.configure(content);

	content.add(label);

	add(content);

	Dimension contentSize = content.getPreferredSize();

	actualWidth = Math.max(contentSize.width, 300);
	actualHeight = Math.max(contentSize.height, 64);

	setAlwaysOnTop(true);
	setPreferredSize(new Dimension(actualWidth, actualHeight));
	setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
	AWTUtilities.setWindowShape(this, new RoundRectangle2D.Double(0, 0, actualWidth, actualHeight, 4, 4));
}
 
开发者ID:nikkiii,项目名称:Alertify4J,代码行数:41,代码来源:AlertifyWindow.java


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