1. Create a new project named untitled1
2. Create an application (file-> New-> Application)
3. Add a button in frame1.
4. Under the classes/untitled1directory, upload the Upload File (+down.gif={off.gif={on.gif, indicating the three statuses of the buttons respectively) and the demo. xml file.
The content in demo. XML is:
<Synth>
<Style id = "button">
<State>
<Imagepainter method = "buttonbackground" Path = "images/onon.gif"
Sourceinsets = "9 10 9 12" paintcenter = "true" stretch = "true"/>
<Insets Top = "9" Left = "10" Bottom = "9" Right = "12"/>
<Font name = "Aharoni" size = "16"/>
<Color type = "text_foreground" value = "# ffffff"/>
</State>
<State value = "mouse_over">
<Imagepainter method = "buttonbackground" Path = "images/1_down.gif"
Sourceinsets = "9 10 9 12" paintcenter = "true" stretch = "true"/>
<Insets Top = "9" Left = "10" Bottom = "9" Right = "12"/>
<Color type = "text_foreground" value = "# ffffff"/>
</State>
<State value = "pressed">
<Imagepainter method = "buttonbackground" Path = "images/1_off.gif"
Sourceinsets = "10 12 8 9" paintcenter = "true" stretch = "true"/>
<Insets Top = "10" Left = "12" Bottom = "8" Right = "9"/>
<Color type = "text_foreground" value = "# ffffff"/>
</State>
<Property key = "button. Margin" type = "insets" value = "0 0 0"/>
</Style>
<Bind style = "button" type = "region" Key = "button"/>
</Synth>
5. Add the following statement to the header of the application1.java file:
Import javax. Swing. plaf. synth. synthlookandfeel;
6. Modify the public void run () function as follows:
Public void run (){
Try {
// Add the following three statements
Synthlookandfeel synth = new synthlookandfeel ();
Synth. Load (application1.class. getresourceasstream ("demo. xml"), application1.class );
Uimanager. setlookandfeel (Synth );
/* Original statement
Uimanager. setlookandfeel (uimanager. getsystemlookandfeelclassname ());
*/
}
7. Compile and run the command to view the result.
8. The usage of other controls is similar.