 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bixio Guest
|
Posted: Wed Jan 28, 2004 2:49 pm Post subject: [newbie] Come utilizzare la "X"... |
|
|
Ho creato un'applicazione grafica utilizzando awt, ma la finestra non si
chide quando spingo la "X" (in alto a destra). Chi mi sa indicare il codice
opportuno perchè ciò avvenga?
Grazie
|
|
| Back to top |
|
 |
Dei Moni Guest
|
Posted: Wed Jan 28, 2004 3:42 pm Post subject: Re: [newbie] Come utilizzare la "X"... |
|
|
Bixio ha scritto (che occasione persa per usenet):
| Quote: | Ho creato un'applicazione grafica utilizzando awt, ma la finestra non si
chide quando spingo la "X" (in alto a destra). Chi mi sa indicare il
codice opportuno perchè ciò avvenga?
Grazie
|
A gli eventi? questi sconosciuti.
--
niuno.
["s.gue non lo leggo più, mi prende troppo ai coglioni." uncombed su idl]
|
|
| Back to top |
|
 |
Bixio Guest
|
Posted: Wed Jan 28, 2004 4:28 pm Post subject: Re: [newbie] Come utilizzare la "X"... |
|
|
| Quote: | A gli eventi? questi sconosciuti.
|
Grazie.
|
|
| Back to top |
|
 |
Dei Moni Guest
|
Posted: Wed Jan 28, 2004 4:46 pm Post subject: Re: [newbie] Come utilizzare la "X"... |
|
|
Bixio ha scritto (che occasione persa per usenet):
| Quote: | A gli eventi? questi sconosciuti.
Grazie.
|
Falso.
Cmq netBeans fa una cosa simile:
addWindowListener(new java.awt.event.WindowAdapter()
{
public void windowClosing(java.awt.event.WindowEvent evt)
{
exitForm(evt);
}
});
io di solito scelgo questa soluzione:
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Non saprei dirti quale sia la più elegante o la migliore, ma io preferisco
la seconda perchè quello che fa il gui-builder non sempre mi piace, anzi
quasi mai.
p.s.
API DOC:
"setDefaultCloseOperation
public void setDefaultCloseOperation(int operation)
Sets the operation that will happen by default when the user initiates a
"close" on this frame. You must specify one of the following choices:
DO_NOTHING_ON_CLOSE (defined in WindowConstants): Don't do anything; require
the program to handle the operation in the windowClosing method of a
registered WindowListener object.
HIDE_ON_CLOSE (defined in WindowConstants): Automatically hide the frame
after invoking any registered WindowListener objects.
DISPOSE_ON_CLOSE (defined in WindowConstants): Automatically hide and
dispose the frame after invoking any registered WindowListener objects.
EXIT_ON_CLOSE (defined in JFrame): Exit the application using the System
exit method. Use this only in applications.
The value is set to HIDE_ON_CLOSE by default.
Parameters:
operation - the operation which should be performed when the user closes the
frame
Throws:
IllegalArgumentException - if defaultCloseOperation value isn't one of the
above valid values
SecurityException - If EXIT_ON_CLOSE has been specified and the
SecurityManager will not allow the caller to invoke System.exit.
See Also:
Window.addWindowListener(java.awt.event.WindowListener),
getDefaultCloseOperation(), WindowConstants, Runtime.exit(int)"
--
niuno.
["s.gue non lo leggo più, mi prende troppo ai coglioni." uncombed su idl]
|
|
| Back to top |
|
 |
MarcoDuff Guest
|
Posted: Thu Jan 29, 2004 10:56 am Post subject: Re: [newbie] Come utilizzare la "X"... |
|
|
Rispondo a Dei Moni che in data 28/01/2004 alle 17:46 ha scritto:
| Quote: | Bixio ha scritto (che occasione persa per usenet):
A gli eventi? questi sconosciuti.
Grazie.
Falso.
|
Invece vere, in ogni caso devi gestire (in modo diretto o meno) eventi.
| Quote: | Cmq netBeans fa una cosa simile:
addWindowListener(new java.awt.event.WindowAdapter()
{
public void windowClosing(java.awt.event.WindowEvent evt)
{
exitForm(evt);
}
});
io di solito scelgo questa soluzione:
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
Peccato che quest'ultima si puo' usare per la JFrame e non per la Frame
(come chiesto nel post nativo (awt)).
[CUT]
| Quote: | p.s.
API DOC:
"setDefaultCloseOperation
[MEGACUT] |
P.S.
Prossima volta fai un link o una piccola citazione, non mettere tutta la
documentazione su un post!
--
Marco "Duff" Palermo
http://www.marcoduff.com/
|
|
| Back to top |
|
 |
Dei Moni Guest
|
Posted: Fri Jan 30, 2004 11:36 am Post subject: Re: [newbie] Come utilizzare la "X"... |
|
|
MarcoDuff ha scritto (che occasione persa per usenet):
| Quote: | Rispondo a Dei Moni che in data 28/01/2004 alle 17:46 ha scritto:
Bixio ha scritto (che occasione persa per usenet):
A gli eventi? questi sconosciuti.
Grazie.
Falso.
Invece vere, in ogni caso devi gestire (in modo diretto o meno) eventi.
|
Oddio, uno che non capisce nulla ma con stile, intendevo che è lui ad essere
un falso, per avere detto grazie senza aver capito: capito?
| Quote: | Peccato che quest'ultima si puo' usare per la JFrame e non per la Frame
(come chiesto nel post nativo (awt)).
|
Ah si, è vero c'è ancora chi usa awt
| Quote: | [CUT]
p.s.
API DOC:
"setDefaultCloseOperation
[MEGACUT]
P.S.
Prossima volta fai un link o una piccola citazione, non mettere tutta la
documentazione su un post!
|
La descrizione di un metodo è tutta la documentazione? cazzo!!
--
niuno.
["s.gue non lo leggo più, mi prende troppo ai coglioni." uncombed su idl]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|