當前位置: 首頁>>代碼示例>>Java>>正文


Java JWindow類代碼示例

本文整理匯總了Java中javax.swing.JWindow的典型用法代碼示例。如果您正苦於以下問題:Java JWindow類的具體用法?Java JWindow怎麽用?Java JWindow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JWindow類屬於javax.swing包,在下文中一共展示了JWindow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testSetNodesSurvivesMultipleAdd_RemoveNotifyCalls

import javax.swing.JWindow; //導入依賴的package包/類
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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:MorePropertySheetTest.java

示例3: show

import javax.swing.JWindow; //導入依賴的package包/類
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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:38,代碼來源:TooltipWindow.java

示例4: show

import javax.swing.JWindow; //導入依賴的package包/類
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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:36,代碼來源:TooltipWindow.java

示例5: getJWindowCount

import javax.swing.JWindow; //導入依賴的package包/類
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;
        }
    });
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:JemmyExt.java

示例6: getJWindow

import javax.swing.JWindow; //導入依賴的package包/類
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;
        }
    });
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:JemmyExt.java

示例7: show

import javax.swing.JWindow; //導入依賴的package包/類
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;
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:22,代碼來源:KSUCreditsWindow.java

示例8: init

import javax.swing.JWindow; //導入依賴的package包/類
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;
    }
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:27,代碼來源:PhetJComponent.java

示例9: showNotification

import javax.swing.JWindow; //導入依賴的package包/類
/**
 * 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();
	}
}
 
開發者ID:cowthan,項目名稱:JavaAyo,代碼行數:22,代碼來源:SequentialNotificationManager.java

示例10: nextWindow

import javax.swing.JWindow; //導入依賴的package包/類
/**
 * 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();
	}
}
 
開發者ID:cowthan,項目名稱:JavaAyo,代碼行數:25,代碼來源:SequentialNotificationManager.java

示例11: createJWindow

import javax.swing.JWindow; //導入依賴的package包/類
/**
 * 創建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;
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:23,代碼來源:Jfx.java

示例12: AutoSuggestor

import javax.swing.JWindow; //導入依賴的package包/類
/**
 * 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();
}
 
開發者ID:fiohol,項目名稱:theSemProject,代碼行數:36,代碼來源:AutoSuggestor.java

示例13: dispose

import javax.swing.JWindow; //導入依賴的package包/類
/**
 * 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();
	}
}
 
開發者ID:JackJiang2011,項目名稱:beautyeye,代碼行數:20,代碼來源:TranslucentPopupFactory.java

示例14: createInfoWindow

import javax.swing.JWindow; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:chatty,項目名稱:chatty,代碼行數:27,代碼來源:AutoCompletion.java

示例15: SplashScreen

import javax.swing.JWindow; //導入依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:dvorka,項目名稱:mindraider,代碼行數:25,代碼來源:SplashScreen.java


注:本文中的javax.swing.JWindow類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。