Repository navigation
Expand file tree
/
Copy pathUIMain.java
More file actions
59 lines (48 loc) · 1.42 KB
/
Copy pathUIMain.java
File metadata and controls
59 lines (48 loc) · 1.42 KB
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
package com.swingTest;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class UIMain extends JFrame {
/**
*
*/
private static final long serialVersionUID = -3522894870730622099L;
private JPanel contentPanel;
private JLabel panelTitle;
private JLabel content;
private JButton confirm;
private String panelTitle1;
public UIMain(){
this.setTitle("UI Swing");
this.setSize(300, 200);
this.setResizable(false);
this.setVisible(false);
this.setLayout(new BorderLayout());
initUI();
// this.setContentPane(contentPanel);
this.add(contentPanel, BorderLayout.CENTER);
}
public void initUI(){
contentPanel = new JPanel();
panelTitle1 = "Common Panel";
// contentPanel.setBorder(BorderFactory.createTitledBorder(panelTitle1));
// contentPanel.setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 9));
contentPanel.setBorder(BorderFactory.createLineBorder(Color.CYAN, 2));
panelTitle =new JLabel("Panel");
content = new JLabel("Hello Java UI!");
confirm = new JButton("OK");
// contentPanel.add(panelTitle);
contentPanel.add(content);
contentPanel.add(confirm);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame jf = new UIMain();
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setVisible(true);
}
}