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
  • 相关阅读:
    up6-chrome 45+安装教程
    HttpUploader7-授权码配置
    jsp-MySQL连接池
    WordPaster2-正式包布署说明
    HTTP文件上传插件开发文档-ASP
    HTTP文件上传插件开发文档-JSP
    eWebEditor9.x整合教程-Xproer.WordPaster
    42. Trapping Rain Water
    41. First Missing Positive
    40. Combination Sum II
  • 原文地址:https://www.cnblogs.com/starcrm/p/1309786.html
Copyright © 2011-2022 走看看