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


Groups > comp.lang.java.programmer > #19052

Re: new Swing project

Received by 10.66.84.38 with SMTP id v6mr5544900pay.7.1349208516631; Tue, 02 Oct 2012 13:08:36 -0700 (PDT)
Received by 10.68.232.230 with SMTP id tr6mr763324pbc.16.1349208516613; Tue, 02 Oct 2012 13:08:36 -0700 (PDT)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!usenet.stanford.edu!kt20no7182760pbb.1!news-out.google.com!t10ni23601408pbh.0!nntp.google.com!kt20no7182759pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.programmer
Date Tue, 2 Oct 2012 13:08:36 -0700 (PDT)
In-Reply-To <506b0380$0$293$14726298@news.sunsite.dk>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
NNTP-Posting-Host 69.28.149.29
References <f199bd0c-834a-4e9a-9e52-7fdbde7f9447@googlegroups.com> <506b0380$0$293$14726298@news.sunsite.dk>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <061126a6-706e-49cd-a104-24e2c541ca36@googlegroups.com> (permalink)
Subject Re: new Swing project
From Lew <lewbloch@gmail.com>
Injection-Date Tue, 02 Oct 2012 20:08:36 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Lines 100
Xref csiph.com comp.lang.java.programmer:19052

Show key headers only | View raw


Arne Vajhøj wrote:
>bob smith wrote:
>> What is the easiest way to start a new Swing project in Eclipse?
> 
> You prefer to write the code yourself => plain Java project.
>
> You prefer GUI builder => install the plugin and then pick Swing project 
> type.

I have no evidence that this is the easiest way, but it's the way I first tried 
in response to this question:

- Open Eclipse.
- Menu: File New Project
- New project dialog: "Java Project" Next> (I have no Swing plugin)
- Project Name: "Whatever", "Use default location", Next> 
- Finish

Context-menu click on project in "Package Explorer" window
- "New"  >  "Class"
- Package: "com.example.whatever"
- Name: "Example"
- Check "public static void main(String[] args)" and "Generate comments"
- Finish

You get:

/**
 * Example.
 */
package com.example.whatever;

/**
 * Example.
 * 
 */
public class Example {

    /**
     * main.
     * 
     * @param args
     */
    public static void main(String[] args) {

    }

}

Then start adding Swingish stuff.

public class Example {
    private static final String TITLE="Example Swing App";

    static final Logger logger = Logger.getLogger(Example.class.getSimpleName());

    private final JFrame appWindow = new JFrame(TITLE);

    /**
     * Constructor.
     */
    public Example()
    {
        appWindow.pack();
    }

    /**
     * Run the screen.
     */
    public void run()
    {
        appWindow.setVisible(true);
    }

    /**
     * main.
     * 
     * @param args String array of arguments.
     */
    public static void main(String[] args) {
        logger.fine("main()");

        Runnable gui = new Runnable() 
        {
          @Override public void run()
          {
              new Example().run();
          }
        };
        SwingUtilities.invokeLater(gui);
    }

}

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

new Swing project bob smith <bob@coolfone.comze.com> - 2012-10-02 07:50 -0700
  Re: new Swing project Arne Vajhøj <arne@vajhoej.dk> - 2012-10-02 11:08 -0400
    Re: new Swing project bob smith <bob@coolfone.comze.com> - 2012-10-02 12:02 -0700
      Re: new Swing project Arne Vajhøj <arne@vajhoej.dk> - 2012-10-02 15:25 -0400
        Re: new Swing project bob smith <bob@coolfone.comze.com> - 2012-10-02 13:24 -0700
      Re: new Swing project Joerg Meier <joergmmeier@arcor.de> - 2012-10-02 21:33 +0200
    Re: new Swing project Lew <lewbloch@gmail.com> - 2012-10-02 13:08 -0700
  Re: new Swing project Roedy Green <see_website@mindprod.com.invalid> - 2012-10-03 16:03 -0700

csiph-web