Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: custom GUI (Synth XML file) Question

  1. #1
    Member
    Join Date
    Mar 2011
    Posts
    198
    My Mood
    Daring
    Thanks
    7
    Thanked 4 Times in 4 Posts

    Default 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:
    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:

    <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:

    <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):

    Untitled.jpg

    Now instead of using this code in the XML file:
    <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...


  2. #2
    Member
    Join Date
    Mar 2011
    Posts
    198
    My Mood
    Daring
    Thanks
    7
    Thanked 4 Times in 4 Posts

    Default Re: custom GUI (Synth XML file) Question

    hmm... nobody?

Similar Threads

  1. Replies: 0
    Last Post: November 16th, 2011, 08:29 AM
  2. Java IO File Reader Question???
    By liamShannon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 12th, 2011, 04:37 PM
  3. Creating New File types question.
    By GodspeedPR in forum Java Theory & Questions
    Replies: 1
    Last Post: July 1st, 2011, 10:05 AM
  4. File class theoretical question
    By Darqneez in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: June 23rd, 2011, 05:25 PM
  5. Java File IO question :confused:
    By byebyebye in forum File I/O & Other I/O Streams
    Replies: 9
    Last Post: August 17th, 2010, 07:45 AM