当前位置: 首页>>代码示例>>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;未经允许,请勿转载。