📄 uselabel.java
字号:
import java.awt.*;
import java.awt.event.*;
public class UseLabel{
public static void main(String args[]){
MyFrame f=new MyFrame();
f.setSize(200,300);
f.setBackground(Color.lightGray);
f.setLayout(new FlowLayout());
Label l1=new Label();
l1.setText("标签1");
Label l2=new Label("标签2",Label.RIGHT);
l2.setBackground(Color.pink);
l2.setForeground(Color.blue);
f.add(l1);
f.add(l2);
f.show();
}
}
class MyFrame extends Frame{
public MyFrame(){
super("my frame");
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
dispose();
System.exit(0);
}});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -