Results 1 to 2 of 2
  1. #1
    trishtren is offline Member
    Join Date
    Feb 2011
    Posts
    53
    Rep Power
    0

    Default Synth look and feel examples?

    Hey,
    Im not entirely new to java but i am trying to use the synth look and feel feature of swing.
    I have my application using an external xml file for the look and feel however i am struggling to find examples of how to use or declare the styles of different components.
    I tried googling around to see if there was some sort of list or structure to follow and so far all i have found is this which works:
    Java Code:
    <synth>
      <style id="default">
        <opaque value="true"/>
        <state>
          <color value="#404040" type="BACKGROUND"/>
        </state>
        <font name="Lucida" size="12"/>
      </style>
      <bind style="default" type="region" key=".*"/>
    
      <style id="textfield">
        <state>
          <color value="white" type="BACKGROUND"/>
        </state>
        <imagePainter method="textFieldBorder" path="Styles/images/textfieldborder.png" sourceInsets="5 6 6 7" paintCenter="false"/>
        <insets top="5" bottom="6" right="7" left="6"/>
      </style>
      <bind style="textfield" type="region" key="TextField"/>
    
    
       <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="Styles/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="Styles/images/button_press.png"
                       sourceInsets="10 10 10 10" />
        </state>
                
        <state value="MOUSE_OVER">    
          <imagePainter method="images/buttonBackground"
              path="Styles/button_over.png"
                     sourceInsets="10 10 10 10" />
        </state>
      </style>
      <bind style="button" type="region" key="Button"/>
    
     
    </synth>
    While this works, i am having a huge struggle to find examples of other keys like "Button", "Textfield" etc. I would like to style a custom menu bar and all other components but again like i said there seems to be very limited examples of which Key's refer to which components in the swing gui. Menubar as a key seems to crash my application as does a variety of other keys. Can anyone maybe send me a link or give me a hint as how to find the keys of all the components in swing?

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Moderator
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    9,918
    Rep Power
    16

    Default Re: Synth look and feel examples?

    Moved from New to Java

    db
    Why do they call it rush hour when nothing moves? - Robin Williams

Similar Threads

  1. Synth.allocate null pointer exception
    By stevonator in forum Java Applets
    Replies: 0
    Last Post: 04-25-2011, 11:21 AM
  2. Synth Look And Feel - Window Decorations
    By neptune692 in forum AWT / Swing
    Replies: 0
    Last Post: 01-15-2011, 12:51 AM
  3. Cant find src for SWT examples
    By F-Man in forum SWT / JFace
    Replies: 0
    Last Post: 10-16-2009, 02:35 AM
  4. Dialog Examples in SWT
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-02-2008, 07:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •