本文整理汇总了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;
}
示例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);
}
}
}
示例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();
}
}
示例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);
}
示例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);
}
}
}
示例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:
}
}
}
示例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;
}
示例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 ());
}
});
}
示例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());
}
示例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;
}
示例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();
}
示例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);
}
示例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();
}
});
}
示例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);
}
示例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);
}