forked from java2script/java2script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTApp2.java
More file actions
51 lines (45 loc) · 1.28 KB
/
Copy pathTApp2.java
File metadata and controls
51 lines (45 loc) · 1.28 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
package test;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Label;
import javax.swing.JApplet;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class TApp2 extends JApplet {
public void init() {
setSize(500,500);
getContentPane().setBackground(Color.yellow);
setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(10, 10, 100, 150);
add(panel);
panel.setLayout(null);
panel.setBackground(Color.red);
JLabel label = new JLabel("OK-netTapp2");
label.setBounds(10, 10, 50, 60);
panel.add(label);
JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayout(2, 1));
Label label1 = new Label("1");
label1.setAlignment(Label.CENTER);
panel2.add(label1);
label1.setSize(50,15);
panel2.add(new JLabel("2"));
panel2.setBounds(200, 150, 100, 150);
add(panel2);
}
public void paint(Graphics g) {
super.paint(g);
((Graphics2D) g).setStroke((new BasicStroke(0)));
g.drawRect(130, 150, 40, 60);
g.fillRect(140, 5, 1, 200);
g.drawRect(160, 5, 1, 200);
g.drawLine(150, 150, 150, 350);
g.drawString("testing123", 50, 200);
}
}