Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make industry standard desktop Java applications? [closed]

I know how to create the basic controls in Swing, but coming to industry standard application development, I lack the skills to do them.

I am designing a small Java Swing application. Instead of creating a JFrame for each purpose, I would like to create controls, display them, hide them (whenever necessary), everything in just one window.

How can I do it? I am a beginner. Please point me to nice web resources on the conventional ways of doing desktop Java applications using Swing.

like image 486
Anand Avatar asked Oct 23 '09 11:10

Anand


2 Answers

I'm not sure where I read this (old article), but since I read it I use it in all commercial desktop applications I make.

First thing get NetBeans, it's the perfect IDE for Java UI design. The other Eclipse plugins are not as helpful nor powerful.

Here is how I do it.

In NetBeans, create a new Java project — let's call it MyComponents in this project — create all your components you want. The base of any component should be a JFrame or a JPanel. For this example we'll choose JPanel and call it mjPanel

Next in the Design view, drag and drop all the Swing components you want. Then from the Source view, make all the actions and logic.

Next, the most important step, right click your Java file, from Tools, choose Add to Palette, then in the dialog, choose where you want to put it, like say Swing Components Palette.

To finalize your component, from Build menu, choose Clean and Build, this will create you a Jar file in the project folder/dist.

From now on, in each project you want to use this component, just include the Jar file in your project classpath. Open the Swing Components Palette, and you will see your new component.

Like this:

like image 132
medopal Avatar answered Oct 17 '22 22:10

medopal


I suggest you use NetBeans and create a project using the "Swing Desktop Application" pre-existing template.

It will create the basic infrastructure for your app including a main window with a menu and status bar with a progress bar, about box, event handlers, etc, all pre-wired.

What's nice about it for example is that the progress bar is already configured to listen to any action task that you create, so by simply creating a new action task, you get a working progress bar that will run when the task executes, without having to code it.

For more info see here.

like image 28
JRL Avatar answered Oct 17 '22 20:10

JRL