Improving Java Desktop Application to Web Based

Admittedly for a long time people had the wrong idea about java for desktop applications. They figured that the interface had to look unusual based solely on the way that book examples of desktop programs often looked. Fortunately things have changed quite a bit and people write entirely new applications that pop out of web browser but look like they’re desktop apps.

Abstract Window Toolkit

If someone knows that people will access an individual web based java applet programs solely from a specific operating system they can use the AWT. Doing so makes the forms look just like they would on the user’s native operating system. While AWT is platform independent, each group of java desktop applications written for it will allow themselves to window differently on different computers.

Drawing images inside of java for desktop applications using this toolkit is very easy. The paint command works straight from an abstract void:

public abstract void setPaint(Paint paint)

For that matter, people can use something similar to brush strokes with the setStroke system:

public abstract void setStroke(Stroke a)

There are even print options available for those users who will need them, but the PrintJob command in JPSE7 is often neglected. A useful option instead might be to allow users to take a screenshot. Since the AWT is already working with their operating system they can use the key commands they’re already familiar with in that respect. To set up a good image it might be useful to use the getGraphics system first:

public abstract Graphics getGraphics()

Those interested in collecting debugging data on the resolution would first want to find the dimensions of the page:

public abstract Dimension getPageDimension()

java desktop applications

Working with Swing or AWT

Professional programmers often develop modern web based java application material in Swing, and the Swing toolkit has mostly superseded the AWT widgets since way back in J2SE 1.2, but that doesn’t mean people should feel controlled by some administrative decisions. When Java 6 Update 12 came out it became possible to mix AWT and Swing components together without having any problems about the z-order. As long as users run recent runtimes nothing should be the matter.

See more Java code samples based on real assignments>>>