Results matching “paint”

Java Look-and-Feel with 'Synth'

I have been experimenting with developing a custom look-and-feel for a large-scale Java project that I am working on. The custom look-and-feel is in Synth, which loads an XML file defining the styles (and images) for each defined element. Essentially, it really acts like a skin on top of the existing Java Swing interface. Documentation on this is pretty scarce and not in-depth, and I have picked up a lot of inconsistencies and bugs on the way.

In theory, each component consists of different states, such as DEFAULT, MOUSE_OVER, DISABLED, PRESSED, FOCUSED, SELECTED, and ENABLED. (To use more than one state for a style, use the AND keyword between them.) Insets are defined to determine how much space is needed on each side of the element; sourceInsets are used to prevent the area from being stretched. The 'bind style' element is provided to set the defined style. (To determine the key, programmers need to look at Java documentation, which is appended to the end of this entry.) An example of a button element Synth style is below:

<style id="buttonStyle">

   <insets top="15" left="20" right="20" bottom="15"/>

   <state>

      <imagePainter method="buttonBackground" path="images/button.png" sourceInsets="10 10 10 10"/>

   </state>

</style>

<bind style="buttonStyle" type="region" key="button"/>


Another important note is that each Java Swing element may inherit attributes from other Java Swing elements. For example, a JList is also made up of a JLabel. This opens up several annoying inconsistencies that I have had to work through with little documentation. The more complex the Swing component, the more likely it inherits from several different Swing components, which will need to be restyled. A range of different components can also be used per component, depending on the state of the component. 

Another issue with Synth is that once you use it, you need to create a style for every element. Some of these are very in-depth and require a lot of graphical design work. So, if you just want to change all of your buttons to be a certain colour and theme, Synth is not for you. 

Overall, I like the idea of being able to change the visual aspect to suit the branding of the application and to avoid the use of the ugly Java themes. I've also created custom elements to take on their own brand, much like the way web developers do with CSS. For example, the 'wizard' areas of the application I am developing contain a different theme with a background colour, and the headings are the same style. I simply code the application to use this style when the Swing elements are set up.

In my opinion, there is a major problem with the use of Synth. Not so long ago and before CSS was used, websites suffered from the similar problem. The problem with Synth is that most programmers cannot create good graphics, and most graphical artists cannot program. This is one area where, I believe, Synth has failed. Because of this, there are very few good designs based on the Synth look-and-feel. The introduction of CSS for web development made creating good designs easily and without the need for programming and nesting tables. There are also several tools that enable web designs to be quickly implemented into CSS, and there's nothing similar in the world of Java. 
 
Another issue with Synth is the lack of documentation. There is limited documentation on the Java Sun website, and the documentation is incomplete. Resources that do exist and will provide some help with developing styles in Synth are listed below.
 

Synth Component Properties: http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/plaf/synth/doc-files/componentProperties.html

Synth File Format:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/plaf/synth/doc-files/synthFileFormat.html

Synth: The Region Class:
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/plaf/synth/Region.html

A Move to Bath

I'm on the start of my third week in my new position, and I'm living in Bath. I've got excellent views of the Royal Crescent and the park in front of it. I've finally almost finished moving in. This has got to be the most hectic summer ever, and it's one that has forced me into chaos. (And here, I thought, I could have a relaxing summer for once and go on picnics in the New Forest and take up my canvas and brushes for the first time since 2000 to balance out my creativity with my analytical/thinking worklife.) Instead, it's brought me job-hunting and house-hunting and a million other things between. Ugh. With one more week of summer left before it starts to get very cold, maybe I'll be able to take advantage of these views and paint! But, probably not. I have a lot to do.

Update: Goals

I am developing several web projects and teaching a course in Web Design. I am going to make time this spring and summer for some individual projects and long-term goals; I have several books on my shelf to read and paintings to paint.
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108

Archives

Recent Comments

  • jenn: Thank you. read more
  • Murge: Amazing post. read more
  • Herbert: good post. site read more
  • Frank Quake: Hey, This is great when you said that I had read more
  • Chappy: You mention peptides here? I have had first hand experience read more
  • jenn: Thanks! I love the work. I have got more recent read more
  • Fanakapan: Thanks for the write up. This was some of my read more
  • jenn: Yes.... but that's only for the islands. Mostar and Montenegro read more
  • jenn: Hello, the code is not mine to hand out. I'll read more
  • pantich: More info about the best day trips from Dubrovnik can read more
OpenID accepted here Learn more about OpenID