当前位置: 首页>>代码示例>>Java>>正文


Java WindowListener类代码示例

本文整理汇总了Java中java.awt.event.WindowListener的典型用法代码示例。如果您正苦于以下问题:Java WindowListener类的具体用法?Java WindowListener怎么用?Java WindowListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WindowListener类属于java.awt.event包,在下文中一共展示了WindowListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: open

import java.awt.event.WindowListener; //导入依赖的package包/类
public boolean open () {
    dd = new DialogDescriptor(panel, NbBundle.getMessage(RevisionPicker.class, "LBL_RevisionPickerDialog.title"), //NOI18N
            true, new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.netbeans.modules.git.ui.repository.RevisionPickerDialog"), null); //NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    updateDialogState();
    browserPanel.addPropertyChangeListener(this);
    Preferences prefs = GitModuleConfig.getDefault().getPreferences();
    WindowListener windowListener = new DialogBoundsPreserver(prefs, this.getClass().getName());
    dialog.addWindowListener(windowListener);
    windowListener.windowOpened(new WindowEvent(dialog, WindowEvent.WINDOW_OPENED));
    dialog.pack();
    updateSliders(prefs);
    dialog.setVisible(true);
    persistSliders(prefs);
    browserPanel.removePropertyChangeListener(this);
    return dd.getValue() == okButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:RevisionPicker.java

示例2: createDialog

import java.awt.event.WindowListener; //导入依赖的package包/类
private JDialog createDialog(Component parentComponent, String title,
        int style)
        throws HeadlessException {

    final JDialog dialog;

    Window window = JOptionPane.getWindowForComponent(parentComponent);
    if (window instanceof Frame) {
        dialog = new JDialog((Frame)window, title, true);
    } else {
        dialog = new JDialog((Dialog)window, title, true);
    }
    if (window instanceof SwingUtilities.SharedOwnerFrame) {
        WindowListener ownerShutdownListener =
                SwingUtilities.getSharedOwnerFrameShutdownListener();
        dialog.addWindowListener(ownerShutdownListener);
    }
    initDialog(dialog, style, parentComponent);
    return dialog;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:JOptionPane.java

示例3: Run

import java.awt.event.WindowListener; //导入依赖的package包/类
public Run(){//metodo costruttore del JFrame
    
       WindowListener li = new WindowAdapter(){ //creo listener per controllare la pressione del pulsante di chiusura
         @Override
         public void windowClosing(WindowEvent e){//se il pulsante "x" è premuto, esco
             
             System.exit(0);
         }  
      };
      
GArduino g =  new GArduino();//creo il JPanel GArduino

      this.addWindowListener(li);//aggiungo il listener al JFrame
      super.getContentPane().add(g);//aggiungo il JPanel al JFrame
      this.setTitle("GArduino Controller");//imposto il titolo della finestra
      super.setVisible(true);//imposto la visbilità
      super.setResizable(false);//imposto la non possibilità di modificare le dimensioni della finestra
      super.setSize(900,600);//imposto le dimensioni della finestra
      super.setLocationRelativeTo(null);
   
   }
 
开发者ID:hageok,项目名称:GArduino,代码行数:22,代码来源:Run.java

示例4: addCloseCallback

import java.awt.event.WindowListener; //导入依赖的package包/类
/**
 * Creates and registers a {@link WindowListener} to {@code parent} window, which causes
 * the {@code child} window to close when the {@code parent} window is closed.
 * 
 * @param parent
 *            the window whose closing will cause child to close as well.
 * @param child
 *            the window that will be closed when parent is closed.
 * @return the created listener
 */
public static WindowListener addCloseCallback( Window parent, Window child )
{
	return addCloseCallback(
		parent, () -> {
			// Dispatch closing event instead of calling dispose() directly,
			// so that event listeners are notified.
			child.dispatchEvent(
				new WindowEvent(
					child,
					WindowEvent.WINDOW_CLOSING
				)
			);
		}
	);
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:26,代码来源:SwingUIUtils.java

示例5: createFrame

import java.awt.event.WindowListener; //导入依赖的package包/类
/**
 * Create a frame for SwingSet2 to reside in if brought up
 * as an application.
 *
 * @param gc the gc
 * @return the j frame
 */
public static JFrame createFrame(GraphicsConfiguration gc) {
	JFrame frame = new JFrame(gc);
	if (numSSs == 0) {
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	} else {
		WindowListener l = new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				numSSs--;
				swingSets.remove(this);
			}
		};
		frame.addWindowListener(l);
	}
	
	//由Jack Jiang于2012-09-22加上,防止因JToolBar的大小而影响JFrame的prefereSize使得没法再缩小
	frame.setMinimumSize(new Dimension(100,100));
	return frame;
}
 
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:26,代码来源:SwingSet2.java

示例6: main

import java.awt.event.WindowListener; //导入依赖的package包/类
/**
 * Creates a JFrame with a JCalendarDemo inside and can be used for testing.
 * 
 * @param s
 *            The command line arguments
 */
public static void main(String[] s) {
	WindowListener l = new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	};

	JFrame frame = new JFrame("JCalendar Demo");
	frame.addWindowListener(l);

	JCalendarDemo demo = new JCalendarDemo();
	demo.init();
	frame.getContentPane().add(demo);
	frame.pack();
	frame.setBounds(200, 200,
			(int) frame.getPreferredSize().getWidth() + 40, (int) frame
					.getPreferredSize().getHeight() + 250);
	frame.setVisible(true);
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:26,代码来源:JCalendarDemo.java

示例7: wireComponent

import java.awt.event.WindowListener; //导入依赖的package包/类
@Override
protected void wireComponent(final ComponentContext context) {

	super.wireComponent(context);

	final Window window = (Window) context.getComponent();

	final MethodListenerProxy<WindowListener> windowListenerProxy = new MethodListenerProxy<WindowListener>(
			WindowListener.class, context.getActionListeners());

	final MethodListenerProxy<WindowFocusListener> windowFocusListenerProxy = new MethodListenerProxy<WindowFocusListener>(
			WindowFocusListener.class, context.getActionListeners());

	if (windowListenerProxy.hasListeningMethod()) {
		window.addWindowListener(windowListenerProxy.getProxy());
		LOGGER.debug("{}|Window.addWindowListener", context.getId());
	}

	if (windowFocusListenerProxy.hasListeningMethod()) {
		window.addWindowFocusListener(windowFocusListenerProxy.getProxy());
		LOGGER.debug("{}|Window.addWindowFocusListener", context.getId());
	}
}
 
开发者ID:kennycyb,项目名称:java-ui-factory,代码行数:24,代码来源:WindowFactory.java

示例8: main

import java.awt.event.WindowListener; //导入依赖的package包/类
public static void main(String[] argv) {
	JFrame f = new JFrame();
	f.setSize(600, 400);
	double[] values = new double[4];
	String[] names = new String[3];
	names[0] = "Item 1";
	values[0] = 0.00100000000;
	names[1] = "Very long Item 2";
	values[1] = 0.00200000;
	names[2] = "Item 3";
	values[2] = 0.00200000000;

	

	f.getContentPane().add(new HorizontalBarGraph(names, values, "Counts", "Stacked Horizontal Bar Graph Test"));

	WindowListener wndCloser = new WindowAdapter() {
	@Override
	public void windowClosing(WindowEvent e) {
	    System.exit(0);
	   }
	};
   f.addWindowListener(wndCloser);
   f.setVisible(true);
}
 
开发者ID:s-andrews,项目名称:BamQC,代码行数:26,代码来源:HorizontalBarGraph.java

示例9: main

import java.awt.event.WindowListener; //导入依赖的package包/类
/**
 * Creates a JFrame with a JCalendarDemo inside and can be used for testing.
 * 
 * @param s
 *            The command line arguments
 */
public static void main(String[] s) {
	WindowListener l = new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	};

	JFrame frame = new JFrame("JCalendar Demo");
	frame.addWindowListener(l);

	JCalendarDemo demo = new JCalendarDemo();
	demo.init();
	frame.getContentPane().add(demo);
	frame.pack();
	frame.setBounds(200, 200,
			(int) frame.getPreferredSize().getWidth() + 40, (int) frame
					.getPreferredSize().getHeight() + 250);
	frame.setVisible(true);
}
 
开发者ID:empeeoh,项目名称:JCalendar,代码行数:27,代码来源:JCalendarDemo.java

示例10: close

import java.awt.event.WindowListener; //导入依赖的package包/类
/**
 * Overridden close method to avoid memory leaks by Mikael Valot
 */
public boolean close(){
	if(super.close()){
		dockableHolder.dispose();
		dockableHolder.removeWindowFocusListener(this);
		WindowListener[] listeners = dockableHolder.getWindowListeners();
		for(int i=0;i<listeners.length;i++){
			dockableHolder.removeWindowListener(listeners[i]);
		}
		Lm.setParent(null);
		dockableHolder.removeAll();
		dockableHolder.getRootPane().removeAll();
		dockableHolder = null;
		return true;
	}
	else{
		return false;
	}
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:22,代码来源:JideApplicationWindow.java

示例11: createVncClientMainWindow

import java.awt.event.WindowListener; //导入依赖的package包/类
protected static Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title, WindowListener windowListener) {
    // Create AWT windows
    Frame frame = new Frame(title + " - RDP");

    // Use scrolling pane to support screens, which are larger than ours
    scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
    scroller.add(canvas);
    scroller.setSize(canvas.getWidth(), canvas.getHeight());

    frame.add(scroller);
    frame.pack();
    frame.setVisible(true);

    frame.addWindowListener(windowListener);

    return frame;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:18,代码来源:Client.java

示例12: main

import java.awt.event.WindowListener; //导入依赖的package包/类
public static void main(String args[]) {

CertUtil.init();

       GridProxyInit gpiFrame = new GridProxyInit(null, true);
gpiFrame.setRunAsApplication(true);
gpiFrame.saveProxy(true);

       WindowListener l = new WindowAdapter() {
	public void windowClosing(WindowEvent e) {
	    System.exit(0);
	}
    };

gpiFrame.addWindowListener(l);
gpiFrame.pack();
UITools.center(null, gpiFrame);
       gpiFrame.setVisible(true);
   }
 
开发者ID:NCIP,项目名称:cagrid-general,代码行数:20,代码来源:GridProxyInit.java

示例13: initVisualization

import java.awt.event.WindowListener; //导入依赖的package包/类
private static void initVisualization() {
    visualization = new Visualization();
    
    // Override default Exit Application listener -> enforce hide.
    for(WindowListener wl: visualization.getWindowListeners()) {
        visualization.removeWindowListener(wl);
    }
    visualization.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            dispose();
        }
        
    });
    
    visualization.setVisible(true);
}
 
开发者ID:ls-cwi,项目名称:eXamine,代码行数:19,代码来源:Modules.java

示例14: popupFrame

import java.awt.event.WindowListener; //导入依赖的package包/类
public static JFrame popupFrame(String title, String message, int width, int height, WindowListener listener) {
    Color bg = Color.WHITE;
    
    JFrame frame = new JFrame(title);
    JLabel label = new JLabel(message);
    label.setBackground(bg);
    label.setBorder(BorderFactory.createBevelBorder(1));
    label.setVerticalTextPosition(SwingConstants.TOP);
    label.setHorizontalTextPosition(SwingConstants.RIGHT);
    label.setOpaque(true);
    frame.add(label);
    frame.setBackground(bg);
    frame.setSize(width, height);
    frame.addWindowListener(listener);
    frame.show();
    return frame;
}
 
开发者ID:datagr4m,项目名称:org.datagr4m,代码行数:18,代码来源:PopupHelper.java

示例15: Main

import java.awt.event.WindowListener; //导入依赖的package包/类
/** Creates a new instance of Main */
public Main(String[] args) {
    camera = ViewerManager.getInstance().createPerspectiveCamera(new GlobeNavigator(null));
    
    WalkPerspectiveNavigationAdapter navigationAdapter = new WalkPerspectiveNavigationAdapter(camera);
    camera.getCanvas().addKeyListener(navigationAdapter);
    camera.getCanvas().addMouseListener(navigationAdapter);
    camera.getCanvas().addMouseMotionListener(navigationAdapter);
    camera.getCanvas().addMouseWheelListener(navigationAdapter);
    if (camera instanceof WindowListener)
        addWindowListener((WindowListener)camera);
    
    Component graphic_view = camera.getGraphicsView();
    graphic_view.setPreferredSize(new Dimension(800, 600));
    this.getContentPane().add(graphic_view, BorderLayout.CENTER);
    
    URL dataset = ApplicationUtils.extractDataset(args);
    universe.setDataSet(dataset);
    
    double [] vp = ApplicationUtils.extractViewpoint(args);
    if (vp != null) {
        camera.getNavigator().gotoViewpoint(vp[0], vp[1], vp[2], vp[3], vp[4]);
    }
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:25,代码来源:Main.java


注:本文中的java.awt.event.WindowListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。