Skip to content

Commit 3de7b0e

Browse files
committed
Update examples.
1 parent 47bb2a7 commit 3de7b0e

25 files changed

+50
-52
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ XML elements represent component instances. Most Swing and all Sierra components
8484
Elements can be nested to create a component hierarchy. For example:
8585

8686
```xml
87-
<column-panel spacing="8" padding="8">
87+
<column-panel spacing="8" padding="8" opaque="true">
8888
<column-panel>
8989
<check-box text="checkBox1"/>
9090
<check-box text="checkBox2"/>
@@ -178,7 +178,7 @@ The "weight" attribute specifies the amount of excess space in a container that
178178
The "size" attribute specifies a fixed dimension for a component. It is typically used with `Spacer` instances to create "struts" between components, as an alternative to the "spacing" property provided by `RowPanel` and `ColumnPanel`:
179179

180180
```xml
181-
<column-panel spacing="4" padding="8">
181+
<column-panel spacing="4" padding="8" opaque="true">
182182
<row-panel>
183183
<button text="1a"/>
184184
<spacer size="4"/>
@@ -227,7 +227,7 @@ FlatLaf text styles are also accessible via the "font" property:
227227
Several FlatLaf text field [properties](https://www.formdev.com/flatlaf/client-properties/#JTextField) are also supported. For example:
228228

229229
```xml
230-
<column-panel spacing="4" padding="8">
230+
<column-panel spacing="4" padding="8" opaque="true">
231231
<text-field columns="16" placeholderText="firstName" showClearButton="true"/>
232232
<text-field columns="16" placeholderText="lastName" showClearButton="true"/>
233233

@@ -295,7 +295,7 @@ See [ActionTest.java](sierra-test/src/main/java/org/httprpc/sierra/test/ActionTe
295295
An optional resource bundle may be provided as the third argument to the `load()` method of `UILoader`. When specified, values of text properties are considered resource keys and are used to look up the associated strings in the bundle. For example:
296296

297297
```xml
298-
<column-panel spacing="4" alignToGrid="true" padding="8" scrollableTracksViewportWidth="true">
298+
<column-panel spacing="4" padding="8" alignToGrid="true" scrollableTracksViewportWidth="true">
299299
<row-panel alignToBaseline="true">
300300
<label text="firstName" alignmentX="1.0"/>
301301
<text-field columns="12" alignmentX="0.0"/>
@@ -337,7 +337,7 @@ Cell contents are aligned based on the component's _x_ and _y_ alignment values
337337
For example, the following markup demonstrates x-alignment:
338338

339339
```xml
340-
<column-panel spacing="4" padding="8" alignToGrid="true">
340+
<column-panel spacing="4" padding="8" alignToGrid="true" opaque="true">
341341
<row-panel>
342342
<text-pane text="0.0" alignmentX="0.0" border="silver"/>
343343
<text-pane text="0.25" horizontalAlignment="center" alignmentX="0.25" border="silver"/>
@@ -361,7 +361,7 @@ For example, the following markup demonstrates x-alignment:
361361
This markup demonstrates y-alignment:
362362

363363
```xml
364-
<column-panel spacing="4" padding="8" alignToGrid="true">
364+
<column-panel spacing="4" padding="8" alignToGrid="true" opaque="true">
365365
<row-panel>
366366
<text-pane text="0.0" alignmentY="0.0" border="silver"/>
367367
<spacer size="160, 80" border="silver"/>

sierra-test/src/main/java/org/httprpc/sierra/test/GreetingTest.java

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,39 +39,37 @@ private GreetingTest() {
3939

4040
@Override
4141
public void run() {
42-
var declarative = map(System.getProperty("declarative"), Boolean::valueOf);
42+
var declarative = coalesce(map(System.getProperty("declarative"), Boolean::valueOf), () -> true);
4343

44-
if (declarative != null) {
45-
if (declarative) {
46-
setContentPane(UILoader.load(this, "GreetingTest.xml"));
47-
} else {
48-
var columnPanel = new ColumnPanel();
44+
if (declarative) {
45+
setContentPane(UILoader.load(this, "GreetingTest.xml"));
46+
} else {
47+
var columnPanel = new ColumnPanel();
4948

50-
columnPanel.setBorder(new EmptyBorder(8, 8, 8, 8));
49+
columnPanel.setBorder(new EmptyBorder(8, 8, 8, 8));
5150

52-
columnPanel.setOpaque(true);
53-
columnPanel.setBackground(Color.WHITE);
51+
columnPanel.setOpaque(true);
52+
columnPanel.setBackground(Color.WHITE);
5453

55-
var imagePane = new ImagePane();
54+
var imagePane = new ImagePane();
5655

57-
try (var inputStream = getClass().getResourceAsStream("world.png")) {
58-
imagePane.setImage(ImageIO.read(inputStream));
59-
} catch (IOException exception) {
60-
throw new RuntimeException(exception);
61-
}
56+
try (var inputStream = getClass().getResourceAsStream("world.png")) {
57+
imagePane.setImage(ImageIO.read(inputStream));
58+
} catch (IOException exception) {
59+
throw new RuntimeException(exception);
60+
}
6261

63-
imagePane.setScaleMode(ImagePane.ScaleMode.FILL_WIDTH);
62+
imagePane.setScaleMode(ImagePane.ScaleMode.FILL_WIDTH);
6463

65-
columnPanel.add(imagePane);
64+
columnPanel.add(imagePane);
6665

67-
var textPane = new TextPane("Hello, World!");
66+
var textPane = new TextPane("Hello, World!");
6867

69-
textPane.setHorizontalAlignment(HorizontalAlignment.CENTER);
68+
textPane.setHorizontalAlignment(HorizontalAlignment.CENTER);
7069

71-
columnPanel.add(textPane);
70+
columnPanel.add(textPane);
7271

73-
setContentPane(columnPanel);
74-
}
72+
setContentPane(columnPanel);
7573
}
7674

7775
setSize(320, 480);

sierra-test/src/main/java/org/httprpc/sierra/test/TiingoTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.httprpc.sierra.Outlet;
2222
import org.httprpc.sierra.TaskExecutor;
2323
import org.httprpc.sierra.UILoader;
24-
import org.pushingpixels.radiance.theming.api.skin.RadianceGraphiteLookAndFeel;
24+
import org.pushingpixels.radiance.theming.api.skin.RadianceBusinessLookAndFeel;
2525

2626
import javax.swing.JButton;
2727
import javax.swing.JComponent;
@@ -199,7 +199,7 @@ private TiingoTest(boolean radiance) {
199199
public void run() {
200200
if (radiance) {
201201
try {
202-
UIManager.setLookAndFeel(RadianceGraphiteLookAndFeel.class.getName());
202+
UIManager.setLookAndFeel(RadianceBusinessLookAndFeel.class.getName());
203203
} catch (Exception exception) {
204204
throw new RuntimeException(exception);
205205
}

sierra-test/src/main/resources/org/httprpc/sierra/test/ActionTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!DOCTYPE row-panel SYSTEM "sierra.dtd">
44

5-
<row-panel padding="8">
5+
<row-panel padding="8" opaque="true">
66
<spacer weight="1"/>
77

88
<column-panel spacing="8">

sierra-test/src/main/resources/org/httprpc/sierra/test/ActivityIndicatorTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!DOCTYPE column-panel SYSTEM "sierra.dtd">
44

5-
<column-panel padding="8">
5+
<column-panel padding="8" opaque="true">
66
<spacer weight="1"/>
77

88
<row-panel spacing="16">

sierra-test/src/main/resources/org/httprpc/sierra/test/AlignmentXTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!DOCTYPE column-panel SYSTEM "sierra.dtd">
44

5-
<column-panel spacing="4" padding="8" alignToGrid="true">
5+
<column-panel spacing="4" padding="8" alignToGrid="true" opaque="true">
66
<row-panel>
77
<text-pane text="0.0" alignmentX="0.0" border="silver"/>
88
<text-pane text="0.25" horizontalAlignment="center" alignmentX="0.25" border="silver"/>

sierra-test/src/main/resources/org/httprpc/sierra/test/AlignmentYTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!DOCTYPE column-panel SYSTEM "sierra.dtd">
44

5-
<column-panel spacing="4" padding="8" alignToGrid="true">
5+
<column-panel spacing="4" padding="8" alignToGrid="true" opaque="true">
66
<row-panel>
77
<text-pane text="0.0" alignmentY="0.0" border="silver"/>
88
<spacer size="160, 80" border="silver"/>

sierra-test/src/main/resources/org/httprpc/sierra/test/BaselineTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!DOCTYPE column-panel SYSTEM "sierra.dtd">
44

5-
<column-panel padding="8">
5+
<column-panel padding="8" opaque="true">
66
<row-panel spacing="4" alignToBaseline="true">
77
<label text="abcdefg" font="small" border="silver"/>
88
<label text="hijk" font="large" border="silver"/>

sierra-test/src/main/resources/org/httprpc/sierra/test/BorderTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!DOCTYPE column-panel SYSTEM "sierra.dtd">
44

5-
<column-panel spacing="4" padding="8">
5+
<column-panel spacing="4" padding="8" opaque="true">
66
<label text="pageStart" horizontalAlignment="center" border="silver" padding="4"/>
77

88
<row-panel spacing="4" weight="1">

sierra-test/src/main/resources/org/httprpc/sierra/test/BoxTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!DOCTYPE column-panel SYSTEM "sierra.dtd">
44

5-
<column-panel spacing="4" padding="8">
5+
<column-panel spacing="4" padding="8" opaque="true">
66
<row-panel>
77
<button text="1a"/>
88
<spacer size="4"/>

0 commit comments

Comments
 (0)