2 <html lang="en"> |
2 <html lang="en"> |
3 <head> |
3 <head> |
4 <meta charset="utf-8"/> |
4 <meta charset="utf-8"/> |
5 <title>Synth File Format</title> |
5 <title>Synth File Format</title> |
6 <!-- |
6 <!-- |
7 Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
7 Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
8 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9 |
9 |
10 This code is free software; you can redistribute it and/or modify it |
10 This code is free software; you can redistribute it and/or modify it |
11 under the terms of the GNU General Public License version 2 only, as |
11 under the terms of the GNU General Public License version 2 only, as |
12 published by the Free Software Foundation. Oracle designates this |
12 published by the Free Software Foundation. Oracle designates this |
43 } |
43 } |
44 </style> |
44 </style> |
45 </head> |
45 </head> |
46 |
46 |
47 <body> |
47 <body> |
48 <h2><a id="file">File Format</a></h2> |
48 <main role="main"> |
|
49 <h1><a id="file">File Format</a></h1> |
49 <p> |
50 <p> |
50 Synth's file format (<a href="synth.dtd">dtd</a>) |
51 Synth's file format (<a href="synth.dtd">dtd</a>) |
51 allows for specifying all the pieces |
52 allows for specifying all the pieces |
52 necessary to create your own look and feel. A synth file is |
53 necessary to create your own look and feel. A synth file is |
53 loaded by way of the <A |
54 loaded by way of the <A |
96 <p> |
97 <p> |
97 While the DTD for synth is specified, the parser is not validating. |
98 While the DTD for synth is specified, the parser is not validating. |
98 Parsing will fail only if a necessary attribute is not |
99 Parsing will fail only if a necessary attribute is not |
99 specified, or of the wrong type. |
100 specified, or of the wrong type. |
100 |
101 |
101 <h3>The synth element</h3> |
102 <h2>The synth element</h2> |
102 <div class="dtd-fragment"> |
103 <div class="dtd-fragment"> |
103 <pre class="dtd-fragment"> |
104 <pre class="dtd-fragment"> |
104 <!ELEMENT <a id="e.synth">synth</a> ((<a href="#ee.beansPersistance">%beansPersistance;</a>) | <a href="#e.style">style</a> | <a href="#e.bind">bind</a> | <a href="#e.font">font</a> | <a href="#e.color">color</a> | |
105 <!ELEMENT <a id="e.synth">synth</a> ((<a href="#ee.beansPersistance">%beansPersistance;</a>) | <a href="#e.style">style</a> | <a href="#e.bind">bind</a> | <a href="#e.font">font</a> | <a href="#e.color">color</a> | |
105 <a href="#e.imagePainter">imagePainter</a> | <a href="#e.imageIcon">imageIcon</a> | <a href="#e.defaultsProperty">defaultsProperty</a>)*> |
106 <a href="#e.imagePainter">imagePainter</a> | <a href="#e.imageIcon">imageIcon</a> | <a href="#e.defaultsProperty">defaultsProperty</a>)*> |
106 <!ATTLIST synth |
107 <!ATTLIST synth |
116 The <a href="#e.synth">synth</a> element contains all the other |
117 The <a href="#e.synth">synth</a> element contains all the other |
117 elements that make up a SynthLookAndFeel definition. |
118 elements that make up a SynthLookAndFeel definition. |
118 </p> |
119 </p> |
119 |
120 |
120 |
121 |
121 <h3>The style element</h3> |
122 <h2>The style element</h2> |
122 <div class="dtd-fragment"> |
123 <div class="dtd-fragment"> |
123 <pre class="dtd-fragment"> |
124 <pre class="dtd-fragment"> |
124 <!ELEMENT <a id="e.style">style</a> (<a href="#e.property">property</a> | <a href="#e.defaultsProperty">defaultsProperty</a> | <a href="#e.state">state</a> | <a href="#e.font">font</a> | <a href="#e.graphicsUtils">graphicsUtils</a> | |
125 <!ELEMENT <a id="e.style">style</a> (<a href="#e.property">property</a> | <a href="#e.defaultsProperty">defaultsProperty</a> | <a href="#e.state">state</a> | <a href="#e.font">font</a> | <a href="#e.graphicsUtils">graphicsUtils</a> | |
125 <a href="#e.insets">insets</a> | <a href="#e.painter">painter</a> | <a href="#e.imagePainter">imagePainter</a> | <a href="#e.opaque">opaque</a> | (<a href="#ee.beansPersistance">%beansPersistance;</a>) | |
126 <a href="#e.insets">insets</a> | <a href="#e.painter">painter</a> | <a href="#e.imagePainter">imagePainter</a> | <a href="#e.opaque">opaque</a> | (<a href="#ee.beansPersistance">%beansPersistance;</a>) | |
126 <a href="#e.imageIcon">imageIcon</a>)*> |
127 <a href="#e.imageIcon">imageIcon</a>)*> |
170 <font name="Dialog" size="14"/> |
171 <font name="Dialog" size="14"/> |
171 </style> |
172 </style> |
172 </pre> |
173 </pre> |
173 </div> |
174 </div> |
174 |
175 |
175 <h3>The state element</h3> |
176 <h2>The state element</h2> |
176 <div class="dtd-fragment"> |
177 <div class="dtd-fragment"> |
177 <pre class="dtd-fragment"> |
178 <pre class="dtd-fragment"> |
178 <!ELEMENT <a id="e.state">state</a> (<a href="#e.color">color</a> | <a href="#e.font">font</a> | <a href="#e.painter">painter</a> | <a href="#e.imagePainter">imagePainter</a> | (<a href="#ee.beansPersistance">%beansPersistance;</a>) | |
179 <!ELEMENT <a id="e.state">state</a> (<a href="#e.color">color</a> | <a href="#e.font">font</a> | <a href="#e.painter">painter</a> | <a href="#e.imagePainter">imagePainter</a> | (<a href="#ee.beansPersistance">%beansPersistance;</a>) | |
179 <a href="#e.property">property</a> | <a href="#e.imageIcon">imageIcon</a>)*> |
180 <a href="#e.property">property</a> | <a href="#e.imageIcon">imageIcon</a>)*> |
180 <!ATTLIST state |
181 <!ATTLIST state |
246 SELECTED. If the state of the Component |
247 SELECTED. If the state of the Component |
247 contains at least SELECTED and PRESSED, state <code>one</code> will be |
248 contains at least SELECTED and PRESSED, state <code>one</code> will be |
248 chosen, otherwise if the state is SELECTED, but not does not |
249 chosen, otherwise if the state is SELECTED, but not does not |
249 contain PRESSED, state <code>two</code> will be used. |
250 contain PRESSED, state <code>two</code> will be used. |
250 |
251 |
251 <h3>The font element</h3> |
252 <h2>The font element</h2> |
252 <div class="dtd-fragment"> |
253 <div class="dtd-fragment"> |
253 <pre class="dtd-fragment"> |
254 <pre class="dtd-fragment"> |
254 <!ELEMENT <a id="e.font">font</a> EMPTY> |
255 <!ELEMENT <a id="e.font">font</a> EMPTY> |
255 <!ATTLIST font |
256 <!ATTLIST font |
256 <a href="#font.id">id</a> ID #IMPLIED |
257 <a href="#font.id">id</a> ID #IMPLIED |
315 may run into sizing problems if you try to use a font with a |
316 may run into sizing problems if you try to use a font with a |
316 significantly different size for different states. |
317 significantly different size for different states. |
317 </p> |
318 </p> |
318 |
319 |
319 |
320 |
320 <h3>The color element</h3> |
321 <h2>The color element</h2> |
321 <div class="dtd-fragment"> |
322 <div class="dtd-fragment"> |
322 <pre class="dtd-fragment"> |
323 <pre class="dtd-fragment"> |
323 <!ELEMENT <a id="e.color">color</a> EMPTY> |
324 <!ELEMENT <a id="e.color">color</a> EMPTY> |
324 <!ATTLIST color |
325 <!ATTLIST color |
325 <a href="#color.id">id</a> ID #IMPLIED |
326 <a href="#color.id">id</a> ID #IMPLIED |
392 </state> |
393 </state> |
393 </style> |
394 </style> |
394 </pre> |
395 </pre> |
395 </div> |
396 </div> |
396 |
397 |
397 <h3>The property element</h3> |
398 <h2>The property element</h2> |
398 <div class="dtd-fragment"> |
399 <div class="dtd-fragment"> |
399 <pre class="dtd-fragment"> |
400 <pre class="dtd-fragment"> |
400 <!ELEMENT <a id="e.property">property</a> EMPTY> |
401 <!ELEMENT <a id="e.property">property</a> EMPTY> |
401 <!ATTLIST property |
402 <!ATTLIST property |
402 <a href="#property.key">key</a> CDATA #REQUIRED |
403 <a href="#property.key">key</a> CDATA #REQUIRED |
514 <p> |
515 <p> |
515 This value could then be asked by way of |
516 This value could then be asked by way of |
516 <code>UIManager.get("Table.focusCellForeground")</code>. |
517 <code>UIManager.get("Table.focusCellForeground")</code>. |
517 </p> |
518 </p> |
518 |
519 |
519 <h3>The graphicsUtils element</h3> |
520 <h2>The graphicsUtils element</h2> |
520 <div class="dtd-fragment"> |
521 <div class="dtd-fragment"> |
521 <pre class="dtd-fragment"> |
522 <pre class="dtd-fragment"> |
522 <!ELEMENT <a id="e.graphicsUtils">graphicsUtils</a> EMPTY> |
523 <!ELEMENT <a id="e.graphicsUtils">graphicsUtils</a> EMPTY> |
523 <!ATTLIST graphicsUtils |
524 <!ATTLIST graphicsUtils |
524 <a href="#graphicsUtils.idref">idref</a> IDREF #REQUIRED |
525 <a href="#graphicsUtils.idref">idref</a> IDREF #REQUIRED |
546 <graphicsUtils idref="graphics"/> |
547 <graphicsUtils idref="graphics"/> |
547 </style> |
548 </style> |
548 </pre> |
549 </pre> |
549 </div> |
550 </div> |
550 |
551 |
551 <h3>The insets element</h3> |
552 <h2>The insets element</h2> |
552 <div class="dtd-fragment"> |
553 <div class="dtd-fragment"> |
553 <pre class="dtd-fragment"> |
554 <pre class="dtd-fragment"> |
554 <!ELEMENT <a id="e.insets">insets</a> EMPTY> |
555 <!ELEMENT <a id="e.insets">insets</a> EMPTY> |
555 <!ATTLIST insets |
556 <!ATTLIST insets |
556 <a href="#insets.id">id</a> ID #IMPLIED |
557 <a href="#insets.id">id</a> ID #IMPLIED |
590 <insets top="1" bottom="2" left="3"/> |
591 <insets top="1" bottom="2" left="3"/> |
591 </style> |
592 </style> |
592 </pre> |
593 </pre> |
593 </div> |
594 </div> |
594 |
595 |
595 <h3>The bind element</h3> |
596 <h2>The bind element</h2> |
596 <div class="dtd-fragment"> |
597 <div class="dtd-fragment"> |
597 <pre class="dtd-fragment"> |
598 <pre class="dtd-fragment"> |
598 <!ELEMENT <a id="e.bind">bind</a> EMPTY> |
599 <!ELEMENT <a id="e.bind">bind</a> EMPTY> |
599 <!ATTLIST bind |
600 <!ATTLIST bind |
600 <a href="#bind.style">style</a> IDREF #REQUIRED |
601 <a href="#bind.style">style</a> IDREF #REQUIRED |
699 </state> |
700 </state> |
700 </style> |
701 </style> |
701 </pre> |
702 </pre> |
702 </div> |
703 </div> |
703 |
704 |
704 <h3>The painter element</h3> |
705 <h2>The painter element</h2> |
705 <div class="dtd-fragment"> |
706 <div class="dtd-fragment"> |
706 <pre class="dtd-fragment"> |
707 <pre class="dtd-fragment"> |
707 <!ELEMENT <a id="e.painter">painter</a> EMPTY> |
708 <!ELEMENT <a id="e.painter">painter</a> EMPTY> |
708 <!ATTLIST painter |
709 <!ATTLIST painter |
709 <a href="#painter.idref">idref</a> IDREF #IMPLIED |
710 <a href="#painter.idref">idref</a> IDREF #IMPLIED |
813 menu items. With painter aggregation, you just need to create a separate |
814 menu items. With painter aggregation, you just need to create a separate |
814 highlighting painter instead of having buttons and menu items painters |
815 highlighting painter instead of having buttons and menu items painters |
815 handle it. |
816 handle it. |
816 </p> |
817 </p> |
817 |
818 |
818 <h3>The imagePainter element</h3> |
819 <h2>The imagePainter element</h2> |
819 <div class="dtd-fragment"> |
820 <div class="dtd-fragment"> |
820 <pre class="dtd-fragment"> |
821 <pre class="dtd-fragment"> |
821 <!ELEMENT <a id="e.imagePainter">imagePainter</a> EMPTY> |
822 <!ELEMENT <a id="e.imagePainter">imagePainter</a> EMPTY> |
822 <!ATTLIST imagePainter |
823 <!ATTLIST imagePainter |
823 <a href="#imagePainter.id">id</a> ID #IMPLIED |
824 <a href="#imagePainter.id">id</a> ID #IMPLIED |
909 Refer to the description of the <a href="#e.painter">painter</a> |
910 Refer to the description of the <a href="#e.painter">painter</a> |
910 element for details as to the precedence in choosing a painter and to |
911 element for details as to the precedence in choosing a painter and to |
911 understand how identical painters are handled. |
912 understand how identical painters are handled. |
912 |
913 |
913 |
914 |
914 <h3>The imageIcon element</h3> |
915 <h2>The imageIcon element</h2> |
915 <div class="dtd-fragment"> |
916 <div class="dtd-fragment"> |
916 <pre class="dtd-fragment"> |
917 <pre class="dtd-fragment"> |
917 <!ELEMENT <a id="e.imageIcon">imageIcon</a> EMPTY> |
918 <!ELEMENT <a id="e.imageIcon">imageIcon</a> EMPTY> |
918 <!ATTLIST imageIcon |
919 <!ATTLIST imageIcon |
919 <a href="#imageIcon.id">id</a> ID #REQUIRED |
920 <a href="#imageIcon.id">id</a> ID #REQUIRED |
943 <property key="RadioButton.icon" value="icon"/> |
944 <property key="RadioButton.icon" value="icon"/> |
944 </style> |
945 </style> |
945 </pre> |
946 </pre> |
946 </div> |
947 </div> |
947 |
948 |
948 <h3>The opaque element</h3> |
949 <h2>The opaque element</h2> |
949 <div class="dtd-fragment"> |
950 <div class="dtd-fragment"> |
950 <pre class="dtd-fragment"> |
951 <pre class="dtd-fragment"> |
951 <!ELEMENT <a id="e.opaque">opaque</a> EMPTY> |
952 <!ELEMENT <a id="e.opaque">opaque</a> EMPTY> |
952 <!ATTLIST opaque |
953 <!ATTLIST opaque |
953 <a href="#opaque.value">value</a> (true|false) "true" |
954 <a href="#opaque.value">value</a> (true|false) "true" |
974 <painter idref="painter"/> |
975 <painter idref="painter"/> |
975 </style> |
976 </style> |
976 </pre> |
977 </pre> |
977 </div> |
978 </div> |
978 |
979 |
979 <h3><a id="ee.beansPersistance">The beansPersistance entity</a></h3> |
980 <h2><a id="ee.beansPersistance">The beansPersistance entity</a></h2> |
980 <p> |
981 <p> |
981 Beans persistance can be used to embed any Object. This is |
982 Beans persistance can be used to embed any Object. This is |
982 typically used for embedding your own Painters, but can be used |
983 typically used for embedding your own Painters, but can be used |
983 for other arbritrary objects as well. Refer to <a |
984 for other arbritrary objects as well. Refer to <a |
984 href="http://www.oracle.com/technetwork/java/persistence3-139471.html"> |
985 href="http://www.oracle.com/technetwork/java/persistence3-139471.html"> |
985 http://www.oracle.com/technetwork/java/persistence3-139471.html</a> |
986 http://www.oracle.com/technetwork/java/persistence3-139471.html</a> |
986 for details on beans persistance. |
987 for details on beans persistance. |
987 |
988 |
988 |
989 |
989 <h3>Backing Style</h3> |
990 <h2>Backing Style</h2> |
990 <p> |
991 <p> |
991 In creating a Synth file it's good practice to create a backing |
992 In creating a Synth file it's good practice to create a backing |
992 style that is used by all components. This will make sure that |
993 style that is used by all components. This will make sure that |
993 any components that do not match a specific style will have |
994 any components that do not match a specific style will have |
994 a default font, foreground, background and opacity. The |
995 a default font, foreground, background and opacity. The |