Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #19052
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2012-10-02 13:08 -0700 |
| References | <f199bd0c-834a-4e9a-9e52-7fdbde7f9447@googlegroups.com> <506b0380$0$293$14726298@news.sunsite.dk> |
| Message-ID | <061126a6-706e-49cd-a104-24e2c541ca36@googlegroups.com> (permalink) |
| Subject | Re: new Swing project |
| From | Lew <lewbloch@gmail.com> |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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