zoukankan      html  css  js  c++  java
  • 选项卡

    import java.awt.Container;

    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTabbedPane;


    public class MyJTabbedPane {
        
        private JFrame frame = new JFrame();
        private JTabbedPane totalPanel = new JTabbedPane();
        
        private JPanel panel1 = new JPanel();
        private JPanel panel2 = new JPanel();
        
        
        private JButton button1 = new JButton("中国");
        private JButton button2 = new JButton("世界");
        
        public MyJTabbedPane(){
            //设置框架的属性
            frame.setBounds(100, 100, 500, 500);
            frame.setVisible(true);
            frame.setResizable(false);
            //选项卡面板添加到容器中
                    Container c = frame.getContentPane();
            c.add(totalPanel);
            
            totalPanel.add("中国",panel1);
            totalPanel.add("世界",panel2);
            
            
            panel1.setLayout(null);
            button1.setBounds(100,100,100,50);
            panel1.add(button1);
            
            panel2.add(button2);
            
        }
        public static void main(String[] args) {
            new MyJTabbedPane();

        }

    }

  • 相关阅读:
    composer require 指定版本
    后台管理,有无限可能
    str_replace 批量查找替换字符串
    node项目配置成nginx启动
    nodejs项目安装ant design
    in_array的三个参数
    Tp5.1使用导出Excel
    php 中 public private protected的区别
    Seafile 文件访问日志时间不一致问题
    du -sh *
  • 原文地址:https://www.cnblogs.com/123qw/p/3769825.html
Copyright © 2011-2022 走看看