Java 类javax.swing.JWindow 实例源码

项目:incubator-netbeans    文件:MorePropertySheetTest.java   
public void testSetNodesSurvivesMultipleAdd_RemoveNotifyCalls() throws Exception {
    final PropertySheet ps = new PropertySheet();
    Node n = new AbstractNode( Children.LEAF );
    JWindow window = new JWindow();
    ps.setNodes( new Node[] {n} );
    window.add( ps );
    window.remove( ps );
    window.add( ps );
    window.remove( ps );
    window.add( ps );
    window.remove( ps );
    window.setVisible(true);
    assertNotNull(ps.helperNodes);
    assertEquals("Helper nodes are still available even after several addNotify()/removeNotify() calls",
            ps.helperNodes[0], n);
}
项目:incubator-netbeans    文件:TooltipWindow.java   
public void show(Point location) {
    Rectangle screenBounds = null;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    for (GraphicsDevice device : gds) {
        GraphicsConfiguration gc = device.getDefaultConfiguration();
        screenBounds = gc.getBounds();
        if (screenBounds.contains(location)) {
            break;
        }
    }

    // showing the popup tooltip
    cp = new TooltipContentPanel(master.getTextComponent());

    Window w = SwingUtilities.windowForComponent(master.getTextComponent());
    contentWindow = new JWindow(w);
    contentWindow.add(cp);
    contentWindow.pack();
    Dimension dim = contentWindow.getSize();

    if (location.y + dim.height + SCREEN_BORDER > screenBounds.y + screenBounds.height) {
        dim.height = (screenBounds.y + screenBounds.height) - (location.y + SCREEN_BORDER);
    }
    if (location.x + dim.width + SCREEN_BORDER > screenBounds.x + screenBounds.width) {
        dim.width = (screenBounds.x + screenBounds.width) - (location.x + SCREEN_BORDER);
    }

    contentWindow.setSize(dim);

    contentWindow.setLocation(location.x, location.y - 1);  // slight visual adjustment
    contentWindow.setVisible(true);

    Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
    w.addWindowFocusListener(this);
    contentWindow.addWindowFocusListener(this);
}
项目:incubator-netbeans    文件:TooltipWindow.java   
public void show(Point location) {
    Rectangle screenBounds = null;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    for (GraphicsDevice device : gds) {
        GraphicsConfiguration gc = device.getDefaultConfiguration();
        screenBounds = gc.getBounds();
        if (screenBounds.contains(location)) {
            break;
        }
    }

    // showing the popup tooltip
    cp = new TooltipContentPanel(master.getTextComponent());
    Window w = SwingUtilities.windowForComponent(master.getTextComponent());
    contentWindow = new JWindow(w);
    contentWindow.add(cp);
    contentWindow.pack();
    Dimension dim = contentWindow.getSize();

    if (location.y + dim.height + SCREEN_BORDER > screenBounds.y + screenBounds.height) {
        dim.height = (screenBounds.y + screenBounds.height) - (location.y + SCREEN_BORDER);
    }
    if (location.x + dim.width + SCREEN_BORDER > screenBounds.x + screenBounds.width) {
        dim.width = (screenBounds.x + screenBounds.width) - (location.x + SCREEN_BORDER);
    }

    contentWindow.setSize(dim);

    contentWindow.setLocation(location.x, location.y - 1);  // slight visual adjustment
    contentWindow.setVisible(true);
    Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
    w.addWindowFocusListener(this);
    contentWindow.addWindowFocusListener(this);
}
项目:incubator-netbeans    文件:TooltipWindow.java   
public void show(Point location) {
    Rectangle screenBounds = null;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    for (GraphicsDevice device : gds) {
        GraphicsConfiguration gc = device.getDefaultConfiguration();
        screenBounds = gc.getBounds();
        if (screenBounds.contains(location)) {
            break;
        }
    }

    // showing the popup tooltip
    cp = new TooltipContentPanel(master.getTextComponent());

    Window w = SwingUtilities.windowForComponent(master.getTextComponent());
    contentWindow = new JWindow(w);
    contentWindow.add(cp);
    contentWindow.pack();
    Dimension dim = contentWindow.getSize();

    if (location.y + dim.height + SCREEN_BORDER > screenBounds.y + screenBounds.height) {
        dim.height = (screenBounds.y + screenBounds.height) - (location.y + SCREEN_BORDER);
    }
    if (location.x + dim.width + SCREEN_BORDER > screenBounds.x + screenBounds.width) {
        dim.width = (screenBounds.x + screenBounds.width) - (location.x + SCREEN_BORDER);
    }

    contentWindow.setSize(dim);

    contentWindow.setLocation(location.x, location.y - 1);  // slight visual adjustment
    contentWindow.setVisible(true);

    Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
    w.addWindowFocusListener(this);
    contentWindow.addWindowFocusListener(this);
}
项目:owa-notifier    文件:WindowNotification.java   
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());
}
项目:openjdk-jdk10    文件:JemmyExt.java   
public static int getJWindowCount() {
    return new QueueTool().invokeAndWait(new QueueTool.QueueAction<Integer>(null) {

        @Override
        public Integer launch() throws Exception {
            Window[] windows = Window.getWindows();
            int windowCount = 0;
            for (Window w : windows) {
                if (w.getClass().equals(JWindow.class)) {
                    windowCount++;
                }
            }
            return windowCount;
        }
    });
}
项目:openjdk-jdk10    文件:JemmyExt.java   
public static JWindow getJWindow(int index) {
    return new QueueTool().invokeAndWait(new QueueTool.QueueAction<JWindow>(null) {

        @Override
        public JWindow launch() throws Exception {
            Window[] windows = Window.getWindows();
            int windowIndex = 0;
            for (Window w : windows) {
                if (w.getClass().equals(JWindow.class)) {
                    if (windowIndex == index) {
                        return (JWindow) w;
                    }
                    windowIndex++;
                }
            }
            return null;
        }
    });
}
项目:openjdk9    文件:JemmyExt.java   
public static int getJWindowCount() {
    return new QueueTool().invokeAndWait(new QueueTool.QueueAction<Integer>(null) {

        @Override
        public Integer launch() throws Exception {
            Window[] windows = Window.getWindows();
            int windowCount = 0;
            for (Window w : windows) {
                if (w.getClass().equals(JWindow.class)) {
                    windowCount++;
                }
            }
            return windowCount;
        }
    });
}
项目:openjdk9    文件:JemmyExt.java   
public static JWindow getJWindow(int index) {
    return new QueueTool().invokeAndWait(new QueueTool.QueueAction<JWindow>(null) {

        @Override
        public JWindow launch() throws Exception {
            Window[] windows = Window.getWindows();
            int windowIndex = 0;
            for (Window w : windows) {
                if (w.getClass().equals(JWindow.class)) {
                    if (windowIndex == index) {
                        return (JWindow) w;
                    }
                    windowIndex++;
                }
            }
            return null;
        }
    });
}
项目:PhET    文件:KSUCreditsWindow.java   
public static JWindow show( Frame parent ) {
    final JWindow window = new KSUCreditsWindow( parent );
    SwingUtils.centerInParent( window );
    window.setVisible( true );

    /*
    *  Dispose of ksuCreditsWindow after N seconds.
    *  Take care to call dispose in the Swing thread.
    */
    Timer timer = new Timer( 4000, new ActionListener() {
        public void actionPerformed( ActionEvent e ) {
            if ( window.isDisplayable() ) {
                window.dispose();
            }
        }
    } );
    timer.setRepeats( false );
    timer.start();

    return window;
}
项目:PhET    文件:PhetJComponent.java   
public static void init( Window applicationWindow ) {


        if ( inited ) {
            throw new RuntimeException( "Multiple inits." );
        }

//        System.out.println( "Setting repaintManagerPhet." );
        RepaintManager.setCurrentManager( repaintManagerPhet );

        offscreen = new JWindow( applicationWindow ) {
            public void invalidate() {
            }

            public void paint( Graphics g ) {
            }
        };       //this seems to work.  I thought you might have needed a visible component, though (maybe for some JVM implementations?)
//        System.out.println( "offscreen.getOwner() = " + offscreen.getOwner() );

//        offscreen.getOwner().setVisible( true );
        offscreen.setSize( 0, 0 );
        offscreen.setVisible( true );
        offscreenContentPane.setOpaque( false );
        offscreen.setContentPane( offscreenContentPane );
        inited = true;
    }
项目:JavaAyo    文件:WindowNotification.java   
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());
}
项目:JavaAyo    文件:SequentialNotificationManager.java   
/**
 * Shows the notification
 * @param window window to show
 */
protected static void showNotification(final JWindow window) {
    try {
        sLock.lock();
        sWindows.addLast(window);
        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosed(WindowEvent e) {
                window.removeWindowListener(this);
                sWindowOpen = false;
                nextWindow();
            }
        });
        nextWindow();
    } finally {
        sLock.unlock();
    }
}
项目:JavaAyo    文件:SequentialNotificationManager.java   
/**
 * shows the next window on the stack
 */
private static void nextWindow() {
    try {
        sLock.lock();
        if(!sWindowOpen && sWindows.size() > 0) {
            sWindowOpen = true;
            final JWindow window = sWindows.removeFirst();
            Timer delayVisibleTimer = new Timer(DELAY, new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    final Timer t = (Timer) e.getSource();
                    t.stop();
                    window.setVisible(true);
                    window.getGlassPane().setVisible(true);

                }
            });
            delayVisibleTimer.start();
        }
    } finally {
        sLock.unlock();
    }
}
项目:LuoYing    文件:Jfx.java   
/**
 * 创建JWindow,该Window用于作为Jfx组件的容器,这个window始终覆盖在frame上。
 * @param ms
 * @param mainFrame
 * @param jfxRoot
 * @return 
 */
private static JWindow createJWindow(JFrame parent, final Pane jfxRoot) {
    JWindow jwin = new JWindow(parent);
    jwin.setLocationRelativeTo(null);
    jwin.setVisible(true);

    jfxPanel = new JFXPanel();
    jwin.getContentPane().add(jfxPanel);

    Platform.runLater(() -> {
        // 设置JFX主场景,并让JFX主界面变得透明,这样不会覆盖整个Canvas.
        jfxRoot.setBackground(Background.EMPTY);
        jfxPanel.setScene(new Scene(jfxRoot, Color.TRANSPARENT));
    });
    return jwin;
}
项目:theSemProject    文件:AutoSuggestor.java   
/**
 * Istanzia il suggeritore su un componente testo
 *
 * @param textComp finestra di testo su cui istanziare il suggeritore
 * @param mainWindow finestra principale
 * @param words lista di parole
 * @param popUpBackground colore dello sfondo
 * @param textColor colore del testo
 * @param suggestionFocusedColor colore del suggeritore
 * @param opacity indice di opacità
 */
public AutoSuggestor(JTextComponent textComp, Window mainWindow, List<String> words, Color popUpBackground, Color textColor, Color suggestionFocusedColor, float opacity) {
    this.textComp = textComp;
    this.suggestionsTextColor = textColor;
    this.container = mainWindow;
    this.suggestionFocusedColor = suggestionFocusedColor;
    this.textComp.getDocument().addDocumentListener(documentListener);

    setDictionary(words);

    typedWord = "";
    currentIndexOfSpace = 0;
    tW = 0;
    tH = 0;

    autoSuggestionPopUpWindow = new JWindow(mainWindow);
    autoSuggestionPopUpWindow.setOpacity(opacity);

    suggestionsPanel = new JPanel();
    suggestionsPanel.setLayout(new GridLayout(0, 1));
    suggestionsPanel.setBackground(popUpBackground);
    suggestionsPanel.setBorder(new LineBorder(Color.black));

    addKeyBindingToRequestFocusInPopUpWindow();
}
项目:beautyeye    文件:TranslucentPopupFactory.java   
/**
 * Frees any resources the <code>Popup</code> may be holding onto.
 */
protected void dispose()
{
    Component component = getComponent();
    Window window = SwingUtilities.getWindowAncestor(component);

    if (component instanceof JWindow)
    {
        ((Window) component).dispose();
        component = null;
    }
    // If our parent is a DefaultFrame, we need to dispose it, too.
    if (window instanceof DefaultFrame)
    {
        window.dispose();
    }
}
项目:JCommunique    文件:WindowNotification.java   
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());
}
项目:chatty    文件:AutoCompletion.java   
/**
 * Creates the window for the info popup. This should only be run once and
 * then reused, only changing the text and size.
 */
private void createInfoWindow() {
    infoWindow = new JWindow(SwingUtilities.getWindowAncestor(textField));
    infoLabel = new JLabel();
    infoWindow.add(infoLabel);
    JPanel contentPane = (JPanel) infoWindow.getContentPane();
    Border border = BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.GRAY),
            BorderFactory.createEmptyBorder(2, 4, 2, 4));
    contentPane.setBorder(border);
    contentPane.setBackground(HtmlColors.decode("#EEEEEE"));
    infoLabel.setFont(textField.getFont());

    /**
     * Hide the info popup if the textfield or containing window is changed
     * in any way.
     */
    containingWindow = SwingUtilities.getWindowAncestor(textField);
    if (containingWindow != null) {
        containingWindow.addComponentListener(componentListener);
    }
    textField.addComponentListener(componentListener);
}
项目:mindraider    文件:SplashScreen.java   
/**
 * Constructor.
 * 
 * @param parent
 * @param isApplet
 */
public SplashScreen(JFrame parent, boolean isApplet) {
    this.isApplet = isApplet;

    splashLabel = new JLabel(IconsRegistry.getImageIcon("splash.gif"));

    if (!isApplet) {
        splashScreen = new JWindow(parent);
        splashScreen.getContentPane().add(splashLabel);
        splashScreen.pack();
        Rectangle screenRect = parent.getGraphicsConfiguration()
                .getBounds();
        splashScreen
                .setLocation(screenRect.x + screenRect.width / 2
                        - splashScreen.getSize().width / 2, screenRect.y
                        + screenRect.height / 2
                        - splashScreen.getSize().height / 2);
    }
}
项目:mpcmaid    文件:MPCMaid.java   
public static void showSplash() {
    screen = new JWindow();
    final URL resource = MainFrame.class.getResource("mpcmaidlogo400_400.png");
    final JLabel label = new JLabel(new ImageIcon(resource));
    screen.getContentPane().add(label);
    screen.setLocationRelativeTo(null);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension labelSize = screen.getPreferredSize();
    screen
            .setLocation(screenSize.width / 2 - (labelSize.width / 2), screenSize.height / 2
                    - (labelSize.height / 2));
    screen.pack();
    screen.setVisible(true);
    label.repaint();
    screen.repaint();
}
项目:AppWoksUtils    文件:SyntheticaHelper.java   
protected static boolean checkIfMacInitWillFail() {

        // synthetica init fails on mac if there are already active windows
        Window awindow[];
        final int j = (awindow = Window.getWindows()).length;

        for (int i = 0; i < j; i++) {
            final Window window = awindow[i];

            final boolean flag = !(window instanceof JWindow) && !(window instanceof JFrame) && !(window instanceof JDialog);
            if (!window.getClass().getName().contains("Popup$HeavyWeightWindow") && !flag) {
                return true;
            }

        }
        return false;
    }
项目:Swing9patch    文件:CoolPopupFactory.java   
/**
 * Frees any resources the <code>Popup</code> may be holding onto.
 */
protected void dispose()
{
    Component component = getComponent();
    Window window = SwingUtilities.getWindowAncestor(component);

    if (component instanceof JWindow)
    {
        ((Window) component).dispose();
        component = null;
    }
    // If our parent is a DefaultFrame, we need to dispose it, too.
    if (window instanceof DefaultFrame)
    {
        window.dispose();
    }
}
项目:metasfresh    文件:CompiereColor.java   
/**
 *  Set Background of Window Content Pane
 *  @param win window
 *  @param cc adempiere color
 */
public static void setBackground (Window win, CompiereColor cc)
{
    if (win instanceof JDialog)
    {
        ((JPanel)((JDialog)win).getContentPane()).putClientProperty(AdempiereLookAndFeel.BACKGROUND, cc);
    //  ((JPanel)((JDialog)win).getContentPane()).setName("contentPane");
    }
    else if (win instanceof JFrame)
    {
        ((JPanel)((JFrame)win).getContentPane()).putClientProperty(AdempiereLookAndFeel.BACKGROUND, cc);
    //  ((JPanel)((JFrame)win).getContentPane()).setName("contentPane");
    }
    else if (win instanceof JWindow)
    {
        ((JPanel)((JWindow)win).getContentPane()).putClientProperty(AdempiereLookAndFeel.BACKGROUND, cc);
    //  ((JPanel)((JWindow)win).getContentPane()).setName("contentPane");
    }
}
项目:webanno    文件:WebAnno.java   
public static void main(String[] args) throws Exception
{
    Optional<JWindow> splash = LoadingSplashScreen
            .setupScreen(WebAnno.class.getResource("splash.png"));

    SpringApplicationBuilder builder = new SpringApplicationBuilder();
    // Signal that we may need the shutdown dialog
    builder.properties("running.from.commandline=true");
    init(builder);
    builder.sources(WebAnno.class);
    builder.listeners(event -> {
        if (event instanceof ApplicationReadyEvent
                || event instanceof ShutdownDialogAvailableEvent) {
            splash.ifPresent(it -> it.dispose());
        }
    });
    builder.run(args);
}
项目:sp16-ceg3120    文件:SplashScreen.java   
/** Construct a splash screen. */
public void showSplashScreen() {
    // create window, apply image
    JWindow window = new JWindow();
    ImageIcon icon = new ImageIcon("img/SQLizard.jpg");
    JLabel label = new JLabel(icon);

    window.add(label);

    Toolkit tk = Toolkit.getDefaultToolkit();
    int width = ((int) tk.getScreenSize().getWidth());
    int height = ((int) tk.getScreenSize().getHeight());

    window.setBounds((width / 2) - 440, (height / 2) - 245, 880, 495);
    window.setVisible(true);

    // provide splash screen loading effect
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    window.setVisible(false);
}
项目:SplashScreen    文件:SwingSplashScreen.java   
SwingSplashScreen(BufferedImage image, int width, int height) {
        window = new JWindow((Window) null);
        window.setBackground(new Color(0, 0, 0, 0));
        window.setSize(width, height);
        window.setLocationRelativeTo(null);

        // alwaysOnTop keeps the LWJGL2 Display window from popping up and it can't be triggered manually
//        window.setAlwaysOnTop(true);

        window.add(new Component() {

            private static final long serialVersionUID = 1717818903226627606L;

            @Override
            public void paint(Graphics g) {
                if (image != null) {
                    g.drawImage(image, 0, 0, width, height, null);
                }
                for (Overlay overlay : getOverlays()) {
                    overlay.render((Graphics2D) g);
                }
            }
        });

        window.setVisible(true);
    }
项目:ireport-fork    文件:ApplePopupFactory.java   
private static JWindow checkOutWindow() {
    if (windowPool != null) {
        if (!windowPool.isEmpty()) {
            for (Iterator<Reference<JWindow>> i=windowPool.iterator(); i.hasNext();) {
                Reference<JWindow> ref = i.next();
                JWindow win = ref.get();
                i.remove();
                if (win != null) {
                    assert !win.isShowing();
                    win.setBounds (0, 0, 1, 1);
                    win.getContentPane().removeAll();
                    win.setBackground (new java.awt.Color (255, 255, 255, 0));
                    return win;
                }
            }
        }
    }
    JWindow nue = APPLE_COCOA_HACK ? (JWindow) new HackedJWindow() : new JWindow();

    nue.setBackground (new java.awt.Color (255, 255, 255, 0));
    return nue;
}
项目:concurrent    文件:TranslucentPopupFactory.java   
/**
 * Frees any resources the <code>Popup</code> may be holding onto.
 */
protected void dispose()
{
    Component component = getComponent();
    Window window = SwingUtilities.getWindowAncestor(component);

    if (component instanceof JWindow)
    {
        ((Window) component).dispose();
        component = null;
    }
    // If our parent is a DefaultFrame, we need to dispose it, too.
    if (window instanceof DefaultFrame)
    {
        window.dispose();
    }
}
项目:polydes    文件:LinkReferenceChooser.java   
public LinkReferenceChooser(JWindow owner, Link link)
{
    super(owner != null ? owner : SW.get());
    setFocusable(true);
    setSize(WIDTH, HEIGHT);

    this.link = link;
    listeners = new ArrayList<ActionListener>();

    add(createContentPanel(), BorderLayout.CENTER);

    addWindowFocusListener(new WindowAdapter()
    {
        @Override
        public void windowLostFocus(WindowEvent e)
        {
            dispose();
        }
    });
}
项目:LVPDTool    文件:SplashScreen.java   
public static void splashInit() {
    JWindow window = new JWindow();
    java.net.URL imgURL = SplashScreen.class.getResource("resources/images/SplashScreen.png");
    window.getContentPane().add(
            new JLabel("", new ImageIcon(imgURL), SwingConstants.CENTER));
    window.setBounds(500, 150, 300, 200);
    window.setSize(500, 400);

    java.awt.Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); 
    window.setLocation(dim.width/2-window.getSize().width/2, dim.height/2-window.getSize().height/2);

    setupAudio();
    window.setVisible(true);

    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        System.out.println("Caught InterrupedException");
    }

    window.setVisible(false);
    window.dispose();
}
项目:fx-experience    文件:StandAloneApp.java   
@Override
public void init() {

  setLayout(new BorderLayout());

  // create javafx panel
  final JFXPanel javafxPanel = new JFXPanel();
  javafxPanel.setFocusable(false);
  javafxPanel.setOpaque(false);

  add(javafxPanel, BorderLayout.CENTER);

  JWindow fxKeyboard = new JWindow();
  fxKeyboard.setModalExclusionType(java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
  fxKeyboard.getContentPane().add(javafxPanel);
  fxKeyboard.setFocusable(false);
  fxKeyboard.setBackground(null);

  fxKeyboard.pack();
  fxKeyboard.setLocationByPlatform(true);

  // create JavaFX scene
  Platform.runLater(() -> createScene(javafxPanel));

}
项目:MesquiteCore    文件:MesquiteFileDialog.java   
public MesquiteFileDialog (MesquiteWindow f, String message, int type) {
    super(getFrame(f), message, type);
    if (type == FileDialog.LOAD &&  (MesquiteTrunk.isMacOS() || MesquiteTrunk.isMacOSX()) && MesquiteTrunk.getOSXVersion()>10){
        titleWindow = new JWindow(); 
        titleWindow.setSize(twWidth,twHeight);
        titleWindowLabel = new Label();
        titleWindowLabel.setBackground(ColorDistribution.veryLightYellow); //ColorTheme.getExtInterfaceBackground()); //ColorDistribution.veryLightGray
        titleWindow.add(titleWindowLabel);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        int v, h;
        h = (screenSize.width-twWidth)/2;
        v = 26;
        titleWindow.setLocation(h, v);
        titleWindowLabel.setText("  " + message);
    //  Color darkBlue = new Color((float)0.0, (float)0.0, (float)0.7);
        titleWindowLabel.setForeground(ColorDistribution.darkBlue); //ColorTheme.getExtInterfaceElement(true));

    }
    this.message = message;
    this.type = type;
    currentFileDialog = this;
    //mfdThread = new MFDThread(this);
    //mfdThread.start();
    MainThread.incrementSuppressWaitWindow();
}
项目:incubator-netbeans    文件:CustomPopupFactory.java   
@Override
protected void prepareResources() {
    window = new JWindow(SwingUtilities.getWindowAncestor(owner));
    window.setType(JWindow.Type.POPUP);
    window.getContentPane().add (contents);
    window.setLocation (new Point (x, y));
    window.pack();
    disableShadow(window);
}
项目:incubator-netbeans    文件:CustomPopupFactory.java   
private static void safeSetBackground(JWindow window, Color background) {
    GraphicsConfiguration gc = window.getGraphicsConfiguration();

    if (!gc.isTranslucencyCapable()) return; // PERPIXEL_TRANSLUCENT not supported
    if (gc.getDevice().getFullScreenWindow() == window) return; // fullscreen windows not supported

    window.setBackground(background);
}
项目:incubator-netbeans    文件:MsgTooltipWindow.java   
void show(Point location) {
    Rectangle screenBounds = null;
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    for (GraphicsDevice device : gds) {
        GraphicsConfiguration gc = device.getDefaultConfiguration();
        screenBounds = gc.getBounds();
        if (screenBounds.contains(location)) {
            break;
        }
    }

    // showing the popup tooltip
    cp = new TooltipContentPanel();
    Window w = SwingUtilities.windowForComponent(parent);
    contentWindow = new JWindow(w);
    contentWindow.add(cp);
    contentWindow.pack();
    Dimension dim = contentWindow.getSize();

    if (screenBounds.width + screenBounds.x - location.x < cp.longestLine) {
        // the whole window does fully not fit to the right
        // the x position where the window has to start to fully fit to the right
        int left = screenBounds.width + screenBounds.x - cp.longestLine;
        // the window should have x pos minimally at the screen's start
        location.x = Math.max(screenBounds.x, left);
    }

    if (location.y + dim.height + SCREEN_BORDER > screenBounds.y + screenBounds.height) {
        dim.height = (screenBounds.y + screenBounds.height) - (location.y + SCREEN_BORDER);
    }
    if (location.x + dim.width + SCREEN_BORDER > screenBounds.x + screenBounds.width) {
        dim.width = (screenBounds.x + screenBounds.width) - (location.x + SCREEN_BORDER);
    }

    contentWindow.setSize(dim);

    contentWindow.setLocation(location.x, location.y + 1);  // slight visual adjustment

    contentWindow.setVisible(true);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            cp.scrollRectToVisible(new Rectangle(1, 1));
        }
    });
    Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.KEY_EVENT_MASK);
    w.addWindowFocusListener(this);
    contentWindow.addWindowFocusListener(this);
    contentWindow.addKeyListener(this);
    w.addKeyListener(this);
}
项目:incubator-netbeans    文件:MultiSplitPaneTest.java   
protected void setUp() throws Exception {
    split = new MultiSplitPane();
    split.setDividerSize( DIVIDER_SIZE );

    testWindow = new JWindow();
    testWindow.setVisible( true );
    //testWindow.getContentPane().add( split );
}
项目:incubator-netbeans    文件:ProfilerTableHovers.java   
private static void safeSetBackground(JWindow window, Color background) {
    GraphicsConfiguration gc = window.getGraphicsConfiguration();

    if (!gc.isTranslucencyCapable()) return; // PERPIXEL_TRANSLUCENT not supported
    if (gc.getDevice().getFullScreenWindow() == window) return; // fullscreen windows not supported

    window.setBackground(background);
}
项目:marathonv5    文件:JSONOMapConfigTest.java   
public void findContainerNP() {
    List<List<String>> np = config.findContainerNP(Window.class);
    AssertJUnit.assertEquals(1, np.size());
    np = config.findContainerNP(JInternalFrame.class);
    AssertJUnit.assertEquals(1, np.size());
    np = config.findContainerNP(JWindow.class);
    AssertJUnit.assertEquals(2, np.size());
}
项目:marathonv5    文件:JSONOMapConfigTest.java   
public void findContainerNP() {
    List<List<String>> np = config.findContainerNP(Window.class);
    AssertJUnit.assertEquals(1, np.size());
    np = config.findContainerNP(JInternalFrame.class);
    AssertJUnit.assertEquals(1, np.size());
    np = config.findContainerNP(JWindow.class);
    AssertJUnit.assertEquals(2, np.size());
}