⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mybuttons.java

📁 java的书上例子
💻 JAVA
字号:
//例12-3
import java.awt.*;
import java.applet.Applet;

 public class myButtons extends Applet {
     Button button1, button2, button3,button4;
     TextField tf; 
     Label l; 
     public void init() {
         button1 = new Button("Ok");
         button2 = new Button("打开");
         button1.setFont(new Font("simsun",Font.BOLD,20));
         button1.setBackground(Color.blue);
         button1.setForeground(Color.white);
         button3 = new Button("Close");
         button4 = new Button("save");
         tf = new TextField("text");
         l = new Label(" Test FlowLayout");
         setLayout(new FlowLayout(FlowLayout.LEFT,20,30)); 
//设置布局管理器,组件左对齐,水平间距为20个像素,垂直间距为30个像素。  
         add(button1);
         add(button2);
         add(button3);
         add(button4);
         add(tf);
         add(l);
        
     }
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -