Skip to content

Commit 4a781e1

Browse files
committed
欧卡
1 parent eae56d0 commit 4a781e1

9 files changed

Lines changed: 84 additions & 73 deletions

File tree

.idea/workspace.xml

Lines changed: 46 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
2.15 KB
Binary file not shown.
1.03 KB
Binary file not shown.
1.28 KB
Binary file not shown.
1.26 KB
Binary file not shown.
1.07 KB
Binary file not shown.
2.48 KB
Binary file not shown.
897 Bytes
Binary file not shown.

src/com/xforg/gui/Borders.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.xforg.gui;//: gui/Borders.java
2+
// Different Swing borders.
3+
import javax.swing.*;
4+
import javax.swing.border.*;
5+
import java.awt.*;
6+
7+
import static com.xforg.utils.SwingConsole.run;
8+
9+
public class Borders extends JFrame {
10+
static JPanel showBorder(Border b) {
11+
JPanel jp = new JPanel();
12+
jp.setLayout(new BorderLayout());
13+
String nm = b.getClass().toString();
14+
nm = nm.substring(nm.lastIndexOf('.') + 1);
15+
jp.add(new JLabel(nm, JLabel.CENTER),
16+
BorderLayout.CENTER);
17+
jp.setBorder(b);
18+
return jp;
19+
}
20+
public Borders() {
21+
setLayout(new GridLayout(2,4));
22+
add(showBorder(new TitledBorder("Title")));
23+
add(showBorder(new EtchedBorder()));
24+
add(showBorder(new LineBorder(Color.BLUE)));
25+
add(showBorder(
26+
new MatteBorder(5,5,30,30,Color.GREEN)));
27+
add(showBorder(
28+
new BevelBorder(BevelBorder.RAISED)));
29+
add(showBorder(
30+
new SoftBevelBorder(BevelBorder.LOWERED)));
31+
add(showBorder(new CompoundBorder(
32+
new EtchedBorder(),
33+
new LineBorder(Color.RED))));
34+
}
35+
public static void main(String[] args) {
36+
run(new Borders(), 500, 300);
37+
}
38+
} ///:~

0 commit comments

Comments
 (0)