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


Java JWindow.dispose方法代碼示例

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


在下文中一共展示了JWindow.dispose方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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

示例2: splashInit

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

示例3: showSplashWindow

import javax.swing.JWindow; //導入方法依賴的package包/類
/**
 * <p>Displays a splash window for <code>duration</code> milliseconds displaying the specified <code>image</code>.
 * An optional <code>actionListener</code> can be attached to perform a function after the splash window has
 * closed. If null is specified then the default listener will be used.</p>
 * 
 * @param image
 *      - the image icon to display
 * @param duration
 *      - how long to show the window (milliseconds)
 * @param windowSize
 *      - the size of the window
 * @param frameOwner
 *      - the parent window or owner, null if none
 * @param actionListener
 *      - a custom actionListener to be performed after the splash window is closed
 */
public static void showSplashWindow(ImageIcon image, int duration, Dimension windowSize, Window frameOwner, ActionListener actionListener) {
        JLabel splashImage = new JLabel();
        splashImage.setHorizontalAlignment(JLabel.CENTER);
        splashImage.setOpaque(true);
        splashImage.setIcon(image);

        final JWindow window = new JWindow(frameOwner);
        window.add(splashImage, BorderLayout.CENTER);
        window.setSize(windowSize);
        splashImage.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
        UITool.center(window);
        window.setVisible(true);
        
        ActionListener defaultActionListener = new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                        window.setVisible(false);
                        window.dispose();
                }
        };
        
        Timer timer = new Timer(duration, defaultActionListener);
        if(actionListener != null) {
                timer.addActionListener(actionListener);
        }

        timer.setRepeats(false);
        timer.start();
}
 
開發者ID:george-haddad,項目名稱:CIMMYT,代碼行數:46,代碼來源:UITool.java

示例4: popupWindow

import javax.swing.JWindow; //導入方法依賴的package包/類
/**
    * Creates a popupwindow with specified items, displays it for given time,
    * and notifies its owner on closure
    * 
    * @param owner
    *            , the owner of this Panel
    * @param icon
    *            , the icon to display
    * @param head
    *            , the header
    * @param text
    *            , the message body
    * @param x
    *            , the x locaiton on screen
    * @param y
    *            , the y location on screen
    * @param duration
    *            , the display duration
    * @param backgroundcolor
    *            , the background color
    * @param headercolor
    *            , the headertext color
    * @param textcolor
    *            , the messagebody color
    */
   public static void popupWindow(final RoarDisplayType owner, Icon icon, String head, String text, int x, int y, int duration, Color backgroundcolor, Color headercolor, Color textcolor, final Action action) {

final JWindow window = createWindow(icon, head, text, x, y,backgroundcolor, headercolor, textcolor);
fadein(window);


final TimerTask closeTimer = new TimerTask() {
    @Override
    public void run() {
	if (window != null) {
	    owner.closingRoarPanel(window.getX(),window.getY());
	    window.dispose();   
	}
    }
};

Timer t = new Timer();
t.schedule(closeTimer, duration);

window.addMouseListener(new MouseAdapter() {
    @Override
    public void mousePressed(MouseEvent e) {
	action.actionPerformed(null);
	closeTimer.run();
    }
});
   }
 
開發者ID:visit,項目名稱:spark-svn-mirror,代碼行數:53,代碼來源:RoarPanel.java

示例5: checkInWindow

import javax.swing.JWindow; //導入方法依賴的package包/類
private static void checkInWindow (JWindow win) {
    if (!APPLE_COCOA_HACK) {
        win.dispose();
    }
    windowPool.add (new SoftReference<JWindow> (win));
}
 
開發者ID:JockiHendry,項目名稱:ireport-fork,代碼行數:7,代碼來源:ApplePopupFactory.java


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