Learn the Java window Basic Operation boring writing
Just as a record.
The code is as follows:
Package day08;
Import Java.awt.BorderLayout;
Import Java.awt.Color;
Import Java.awt.FlowLayout;
Import Java.awt.Font;
Import Java.awt.GridLayout;
Import Javax.swing.JButton;
Import Javax.swing.JFrame;
Import Javax.swing.JLabel;
Import Javax.swing.JPanel;
Import Javax.swing.border.LineBorder;
Import Javax.swing.border.TitledBorder;
public class Testketianglianxin extends JFrame {
Public Testketianglianxin () {
Font font1 = new Font ("Serif", Font.Bold + Font.Italic, 20);
Font jbutton1 = new Font ("Dialog", Font.plain + Font.Bold, 20);
Font count1 = new Font ("italic", Font.Bold + Font.plain, 20);
Titledborder help = new Titledborder ("Hello World");
Titledborder Titledborder = new Titledborder ("three buttons");
Lineborder LB1 = new Lineborder (color.red,4);
Lineborder lb2 = new Lineborder (color.orange,4);
JPanel p1 = new JPanel (new FlowLayout (Flowlayout.left));
JButton btn1 = new JButton ("left");
Btn1.setforeground (New Color (framebits));
Btn1.settooltiptext ("00000000");
Btn1.setfont (FONT1);
JButton JButton = new JButton ("center");
Jbutton.setforeground (New Color (120, 25, 30));
Jbutton.setfont (Jbutton1);
JButton jbutton2 = new JButton ("right");
Jbutton2.setfont (COUNT1);
P1.add (JButton);
P1.add (BTN1);
P1.add (Jbutton2);
JPanel p2 = new JPanel (new GridLayout);
JLabel Label1 = new JLabel ("Red");
JLabel label2 = new JLabel ("Orange");
P2.add (Label1);
P2.add (Label2);
Label1.setborder (LB1);
Label2.setborder (LB2);
//font help1 = new Font ("italic", Font.Bold + font.plain, +);
Create border
//set border for P1
P1.setborder (titledborder);
P2.setborder (Help);
SetLayout (New GridLayout (2, 1, 5, 5));
Add (p1);
Add (p2);
}
public static void Main (string[] args) {
Testketianglianxin FR = new Testketianglianxin ();
Fr.setsize (500, 300);
Fr.setlocationrelativeto (NULL);
Fr.setdefaultcloseoperation (Jframe.exit_on_close);
Fr.setvisible (TRUE);
}
}
Learn the Java window Basic Operation boring writing