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

📄 serverframe.java

📁 一个利用Java语言实现的ftp程序
💻 JAVA
字号:
/* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE file. */package server.gui;import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.event.WindowEvent;import javax.swing.ImageIcon;import javax.swing.JFrame;import javax.swing.JTabbedPane;import gui.GuiUtils;import server.ServerEngine;/** * Generic server admin gui. We should be able to  * add any server gui panel here. * * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a> */public class ServerFrame extends JFrame {        private final static ImageIcon ICON_IMG = GuiUtils.createImageIcon("server/gui/server.gif");         private JTabbedPane mjTabPane;      private ServerPane[] mjPanelArray = {        new server.ftp.gui.FtpPanel()    };             /**      * Creates new form MyServerFrame      */    public ServerFrame() {        initComponents ();        pack();        setTitle("Server");        if (ICON_IMG != null) {            setIconImage(ICON_IMG.getImage());        }        setSize(new Dimension(605, 450));        GuiUtils.setLocation(this);    }    /**      * This method is called from within the constructor to     * initialize the form.     */    private void initComponents() {                mjTabPane = new JTabbedPane();                // add all the server panels        for(int i=0; i<mjPanelArray.length; i++) {            mjTabPane.addTab(mjPanelArray[i].getServerName(), mjPanelArray[i].getPanel());        }                  getContentPane().add(mjTabPane, BorderLayout.CENTER);    }    /*     * Handle window closing event.     */     protected void processWindowEvent(WindowEvent e) {        int id = e.getID();        if (id == WindowEvent.WINDOW_CLOSING) {            if ( !GuiUtils.getConfirmation(this, "Do you really want to exit?") ) {                return;            }            super.processWindowEvent(e);            terminate();        }         else {            super.processWindowEvent(e);        }        }        /**     * Terminate application - stop all servers.     */    public void terminate() {        for(int i=0; i<mjPanelArray.length; i++) {            ServerEngine serverEngine = mjPanelArray[i].getServerEngine();            if(serverEngine != null) {                System.out.println("Stopping " + mjPanelArray[i].getServerName() + "...");                serverEngine.stopServer();            }        }        dispose();        System.exit(0);    }                  /**     * Server GUI starting point.     * @param args the command line arguments     */     public static void main (String args[]) {        new ServerFrame().show();     }}

⌨️ 快捷键说明

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