Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #915 > unrolled thread

No Main Window

Started by"Peter Christensen" <peter.christensen@THRWHITE.remove-dii-this>
First post2011-04-27 15:30 +0000
Last post2011-04-27 15:30 +0000
Articles 5 — 3 participants

Back to article view | Back to comp.lang.java.gui


Contents

  No Main Window "Peter Christensen" <peter.christensen@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000
    Re: No Main Window "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000
      Re: No Main Window "Peter Christensen" <peter.christensen@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000
      Re: No Main Window "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000
        Re: No Main Window "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000

#915 — No Main Window

From"Peter Christensen" <peter.christensen@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
SubjectNo Main Window
Message-ID<45d1fbdd$0$49195$14726298@news.sunsite.dk>
  To: comp.lang.java.gui
Should this be a problem:

 My program can operate with several windows (maybe up to ten), and they 
basically all have the same status and functions. For example, a window can 
be closed, and from a window also other windows can be opened or closed. 
When the last window is closed, then the program will end. No window will 
have a special status, for example the first window, that was opened, can 
just be closed again, if just a new window has been opened first.

It's really important for me, that all windows have exactely the same 
status, and they will also have basically the same menues in practice. They 
will all be objects of the same subclass.

I don't think it will be a problem to implement, even though it might be a 
bit unusual. Is this correct?

Pete C

Ps. I will use the Java Swing GUI.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#916

From"Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
Message-ID<eqsv5m$iaa$1@registered.motzarella.org>
In reply to#915
  To: comp.lang.java.gui
Peter Christensen schrieb:
> It's really important for me, that all windows have exactely the same 
> status, and they will also have basically the same menues in practice. They 
> will all be objects of the same subclass.

Sure, they're all instances of JFrame.

> 
> I don't think it will be a problem to implement, even though it might be a 
> bit unusual. Is this correct?

It's not unusual. Firefox, Open-Office and AFAIK MS-Word are examples of 
applications that exit when you close the last open window.

And yes, it shouldn't be a big problem to implement this.

import java.awt.event.*;
import javax.swing.*;

public class Test {
     private ActionListener listener = new ActionListener() {
         public void actionPerformed( ActionEvent e ) {
             createAndShowGUI();
         }
     };

     private JMenuBar createMenuBar() {
         JMenuBar menuBar = new JMenuBar();
         JMenu menu = new JMenu("File");
         JMenu newMenu = new JMenu("New");

         JMenuItem item = new JMenuItem("Window");
         item.addActionListener(listener);
         newMenu.add(item);

         menu.add(newMenu);
         menuBar.add(menu);

         return menuBar;
     }

     public void createAndShowGUI() {
         JFrame frame = new JFrame("Test");
         frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
         frame.setJMenuBar( createMenuBar() );
         frame.setSize(400,400);
         frame.setVisible(true);
     }

     public static final void main( String args[] ) {
         SwingUtilities.invokeLater( new Runnable() {
             public void run() {
                 new Test().createAndShowGUI();
             }
         });
     }
}

Bye
Michael

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#920

From"Peter Christensen" <peter.christensen@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
Message-ID<45d242a1$0$90264$14726298@news.sunsite.dk>
In reply to#916
  To: comp.lang.java.gui
Thanks for the reply.

Rgds,
Pete C

"Michael Rauscher" <michlmann@gmx.de> skrev i en meddelelse 
news:eqsv5m$iaa$1@registered.motzarella.org...
> Peter Christensen schrieb:
>> It's really important for me, that all windows have exactely the same 
>> status, and they will also have basically the same menues in practice. 
>> They will all be objects of the same subclass.
>
> Sure, they're all instances of JFrame.
>
>>
>> I don't think it will be a problem to implement, even though it might be 
>> a bit unusual. Is this correct?
>
> It's not unusual. Firefox, Open-Office and AFAIK MS-Word are examples of 
> applications that exit when you close the last open window.
>
> And yes, it shouldn't be a big problem to implement this.
>
> import java.awt.event.*;
> import javax.swing.*;
>
> public class Test {
>     private ActionListener listener = new ActionListener() {
>         public void actionPerformed( ActionEvent e ) {
>             createAndShowGUI();
>         }
>     };
>
>     private JMenuBar createMenuBar() {
>         JMenuBar menuBar = new JMenuBar();
>         JMenu menu = new JMenu("File");
>         JMenu newMenu = new JMenu("New");
>
>         JMenuItem item = new JMenuItem("Window");
>         item.addActionListener(listener);
>         newMenu.add(item);
>
>         menu.add(newMenu);
>         menuBar.add(menu);
>
>         return menuBar;
>     }
>
>     public void createAndShowGUI() {
>         JFrame frame = new JFrame("Test");
>         frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
>         frame.setJMenuBar( createMenuBar() );
>         frame.setSize(400,400);
>         frame.setVisible(true);
>     }
>
>     public static final void main( String args[] ) {
>         SwingUtilities.invokeLater( new Runnable() {
>             public void run() {
>                 new Test().createAndShowGUI();
>             }
>         });
>     }
> }
>
> Bye
> Michael

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#921

From"tar" <tar@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
Message-ID<ymips8d8qc7.fsf@sevak.isi.edu>
In reply to#916
  To: comp.lang.java.gui
Michael Rauscher <michlmann@gmx.de> writes:
> > I don't think it will be a problem to implement, even though it might
> > be a bit unusual. Is this correct?
> 
> 
> It's not unusual. Firefox, Open-Office and AFAIK MS-Word are examples of
> applications that exit when you close the last open window.

This is actually platform-dependent.
On the Mac, applications don't generally exit when the last window is
closed.  Certainly MS-Word doesn't do that.  Safari doesn't, and neither
does Firefox.  I don't have Open-Office handy, so I can't test that.

-- 
Thomas A. Russ,  USC/Information Sciences Institute

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#925

From"Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
Message-ID<equile$mu9$1@registered.motzarella.org>
In reply to#921
  To: comp.lang.java.gui
Thomas A. Russ schrieb:
> Michael Rauscher <michlmann@gmx.de> writes:
>>> I don't think it will be a problem to implement, even though it might
>>> be a bit unusual. Is this correct?
>>
>> It's not unusual. Firefox, Open-Office and AFAIK MS-Word are examples of
>> applications that exit when you close the last open window.
> 
> This is actually platform-dependent.
> On the Mac, applications don't generally exit when the last window is
> closed.  Certainly MS-Word doesn't do that.  Safari doesn't, and neither
> does Firefox.  I don't have Open-Office handy, so I can't test that.

Thanks for clarifying.

Bye
Michael

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web