[Netbeans][JFrame] - preview diffrent than effect

Hi !

I'm using netbeans 5.5 on windows XP, im tring to write application that is base on JFrame form. Everything seems to be ok but when i looking at preview it is diffrent that effect (compiled application). I like preview because it's simple and compiled application has to many colors :( how to make it tha same as preview ?

Krystian.

[360 byte] By [krystiancza] at [2007-11-26 23:58:58]
# 1

I 'm new to Java and had the same issue, after a lot of research I did this.

Create a seperate class (which I named SetUI.class). In that class I created a public method that returns void with no parameters called SystemLook.

/**

* Public SystemLook Method

*/

public void SystemLook() {

/** setLookAndFeel */

try {

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

}

catch (Exception e) {

}

}

In the main method of my first JFrame form I instantiated a new instance of the public SetUI class which I called changeLook. Then, quite simply, invoke the public SystemLook method of the changeLook object.

SetUI changeLook = new SetUI();

changeLook.SystemLook();

Your Java Swing application will now look and feel like a native Win32/MFC app. :-)

That's the way I've done it. Hope this helps.

Message was edited by:

pud1974

pud1974a at 2007-7-11 15:47:22 > top of Java-index,Java Essentials,Java Programming...
# 2

If you put that block of code in the init of your form you won't have to explicitly call it. I have a private method that I add to subclasses of JFrame called _init() that handles this along with several other default behaviors that I usually want. _init() is called during construction of the object.

PS.

puckstopper31a at 2007-7-11 15:47:22 > top of Java-index,Java Essentials,Java Programming...
# 3
Hi ! Hey Man, that works !! Thank You so Much! i was playing with that 2 days ! One more time ! Tanks!Krystian.
krystiancza at 2007-7-11 15:47:22 > top of Java-index,Java Essentials,Java Programming...