1 Attachment(s)
custom GUI (Synth XML file) Question
Ok i guess this is more of a question then a problem.
I have begun using a SYNTH look and feel method that reads a XML file and sets the design according to that.
method for setting look and feel of GUI:
Code :
private static void initLookAndFeel() {
SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
// SynthLookAndFeel load() method throws a checked exception
// (java.text.ParseException) so it must be handled
try {
lookAndFeel.load(gmeLogin.class.getResourceAsStream("synth.xml"), gmeLogin.class);
UIManager.setLookAndFeel(lookAndFeel);
}
catch (Exception e) {
e.printStackTrace();
}
}
Synth xml segment:
Code :
<style id="scrollbar">
<insets top="4" left="6" bottom="4" right="6"/>
<state>
<font name="Verdana" size="14"/>
<color value="#000000" type="BACKGROUND"/>
<color value="#ffa500" type="TEXT_FOREGROUND"/>
</state>
<imagePainter method="scrollbarBorder" path="images/panel.png"
sourceInsets="4 6 4 6" paintCenter="true"/>
</style>
<bind style="scrollbar" type="region" key="ScrollBar"/>
I guess my question is.. im setting the actual border of the JScrollBar here.. What about setting the Thumb and the arrow buttons.. what <state> would i have to add.. as buttons are classified like this:
Code :
<style id="button">
<!-- Shift the text one pixel when pressed -->
<property key="Button.textShiftOffset" type="integer" value="1"/>
<!-- set size of buttons -->
<insets top="15" left="20" bottom="15" right="20"/>
<state>
<imagePainter method="buttonBackground" path="images/button.png"
sourceInsets="10 10 10 10" />
<font name="Dialog" size="16"/>
<color type="TEXT_FOREGROUND" value="#FFFFFF"/>
</state>
<state value="PRESSED">
<imagePainter method="buttonBackground"
path="images/button_press.png"
sourceInsets="10 10 10 10" />
</state>
<state value="MOUSE_OVER">
<imagePainter method="buttonBackground"
path="images/button_over.png"
sourceInsets="10 10 10 10" />
</state>
</style>
<bind style="button" type="region" key="Button"/>
This is a picture of my current program (applet):
Attachment 872
Now instead of using this code in the XML file:
Code :
<imagePainter method="scrollbarBorder" path="images/panel.png"
What is the correct term for the thumb.. as i know Border in the method= will not obviously set the graphic..
Could somebody please refer me to a tutorial for the XML file synth look out available method lists or something similar etc..
Thanks.
Conclusion: I'd like to set a custom THUMB & arrow graphics for the JScrollBar ive already set the borders and so on of most of the program. Tutorial or general idea would be great
Thanks...
Re: custom GUI (Synth XML file) Question