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