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


Java JWindow.setAlwaysOnTop方法代码示例

本文整理汇总了Java中javax.swing.JWindow.setAlwaysOnTop方法的典型用法代码示例。如果您正苦于以下问题:Java JWindow.setAlwaysOnTop方法的具体用法?Java JWindow.setAlwaysOnTop怎么用?Java JWindow.setAlwaysOnTop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JWindow的用法示例。


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

示例1: WindowNotification

import javax.swing.JWindow; //导入方法依赖的package包/类
public WindowNotification() {
	m_window = new JWindow();
	m_window.setAlwaysOnTop(true);

	m_listener = new MouseAdapter() {
		@Override
		public void mouseClicked(MouseEvent e) {
			fireListeners(CLICKED);
			if (m_closeOnClick)
				removeFromManager();
		}
	};

	setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
	setPanel(new JPanel());
}
 
开发者ID:OwaNotifier,项目名称:owa-notifier,代码行数:17,代码来源:WindowNotification.java

示例2: start

import javax.swing.JWindow; //导入方法依赖的package包/类
/** Start the bot. */
public void start() {
    Toolkit tk = Toolkit.getDefaultToolkit();
    int xSize = ((int) tk.getScreenSize().getWidth());
    int ySize = ((int) tk.getScreenSize().getHeight());
    window = new JWindow();
    window.setSize(xSize, ySize);
    window.setOpacity(0.0f);
    window.setVisible(true);
    window.setAlwaysOnTop(true);
    window.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (clicks < _numberOfLocations) {
                location[clicks] = getLocation();
                window.setVisible(false);
                sleep();
                click();
                sleep();
                window.setVisible(true);
                sleep();
                clicks += 1;
            }
            if (clicks == _numberOfLocations) {
                window.setVisible(false);
                process();
            }
        }
    });
}
 
开发者ID:jenyeu,项目名称:clickbot,代码行数:31,代码来源:Bot.java

示例3: initializeSlider

import javax.swing.JWindow; //导入方法依赖的package包/类
private void initializeSlider(TopicMapGraphPanel gp) {
    int minValue = getMinValue(gp);
    int maxValue = getMaxValue(gp);
    int defaultValue = getDefaultValue(gp);
    
    if(defaultValue < minValue) defaultValue = minValue;
    if(defaultValue > maxValue) defaultValue = maxValue;

    slider = new SimpleSlider(SimpleSlider.HORIZONTAL, minValue, maxValue, defaultValue);
    sliderLabel = new SimpleLabel();
    sliderPopup = new JWindow();

    slider.setPreferredSize(new Dimension(120, 24));
    slider.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    
    sliderLabel.setFont(UIConstants.smallButtonLabelFont);
    sliderLabel.setPreferredSize(new Dimension(30, 24));
    sliderLabel.setHorizontalAlignment(SimpleLabel.CENTER);
    
    JPanel panel = new JPanel();
    panel.setBorder(new LineBorder(UIConstants.defaultBorderShadow));
    panel.setLayout(new BorderLayout(2,2));
    panel.add(slider, BorderLayout.CENTER);
    panel.add(sliderLabel, BorderLayout.EAST);

    sliderPopup.setLayout(new BorderLayout(2,2));
    sliderPopup.add(panel, BorderLayout.CENTER);
    sliderPopup.setSize(150, 24);

    // sliderPopup.addMouseListener(this);
    sliderPopup.setAlwaysOnTop(true);
    
    slider.addChangeListener(this);
    slider.addMouseListener(this);
}
 
开发者ID:wandora-team,项目名称:wandora,代码行数:36,代码来源:AbstractSliderTool.java

示例4: createWindow

import javax.swing.JWindow; //导入方法依赖的package包/类
/**
    * Creates the WindowGui
    * @param icon
    * @param head
    * @param body
    * @param posx
    * @param posy
    * @param backgroundcolor
    * @param headerColor
    * @param messageColor
    * @return
    */
   private static JWindow createWindow(Icon icon, String head, String body,
    int posx, int posy, Color backgroundcolor, Color headerColor, Color messageColor) {

final JWindow window = new JWindow();
JPanel windowpanel = new JPanel(new GridBagLayout());
windowpanel.setBackground(backgroundcolor);

AWTUtilities.setWindowShape(window, new RoundRectangle2D.Float(0, 0,
	WIDTH, HEIGHT, 20, 20));
AWTUtilities.setWindowOpaque(window, true);


JLabel text = new JLabel("<HTML>" + body + "</HTML>");
text.setForeground(messageColor);

JLabel header = new JLabel(head);
header.setForeground(headerColor);
header.setFont(new Font(header.getFont().getName(), Font.BOLD, header
	.getFont().getSize() + 2));

windowpanel.add(new JLabel(icon), new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));

windowpanel.add(header, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0));
windowpanel.add(text, new GridBagConstraints(1, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));

window.add(windowpanel);
window.setSize(WIDTH, HEIGHT);
window.setLocation(posx - (WIDTH+5), posy+5);
window.setAlwaysOnTop(true);

return window;
   }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:45,代码来源:RoarPanel.java

示例5: show

import javax.swing.JWindow; //导入方法依赖的package包/类
public void show() {
//        Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
//        if (focusOwner != null) focusRef = new WeakReference(focusOwner);
            
        owner = ownerRef == null ? null : ownerRef.get();
        ownerLocation = owner == null ? null : owner.getLocationOnScreen();
        
        window = new JWindow(owner);
        window.setType(Window.Type.POPUP);
        window.setAlwaysOnTop(false);
        window.setFocusable(true);
        window.setFocusableWindowState(true);
        window.setAutoRequestFocus(true);
        
        window.getContentPane().add(content);
        window.pack();
        
        if (popupAlign == -1) {
            window.setLocation(location.getLocation());
        } else {
            Dimension size = content.getSize();
            
            int x;
            switch (popupAlign) {
                case SwingConstants.EAST:
                case SwingConstants.NORTH_EAST:
                case SwingConstants.SOUTH_EAST:
                    x = location.x + location.width - size.width + 1;
                    break;
                default:
                    x = location.x + 1;
                    break;
            }
            
            int y;
            switch (popupAlign) {
                case SwingConstants.NORTH:
                case SwingConstants.NORTH_EAST:
                case SwingConstants.NORTH_WEST:
                    y = location.y - size.height + 1;
                    break;
                default:
                    y = location.y + location.height + 1;
                    break;
            }
            
            window.setLocation(x, y);
        }
        
        window.setVisible(true);
        
        Component defaultFocus = content.getFocusTraversalPolicy().getDefaultComponent(content);
        if (defaultFocus != null) defaultFocus.requestFocusInWindow();
        
        content.installListeners();
        
        if (listener != null) listener.popupShown();
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:59,代码来源:ProfilerPopup.java

示例6: createAndShowLoading

import javax.swing.JWindow; //导入方法依赖的package包/类
private static void createAndShowLoading(){
    // create loading welcome
    JWindow loading = new JWindow();
    loading.setAlwaysOnTop(true);
    
    // set backgroud
    loading.setBackground(new Color(0, 0, 0, 0));
    
    // set transparent content
    loading.setContentPane(new JPanel(){        
        @Override
        public void setOpaque(boolean isOpaque) {
            super.setOpaque(false); 
        }
        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            // get g2
            Graphics2D g2 = (Graphics2D)g.create();
            g2.setComposite(AlphaComposite.SrcOver.derive(0.0f));
            g2.setColor(getBackground());
            g2.fillRect(0, 0, getWidth(), getHeight());
        }          
    });
    
    JLabel mainLabel = null;
    // add the icon
    java.net.URL imgURL = WirelessLCDSystem.class.getResource("resource/welcome.png");
    if(null != imgURL){
        mainLabel = new JLabel(new ImageIcon(imgURL));
        loading.add(mainLabel);
    }
    
    // set the property location
    loading.setLocationRelativeTo(null);
    int x = loading.getLocation().x;
    int y = loading.getLocation().y;
    loading.setLocation(x-400, y-250);
    
    // pack and show
    loading.pack();
    // show 
    loading.setVisible(true);
    // use a thread to update the logo
    (new WelcomeLogo(loading, mainLabel)).execute();
}
 
开发者ID:smileboywtu,项目名称:EmbeddedMonitor,代码行数:47,代码来源:WirelessLCDSystem.java

示例7: menuFullScreenActionPerformed

import javax.swing.JWindow; //导入方法依赖的package包/类
private void menuFullScreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuFullScreenActionPerformed

    final AbstractEditor selectedEditor = this.tabPane.getCurrentEditor();
    if (selectedEditor != null) {
      final GraphicsConfiguration gconfig = this.getGraphicsConfiguration();
      if (gconfig != null) {
        final GraphicsDevice device = gconfig.getDevice();
        if (device.isFullScreenSupported()) {
          if (device.getFullScreenWindow() == null) {
            final JLabel label = new JLabel("Opened in full screen");
            final int tabIndex = this.tabPane.getSelectedIndex();
            this.tabPane.setComponentAt(tabIndex, label);
            final JWindow window = new JWindow(Main.getApplicationFrame());
            window.setAlwaysOnTop(true);
            window.setAutoRequestFocus(true);
            window.setContentPane(selectedEditor.getContainerToShow());

            endFullScreenIfActive();

            final KeyEventDispatcher fullScreenEscCatcher = new KeyEventDispatcher() {
              @Override
              public boolean dispatchKeyEvent(@Nonnull final KeyEvent e) {
                if (e.getID() == KeyEvent.KEY_PRESSED && (e.getKeyCode() == KeyEvent.VK_ESCAPE || e.getKeyCode() == KeyEvent.VK_F11)) {
                  endFullScreenIfActive();
                  return true;
                }
                return false;
              }
            };

            if (this.taskToEndFullScreen.compareAndSet(null, new Runnable() {
              @Override
              public void run() {
                try {
                  window.dispose();
                }
                finally {
                  tabPane.setComponentAt(tabIndex, selectedEditor.getContainerToShow());
                  device.setFullScreenWindow(null);
                  KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(fullScreenEscCatcher);
                }
              }
            })) {
              try {
                KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(fullScreenEscCatcher);
                device.setFullScreenWindow(window);
              }
              catch (Exception ex) {
                LOGGER.error("Can't turn on full screen", ex); //NOI18N
                endFullScreenIfActive();
                KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(fullScreenEscCatcher);
              }
            } else {
              LOGGER.error("Unexpected state, processor is not null!"); //NOI18N
            }
          } else {
            LOGGER.warn("Attempt to full screen device which already in full screen!"); //NOI18N
          }
        } else {
          LOGGER.warn("Device doesn's support full screen"); //NOI18N
          DialogProviderManager.getInstance().getDialogProvider().msgWarn(null, "The Device doesn't support full-screen mode!");
        }
      } else {
        LOGGER.warn("Can't find graphics config for the frame"); //NOI18N
      }
    }
  }
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:68,代码来源:MainFrame.java


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