Article View: borland.public.jbuilder.java.swing
Article #11512How to Prevent multiple windows ??
From: Alfredo Mujica
Date: Sun, 16 May 1999 00:00
Date: Sun, 16 May 1999 00:00
25 lines
1397 bytes
1397 bytes
Hi,
Could someone provide me with sample code to prevent users from opening
or instatiating a window that is already open or instantiated??. Thanks
a lot!!
The code I am using now is as follows:
void jButton1_actionPerformed(ActionEvent e) {
StandOrdListFrame frame = new StandOrdListFrame();
boolean packFrame=false;
if (packFrame)
frame.pack();
else
frame.validate();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getPreferredSize();
if (frameSize.height > screenSize.height)
frameSize.height = screenSize.height;
if (frameSize.width > screenSize.width)
frameSize.width = screenSize.width;
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
}
Technical Details
Message-ID:
<373E29CA.FB88EB03@kcbbs.gen.nz>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,3b14337d4d5eaa54,start X-Google-Attributes: gid111d45,public From: Alfredo Mujica <alfredo@kcbbs.gen.nz> Subject: How to Prevent multiple windows ?? Date: 1999/05/16 Message-ID: <373E29CA.FB88EB03@kcbbs.gen.nz> X-Deja-AN: 478343405 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing