d17

GUI 图形用户接口

GUI

  • 桌面程序(界面)java弱势
  • 用图形的方式,来展现计算机操作的见面,更方便直观

CLI

  • Command line User Interface(命令行用户接口)
  • 常见的DOS
  • 需要命令 不直观

Java为GUI提供的对象都存在java.Awt和Java.Swing两个包中
控件

  • 按钮 Button
  • 复选框 CheckBox
  • 单选框 RadioBox
  • 文本框 Text
  • 成组框 Group
  • Tree 树形视图
  • Select 下拉框
  • TextArea 文本区域 编辑多行
  • Menu 菜单
  • MenuItem 菜单项
  • MenuBar 菜单条
  • ToolBar
  • Progressbar 进度条
  • JFrame // window
  • Lable 标签
  • LayoutManager 控制控件的排列方式

Java入门20--GUI

package D16;

import javax.swing.*;

public class myWindow {
    public static void main(String[] args) {
        JFrame frame = new JFrame("这是标题");
        frame.setSize(600,400);

        //创建按钮
        JButton button = new JButton("确定");
        button.setBounds(0,0,100,50);
        frame.add(button);
        
        //设置边界,边界==大小+位置,相对于所在容器

    }
}

相关文章:

  • 2022-01-13
  • 2022-01-04
  • 2021-11-20
  • 2021-05-18
  • 2021-06-08
  • 2021-12-03
  • 2021-08-06
  • 2021-10-26
猜你喜欢
  • 2021-12-03
  • 2021-12-03
  • 2021-12-03
  • 2022-03-05
  • 2021-04-19
  • 2021-08-15
  • 2022-01-22
相关资源
相似解决方案