Java語言實現簡單FTP軟件 FTP軟件主界面(4)。本站提示廣大學習愛好者:(Java語言實現簡單FTP軟件 FTP軟件主界面(4))文章只能為提供參考,不一定能成為您想要的結果。以下是Java語言實現簡單FTP軟件 FTP軟件主界面(4)正文
首先看一下FTP軟件的整體代碼框架,具體內容如下


1、首先介紹程序的主入口FTPMain.java,采用了一個漂亮的外觀風格
package com.oyp.ftp;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
public class FTPMain {
/**
* 本應用的程序入口
*/
public static void main(String args[]) {
//導致 runnable 的 run 方法在 EventQueue 的指派線程上被調用。
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
//使用 LookAndFeel 對象設置當前的默認外觀。
UIManager.setLookAndFeel(new NimbusLookAndFeel());//設置一個非常漂亮的外觀
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
FTPClientFrame client_Frame = new FTPClientFrame();
client_Frame.setVisible(true);
} catch (Exception ex) {
Logger.getLogger(FTPClientFrame.class.getName()).log(
Level.SEVERE, null, ex);
}
}
});
}
}
2、介紹界面的主程序代碼FTPClientFrame.java
package com.oyp.ftp;
import java.awt.AWTException;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JSeparator;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.UIManager;
import com.oyp.ftp.panel.ftp.FtpPanel;
import com.oyp.ftp.panel.local.LocalPanel;
import com.oyp.ftp.panel.manager.FtpSiteDialog;
import com.oyp.ftp.panel.queue.DownloadPanel;
import com.oyp.ftp.panel.queue.QueuePanel;
import com.oyp.ftp.panel.queue.UploadPanel;
import com.oyp.ftp.utils.FtpClient;
import com.oyp.ftp.utils.SiteInfoBean;
import com.sun.java.swing.plaf.nimbus.*;
public class FTPClientFrame extends javax.swing.JFrame {
FtpClient ftpClient;
private JPasswordField PassField;
private JButton cutLinkButton;
FtpPanel ftpPanel;
LocalPanel localPanel;
private JTextField portTextField;
private JTextField serverTextField;
private JTextField userTextField;
private QueuePanel queuePanel;
private UploadPanel uploadPanel;
private DownloadPanel downloadPanel;
private JSplitPane jSplitPane1;
private JButton linkButton;
private final LinkToAction LINK_TO_ACTION; // 連接到 按鈕的動作處理器
private final CutLinkAction CUT_LINK_ACTION; // 斷開 按鈕的動作處理器
private SystemTray systemTray;
private JToggleButton shutdownButton;
private final ImageIcon icon = new ImageIcon(getClass().getResource(
"/com/oyp/ftp/res/trayIcon.png" />
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持。