zoukankan      html  css  js  c++  java
  • 开通空间

    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    
    import java.awt.*;
    import java.awt.event.*;
    
    import javax.swing.*;
    
    public class MainFrame {
        private JFrame mainFrame;
        private JLabel statusLabel;
        private JLabel msglabel;
        private JTabbedPane tabbedPane;
        private JTabbedPane bodyTabbedPane;
        private JPanel favoritePanel;
        private JPanel historyPanel;
        private JPanel recyclePanel;
        private JPanel configPanel;
        private JPanel aboutPanel;
    
        public MainFrame() {
            prepareGUI();
        }
    
        private void prepareGUI() {
            mainFrame = new JFrame("昕友软件");
            mainFrame.setSize(1024, 768);
            mainFrame.setLayout(new BorderLayout());
    
            mainFrame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent windowEvent) {
                    System.exit(0);
                }
            });
            statusLabel = new JLabel("昕友软件", JLabel.CENTER);
            msglabel = new JLabel("昕友软件", JLabel.CENTER);
            tabbedPane = new JTabbedPane();
    
            mainFrame.add(tabbedPane, BorderLayout.CENTER);
            mainFrame.add(msglabel, BorderLayout.NORTH);
            mainFrame.add(statusLabel, BorderLayout.SOUTH);
    
        }
    
        private void buildHome() {
            ImageIcon icon = null;
            bodyTabbedPane = new JTabbedPane();
            bodyTabbedPane.setTabPlacement(JTabbedPane.LEFT);
            for (int i = 0; i < 9; i++) {
                bodyTabbedPane.addTab("Tab"+i, icon, new JButton("计算" + i), "计算"
                        + i);
            }
    
            tabbedPane.addTab(" Home ", icon, bodyTabbedPane, "Home");
            tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
        }
    
        private void buildFavorite() {
            ImageIcon icon = null;
            favoritePanel = new JPanel();
            tabbedPane.addTab(" Favorites ", icon, favoritePanel, "收藏夹");
            tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
        }
    
        private void buildHistory() {
            ImageIcon icon = null;
            historyPanel = new JPanel();
            tabbedPane.addTab(" History ", icon, historyPanel, "History");
            tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
        }
    
        private void buildRecycle() {
            ImageIcon icon = null;
            recyclePanel = new JPanel();
            tabbedPane.addTab(" Recycle ", icon, recyclePanel, "Recycle");
            tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);
        }
    
        private void buildConfig() {
            ImageIcon icon = null;
            configPanel = new JPanel();
            tabbedPane.addTab(" Config ", icon, configPanel, "Config");
            tabbedPane.setMnemonicAt(4, KeyEvent.VK_5);
        }
    
        private void buildAbout() {
            ImageIcon icon = null;
            aboutPanel = new JPanel();
            tabbedPane.addTab(" About ", icon, aboutPanel, "About");
            tabbedPane.setMnemonicAt(5, KeyEvent.VK_6);
        }
    
        public void showJFrame() {
    
            buildHome();
    
            buildFavorite();
            buildHistory();
            buildRecycle();
            buildConfig();
            buildAbout();
            mainFrame.setVisible(true);
        }
    
        public static void main(String[] args) {
    
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    MainFrame mainUI = new MainFrame();
                    mainUI.showJFrame();
                }
            });
    
        }
    }
    关于作者: 王昕(QQ:475660) 在广州工作生活30余年。十多年开发经验,在Java、即时通讯、NoSQL、BPM、大数据等领域较有经验。
    目前维护的开源产品:https://gitee.com/475660
  • 相关阅读:
    c语言 414 根据输入的整数,循环显示1234567890
    c语言 47 编写一段程序,显示小于输入的整数的所有2的乘方。
    c语言49 交替输出正负号,当输入0以下时什么也不显示
    c语言48 改写48的程序,当输入的值小于1时不输出换行符
    c语言 411 逆向输出输入的整数值(同时输出原始数据)
    c语言47 显示出小于输入的整数的所有2的乘方
    c语言412 输入一个整数值显示其位数
    c语言415 输出标准身高体重对照表
    c语言413 求1到n的和
    c语言 410 输出连续* \n
  • 原文地址:https://www.cnblogs.com/starcrm/p/1309786.html
Copyright © 2011-2022 走看看