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


Java WindowEvent類代碼示例

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


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

示例1: showDialog

import java.awt.event.WindowEvent; //導入依賴的package包/類
/**
 *  Show font selection dialog.
 *  @param parent Dialog's Parent component.
 *  @return OK_OPTION, CANCEL_OPTION or ERROR_OPTION
 *
 *  @see #OK_OPTION 
 *  @see #CANCEL_OPTION
 *  @see #ERROR_OPTION
 **/
public int showDialog(Component parent) {
    dialogResultValue = ERROR_OPTION;
    JDialog dialog = createDialog(parent);
    dialog.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            dialogResultValue = CANCEL_OPTION;
        }
    });

    dialog.setVisible(true);
    dialog.dispose();
    dialog = null;

    return dialogResultValue;
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:27,代碼來源:FontChooser.java

示例2: windowDeactivated

import java.awt.event.WindowEvent; //導入依賴的package包/類
@Override
public void windowDeactivated(WindowEvent e) {
    // proceed only if switching to external application
    if (e.getOppositeWindow() == null) {
        synchronized (rp) {
            if (task != null) {
                task.cancel();
            } else {
                task = rp.create(this);
            }
            LOG.fine("Window deactivated, preparing refresh task");
        }
        if (UILOG.isLoggable(Level.FINE)) {
            LogRecord r = new LogRecord(Level.FINE, "LOG_WINDOW_DEACTIVATED"); // NOI18N
            r.setResourceBundleName("org.netbeans.core.ui.warmup.Bundle"); // NOI18N
            r.setResourceBundle(NbBundle.getBundle(MenuWarmUpTask.class)); // NOI18N
            r.setLoggerName(UILOG.getName());
            UILOG.log(r);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:MenuWarmUpTask.java

示例3: loadComparisonPNG

import java.awt.event.WindowEvent; //導入依賴的package包/類
private void loadComparisonPNG( String fileName ) {
    try {
        BufferedImage image =
            javax.imageio.ImageIO.read(new File(fileName));
        JFrame f = new JFrame( "Comparison PNG" );
        ImagePanel ip = new ImagePanel( image );
        f.setResizable( false );
        f.getContentPane().add( ip );
        f.addWindowListener( new WindowAdapter() {
            public void windowClosing( WindowEvent e ) {
                ( (JFrame) e.getSource() ).dispose();
            }
        });
        f.pack();
        f.show();
    }
    catch ( Exception ex ) {
        fireChangeStatus( "ERROR: Failed to Load PNG File; See Stack Trace", true );
        ex.printStackTrace();
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:Font2DTest.java

示例4: VerifyEmail

import java.awt.event.WindowEvent; //導入依賴的package包/類
/**
   * Creates new form Submission_Login
   */
  public VerifyEmail() {
      client = new Client();
      boolean conCheck = client.connectServer();
      if(!conCheck) {
          dispose();
      }
      else {
          this.setVisible(true);
      }
addWindowListener(new WindowAdapter() {
	@Override
	public void windowClosing(WindowEvent e) {
		client.closeConnection();
	}
});
      initComponents();
      confirmVerifCodeButton.setEnabled(false);
      
  }
 
開發者ID:bufferhe4d,項目名稱:call-IDE,代碼行數:23,代碼來源:VerifyEmail.java

示例5: mostrarPantallaModificacionEmpresa

import java.awt.event.WindowEvent; //導入依賴的package包/類
public void mostrarPantallaModificacionEmpresa(Object object,String cuitEmpresa){
    DTOTipoImpuesto dtoTi = obtenerTipoImpuesto((int) object);
    if (dtoTi != null) {
        IUGestionarTipoImpuestoModificarEmpresa pantallaModificarEmpresa = new IUGestionarTipoImpuestoModificarEmpresa(cuitEmpresa);
        pantallaModificarEmpresa.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // Evito que se cierre al presionar x
        pantallaModificarEmpresa.setVisible(true); // La hago visible
        // Modifico la operación de cierre para volver a la pantalla principal
        pantallaModificarEmpresa.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        pantallaModificarEmpresa.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent ev) {
                iniciar();
            }
        });
        pantallaModificarEmpresa.setNombre_actual(dtoTi.getNombreDTOTipoImpuesto());
        pantallaModificarEmpresa.setTextfield_nombre(dtoTi.getNombreDTOTipoImpuesto());
        pantallaModificarEmpresa.setCheckbox_esEditable(dtoTi.isEsMontoEditableDTOTipoImpuesto());
        if (dtoTi.getFechaHoraInhabilitacionDTOTipoImpuesto() == null) {
            pantallaModificarEmpresa.setCheckbox_Habilitar(true);
        } else {
            pantallaModificarEmpresa.setCheckbox_Habilitar(false);
        }
    }
}
 
開發者ID:turing2017,項目名稱:Dise-o-2017,代碼行數:24,代碼來源:ControladorGestionarTipoImpuesto.java

示例6: processWindowEvent

import java.awt.event.WindowEvent; //導入依賴的package包/類
/**
 * Processes window events occurring on this component.
 * Hides the window or disposes of it, as specified by the setting
 * of the <code>defaultCloseOperation</code> property.
 *
 * @param  e  the window event
 * @see    #setDefaultCloseOperation
 * @see    java.awt.Window#processWindowEvent
 */
protected void processWindowEvent(final WindowEvent e) {
    super.processWindowEvent(e);

    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
        switch (defaultCloseOperation) {
            case HIDE_ON_CLOSE:
                setVisible(false);
                break;
            case DISPOSE_ON_CLOSE:
                dispose();
                break;
            case EXIT_ON_CLOSE:
                // This needs to match the checkExit call in
                // setDefaultCloseOperation
                System.exit(0);
                break;
            case DO_NOTHING_ON_CLOSE:
            default:
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:31,代碼來源:JFrame.java

示例7: createCancelDialog

import java.awt.event.WindowEvent; //導入依賴的package包/類
/**
 * Creates a modal dialog that will interrupt this thread, when the
 * cancel button is pressed.
 */
private JDialog createCancelDialog() {
    JDialog result;
    // create message dialog
    JOptionPane message = new JOptionPane(
        isAnimated() ? getAnimationPanel()
            : new Object[] {getStateCountLabel(), getTransitionCountLabel()},
        JOptionPane.PLAIN_MESSAGE);
    message.setOptions(new Object[] {getCancelButton()});
    result = message.createDialog(getFrame(), "Exploring state space");
    result.pack();
    result.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    result.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            ExploreThread.this.interrupt();
        }
    });
    result.setAlwaysOnTop(true);
    return result;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:25,代碼來源:ExploreAction.java

示例8: addNotify

import java.awt.event.WindowEvent; //導入依賴的package包/類
@Override
public void addNotify () {
    super.addNotify ();
    //show progress for initialize method
    final Window w = findWindowParent ();
    if (w != null) {
        w.addWindowListener (new WindowAdapter (){
            @Override
            public void windowOpened (WindowEvent e) {
                final WindowAdapter waa = this;
                setWaitingState (true);
                Utilities.startAsWorkerThread (PluginManagerUI.this,
                        new Runnable () {
                            @Override
                            public void run () {
                                try {
                                    initTask.waitFinished ();
                                    w.removeWindowListener (waa);
                                } finally {
                                    setWaitingState (false);
                                }
                            }
                        },
                        NbBundle.getMessage (PluginManagerUI.class, "UnitTab_InitAndCheckingForUpdates"),
                        Utilities.getTimeOfInitialization ());
            }
        });
    }
    HelpCtx.setHelpIDString (this, PluginManagerUI.class.getName ());
    tpTabs.addChangeListener (new ChangeListener () {
        @Override
        public void stateChanged (ChangeEvent evt) {
            HelpCtx.setHelpIDString (PluginManagerUI.this, getHelpCtx ().getHelpID ());
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:37,代碼來源:PluginManagerUI.java

示例9: init

import java.awt.event.WindowEvent; //導入依賴的package包/類
public final void init() {
    frame = new Frame();

    frame.add(this);
    frame.setMenuBar(null);
    frame.setPreferredSize(new Dimension(400, 400));
    frame.setVisible(true);

    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });

    frame.pack();

    onStart();

    thread = new Thread(this);
    thread.start();

    imageBuffer = createImage(getWidth(), getHeight());
}
 
開發者ID:implict-com,項目名稱:liin,代碼行數:24,代碼來源:Applet.java

示例10: initLayerManager

import java.awt.event.WindowEvent; //導入依賴的package包/類
protected void initLayerManager() {

		JFrame d = new JFrame();
		d.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				((JCheckBoxMenuItem)(XML_Menu.commandToMenuItemHash.get("layer_manager_cmd"))).setSelected(false);
			}
		});
		LayerManager lm;
		
		//use existing layer manager if it already exists
		if (layerManager != null) {
			lm = layerManager;
		} else {
			lm = new LayerManager();
		}
		
		lm.setLayerList( toLayerList(map.overlays) );
		lm.setMap(map);

		lm.setDialog(d);
		JScrollPane sp = new JScrollPane(lm);
		sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		d.setTitle("Layer Manager");
		d.setContentPane(sp);
//		d.getContentPane().add(sp);
		d.pack();
		d.setSize(new Dimension(lm.getPreferredSize().width+20,lm.getPreferredSize().height+55));
		d.setMaximumSize(new Dimension(400,300));

		d.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
		d.setLocationRelativeTo(frame);
		d.setState(Frame.NORMAL);
		d.setAlwaysOnTop(true);
		this.layerManager = lm;
		this.layerManagerDialog = d;	
	}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:38,代碼來源:MapApp.java

示例11: MainFrame

import java.awt.event.WindowEvent; //導入依賴的package包/類
/**
 * Create the frame.
 */
public MainFrame() {
	addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			exitApp();
		}
	});
	instance = this;
	projectData = new ProjectData();

	chooser.setFileFilter(filter);

	UpdateChecker.checkForUpdate();

	initialize();
}
 
開發者ID:DivergenceBot,項目名稱:UpdateBuilder,代碼行數:20,代碼來源:MainFrame.java

示例12: main

import java.awt.event.WindowEvent; //導入依賴的package包/類
public static void main(String[] args) {
	JFrame frame = new JFrame("Assignment 1 visualiser");
	Visualiser vis = new Visualiser(frame);
	if (args.length > 0) {
		vis.loadProblem(new File(args[0]));
		if (vis.hasProblem() && args.length >= 2) {
			vis.loadSolution(new File(args[1]));
		}
	}
	frame.setSize(700, 766);
	frame.setLocation(300, 100);
	frame.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}
	});
	frame.setVisible(true);
}
 
開發者ID:moment-of-peace,項目名稱:AI-RRT-Motion-Planning,代碼行數:19,代碼來源:Visualiser.java

示例13: main

import java.awt.event.WindowEvent; //導入依賴的package包/類
/**
 * @param args
 */
public static void main(String[] args) {
	
	
	final BitNymWallet bitwallet = new BitNymWallet();
	BitNymGui gui = new BitNymGui(bitwallet);
	gui.loadWalletListener();
	
	gui.setMinimumSize(new Dimension(800, 450));
	gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	gui.setVisible(true);
	gui.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			bitwallet.exit();
		}
	});

}
 
開發者ID:kit-tm,項目名稱:bitnym,代碼行數:22,代碼來源:MainClass.java

示例14: main

import java.awt.event.WindowEvent; //導入依賴的package包/類
public static void main(String[] args) {
    // just test this panel.
    CopyJob copyJob = new CopyJob();
    copyJob.setListFile(new File("/home/bioakimidis/ibm/readme.txt"));
    InitialImportFilePanel p = new InitialImportFilePanel(copyJob);

    JFrame f = new JFrame();
    f.add(p);
    f.pack();
    f.setLocation(100, 800);
    f.setSize(new Dimension(700, 500));
    f.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    });
    f.setVisible(true);

}
 
開發者ID:Hitachi-Data-Systems,項目名稱:Open-DM,代碼行數:20,代碼來源:InitialImportFilePanel.java

示例15: showJFreeChart

import java.awt.event.WindowEvent; //導入依賴的package包/類
public void showJFreeChart(int coordX, int coordY){
        //Mostrar el chart
        ChartPanel chartPanel = new ChartPanel(chart1);
        chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
        setContentPane(chartPanel);           
                
        this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);               
        
        addWindowListener(
        		new WindowAdapter(){
        		        public void WindowClosing (WindowEvent e){
                           System.out.println("No quiero cerrar la ventana !!!\n");
        		        }	
        		}
        );

        
        this.pack();
//        RefineryUtilities.centerFrameOnScreen(this);
        
        this.setLocation(coordX, coordY);
        
        this.setVisible(true);    	    	
    }
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:25,代碼來源:VisualizacionJfreechart.java


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