Skip to content

Commit 4bbcf3b

Browse files
committed
Update examples.
1 parent efc175e commit 4bbcf3b

4 files changed

Lines changed: 81 additions & 1 deletion

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
15+
package org.httprpc.sierra.test;
16+
17+
import com.formdev.flatlaf.FlatLightLaf;
18+
import org.httprpc.sierra.UILoader;
19+
20+
import javax.swing.Icon;
21+
import javax.swing.JFrame;
22+
import javax.swing.JLabel;
23+
import javax.swing.SwingConstants;
24+
import javax.swing.SwingUtilities;
25+
import java.awt.Color;
26+
import java.io.IOException;
27+
import java.util.Properties;
28+
29+
public class CustomBindingTest extends JFrame implements Runnable {
30+
public static class CustomLabel extends JLabel {
31+
public CustomLabel(String text) {
32+
this(text, null);
33+
}
34+
35+
public CustomLabel(String text, Icon icon) {
36+
super(text, icon, SwingConstants.CENTER);
37+
38+
setForeground(Color.RED);
39+
setBackground(Color.GREEN);
40+
41+
setOpaque(true);
42+
}
43+
}
44+
45+
private CustomBindingTest() {
46+
super("Custom Binding Test");
47+
48+
setDefaultCloseOperation(EXIT_ON_CLOSE);
49+
}
50+
51+
@Override
52+
public void run() {
53+
setContentPane(UILoader.load(this, "CustomBindingTest.xml"));
54+
55+
setSize(320, 120);
56+
setVisible(true);
57+
}
58+
59+
public static void main(String[] args) throws IOException, ClassNotFoundException {
60+
var bindings = new Properties();
61+
62+
try (var inputStream = CustomBindingTest.class.getResourceAsStream("/bindings.properties")) {
63+
bindings.load(inputStream);
64+
}
65+
66+
UILoader.bind(bindings);
67+
68+
FlatLightLaf.setup();
69+
70+
SwingUtilities.invokeLater(new CustomBindingTest());
71+
}
72+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
label = org.httprpc.sierra.test.CustomBindingTest$CustomLabel
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!DOCTYPE column-panel SYSTEM "sierra.dtd">
4+
5+
<column-panel spacing="8" padding="8" opaque="true">
6+
<label text="abcdefg"/>
7+
</column-panel>

sierra-tools/dtd-encoder/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ If no arguments are provided, the standard Sierra DTD will be generated.
2020

2121
## Example
2222
```
23-
$ dtd-encoder bindings.properties build/libs
23+
$ dtd-encoder src/main/resources/bindings.properties build/libs
2424
```

0 commit comments

Comments
 (0)