最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Java語言實現(xiàn)簡單FTP軟件 FTP軟件主界面(4)

 更新時間:2017年03月31日 15:00:34   作者:歐陽鵬  
這篇文章主要為大家詳細(xì)介紹了Java語言實現(xiàn)簡單FTP軟件,F(xiàn)TP軟件主界面編寫的方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下

首先看一下FTP軟件的整體代碼框架,具體內(nèi)容如下

1、首先介紹程序的主入口FTPMain.java,采用了一個漂亮的外觀風(fēng)格

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 { 
 /** 
  * 本應(yīng)用的程序入口 
  */ 
 public static void main(String args[]) { 
  //導(dǎo)致 runnable 的 run 方法在 EventQueue 的指派線程上被調(diào)用。 
  java.awt.EventQueue.invokeLater(new Runnable() { 
   public void run() { 
    try { 
     //使用 LookAndFeel 對象設(shè)置當(dāng)前的默認(rèn)外觀。 
     UIManager.setLookAndFeel(new NimbusLookAndFeel());//設(shè)置一個非常漂亮的外觀 
//     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")); 
 
 public FTPClientFrame() { 
  LINK_TO_ACTION = new LinkToAction(this, "連接到", null); 
  CUT_LINK_ACTION = new CutLinkAction(this, "斷開", null); 
  initComponents(); 
  initSystemTray(); 
 } 
 
 /** 
  * 初始化系統(tǒng)托盤的方法 
  */ 
 private void initSystemTray() { 
  if (SystemTray.isSupported()) 
   systemTray = SystemTray.getSystemTray(); 
  TrayIcon trayIcon = new TrayIcon(icon.getImage()); 
  PopupMenu popupMenu = new PopupMenu("托盤菜單"); 
 
  // 創(chuàng)建顯示主窗體菜單項 
  MenuItem showMenuItem = new MenuItem("顯示主窗體"); 
  showMenuItem.addActionListener(new ActionListener() { 
   @Override 
   public void actionPerformed(ActionEvent e) { 
    FTPClientFrame.this.setExtendedState(JFrame.NORMAL); 
    FTPClientFrame.this.setVisible(true); 
   } 
  }); 
 
  // 創(chuàng)建退出菜單項 
  MenuItem exitMenuItem = new MenuItem("退出"); 
  exitMenuItem.addActionListener(new ActionListener() { 
   @Override 
   public void actionPerformed(ActionEvent e) { 
    System.exit(0); 
   } 
  }); 
 
  popupMenu.add(showMenuItem); 
  popupMenu.addSeparator(); 
  popupMenu.add(exitMenuItem); 
  trayIcon.setPopupMenu(popupMenu); 
  try { 
   systemTray.add(trayIcon); 
  } catch (AWTException e) { 
   e.printStackTrace(); 
  } 
 } 
 
 /** 
  * 初始化程序界面的方法 
  */ 
 private void initComponents() { 
  setIconImage(icon.getImage()); 
  java.awt.GridBagConstraints gridBagConstraints; 
 
  JPanel jPanel1 = new JPanel(); 
  JToolBar jToolBar1 = new JToolBar(); 
  JButton linkTo = new JButton(); 
  cutLinkButton = new JButton(); 
  JPanel jPanel4 = new JPanel(); 
  JLabel jLabel1 = new JLabel(); 
  serverTextField = new JTextField(); 
  JLabel jLabel2 = new JLabel(); 
  userTextField = new JTextField(); 
  JLabel jLabel3 = new JLabel(); 
  PassField = new JPasswordField(); 
  JLabel jLabel6 = new JLabel(); 
  portTextField = new JTextField(); 
  linkButton = new JButton(); 
  JSplitPane jSplitPane2 = new JSplitPane(); 
  jSplitPane1 = new JSplitPane(); 
  ftpPanel = new FtpPanel(this); // 初始化FTP遠(yuǎn)程資源面板 
  localPanel = new LocalPanel(this); // 初始化本地資源管理面板 
  uploadPanel = new UploadPanel(); // 初始化上傳隊列面板 
  downloadPanel = new DownloadPanel(); // 初始化下載隊列面板 
  queuePanel = new QueuePanel(this); // 初始化隊列面板 
 
  JTabbedPane jTabbedPane1 = new JTabbedPane(); 
  JMenuBar MenuBar = new JMenuBar(); 
  JMenu fileMenu = new JMenu(); 
  JMenuItem ftpManageMenuItem = new JMenuItem(); 
  JSeparator jSeparator1 = new JSeparator(); 
  JMenuItem linkToMenuItem = new javax.swing.JMenuItem(); 
  JMenuItem cutMenuItem = new javax.swing.JMenuItem(); 
  JSeparator jSeparator2 = new javax.swing.JSeparator(); 
  JMenuItem exitMenuItem = new javax.swing.JMenuItem(); 
  JMenuItem uploadMenuItem = new javax.swing.JMenuItem(); 
  JSeparator jSeparator3 = new javax.swing.JSeparator(); 
  JMenuItem createFolderMenuItem = new javax.swing.JMenuItem(); 
  JMenuItem renameMenuItem = new javax.swing.JMenuItem(); 
  JMenuItem delMenuItem = new javax.swing.JMenuItem(); 
  JMenu ftpMenu = new javax.swing.JMenu(); 
  JMenuItem downMenuItem = new javax.swing.JMenuItem(); 
  JSeparator jSeparator6 = new javax.swing.JSeparator(); 
  JMenuItem ftpDelMenuItem = new javax.swing.JMenuItem(); 
  JMenuItem ftpRenameMenuItem = new javax.swing.JMenuItem(); 
  JMenuItem newFolderMenuItem = new javax.swing.JMenuItem(); 
  JMenu helpMenu = new javax.swing.JMenu(); 
  JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); 
  JMenuItem bugMenuItem = new javax.swing.JMenuItem(); 
 
//  setTitle("基于Socket的FTP軟件Java實現(xiàn)"); 
  setTitle("Java語言實現(xiàn)簡單FTP軟件__歐陽鵬設(shè)計"); 
  addWindowListener(new java.awt.event.WindowAdapter() { 
   public void windowOpened(java.awt.event.WindowEvent evt) { 
    formWindowOpened(evt); 
   } 
 
   public void windowIconified(final WindowEvent e) { 
    setVisible(false); 
   } 
  }); 
  addComponentListener(new java.awt.event.ComponentAdapter() { 
   public void componentResized(java.awt.event.ComponentEvent evt) { 
    formComponentResized(evt); 
   } 
  }); 
  getContentPane().setLayout(new java.awt.GridBagLayout()); 
 
  jPanel1.setLayout(new java.awt.GridLayout(0, 1)); 
 
  jToolBar1.setRollover(true); 
  jToolBar1.setFloatable(false); 
 
  linkTo.setText("連接到"); 
  linkTo.setFocusable(false); 
  linkTo.setAction(LINK_TO_ACTION); 
  jToolBar1.add(linkTo); 
 
  cutLinkButton.setText("斷開"); 
  cutLinkButton.setEnabled(false); 
  cutLinkButton.setFocusable(false); 
  cutLinkButton.setAction(CUT_LINK_ACTION); 
  jToolBar1.add(cutLinkButton); 
 
  jPanel1.add(jToolBar1); 
   
  shutdownButton = new JToggleButton(); 
  shutdownButton.setText("自動關(guān)機"); 
  shutdownButton.setToolTipText("隊列完成后,自動關(guān)閉計算機"); 
  shutdownButton.setFocusable(false); 
  jToolBar1.add(shutdownButton); 
 
  jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); 
  jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, 
    javax.swing.BoxLayout.LINE_AXIS)); 
 
  jLabel1.setText("主機地址:"); 
  jPanel4.add(jLabel1); 
 
  serverTextField.setText("192.168.1.100"); 
  serverTextField.addKeyListener(new java.awt.event.KeyAdapter() { 
   public void keyPressed(java.awt.event.KeyEvent evt) { 
    LinkFTPKeyPressed(evt); 
   } 
  }); 
  jPanel4.add(serverTextField); 
 
  jLabel2.setText("用戶名:"); 
  jPanel4.add(jLabel2); 
 
  userTextField.setText("oyp"); 
  userTextField.setMaximumSize(new java.awt.Dimension(200, 2147483647)); 
  userTextField.setPreferredSize(new java.awt.Dimension(100, 21)); 
  userTextField.addKeyListener(new java.awt.event.KeyAdapter() { 
   public void keyPressed(java.awt.event.KeyEvent evt) { 
    LinkFTPKeyPressed(evt); 
   } 
  }); 
  jPanel4.add(userTextField); 
 
  jLabel3.setText("密碼:"); 
  jPanel4.add(jLabel3); 
 
  PassField.setText("oyp"); 
  PassField.setMaximumSize(new java.awt.Dimension(200, 2147483647)); 
  PassField.setPreferredSize(new java.awt.Dimension(100, 21)); 
  PassField.addKeyListener(new java.awt.event.KeyAdapter() { 
   public void keyPressed(java.awt.event.KeyEvent evt) { 
    LinkFTPKeyPressed(evt); 
   } 
  }); 
  jPanel4.add(PassField); 
 
  jLabel6.setText("端口:"); 
  jPanel4.add(jLabel6); 
 
  portTextField.setText("21"); 
  portTextField.setMaximumSize(new java.awt.Dimension(100, 2147483647)); 
  portTextField.setPreferredSize(new java.awt.Dimension(50, 21)); 
  portTextField.addKeyListener(new java.awt.event.KeyAdapter() { 
   public void keyPressed(java.awt.event.KeyEvent evt) { 
    LinkFTPKeyPressed(evt); 
   } 
  }); 
  jPanel4.add(portTextField); 
 
  linkButton.setText("連接"); 
  linkButton.setFocusable(false); 
  linkButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); 
  linkButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); 
  linkButton.addActionListener(new java.awt.event.ActionListener() { 
   public void actionPerformed(java.awt.event.ActionEvent evt) { 
    linkButtonActionPerformed(evt); 
   } 
  }); 
  jPanel4.add(linkButton); 
 
  jPanel1.add(jPanel4); 
 
  gridBagConstraints = new java.awt.GridBagConstraints(); 
  gridBagConstraints.gridx = 0; //指定包含組件的顯示區(qū)域開始邊的單元格,其中行的第一個單元格為 gridx=0。 
  gridBagConstraints.gridy = 0; //指定位于組件顯示區(qū)域的頂部的單元格,其中最上邊的單元格為 gridy=0。 
  //當(dāng)組件的顯示區(qū)域大于它所請求的顯示區(qū)域的大小時使用此字段。 
  gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; //在水平方向而不是垂直方向上調(diào)整組件大小。 
  gridBagConstraints.weightx = 1.0; //指定如何分布額外的水平空間。 
  getContentPane().add(jPanel1, gridBagConstraints); 
 
  jSplitPane2.setBorder(null); 
  jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); 
  jSplitPane2.setResizeWeight(1.0); 
  jSplitPane2.setContinuousLayout(true); 
 
  jSplitPane1.setDividerLocation(400); 
  jSplitPane1.setDividerSize(10); 
  jSplitPane1.setOneTouchExpandable(true); 
  jSplitPane1.setRightComponent(ftpPanel); 
  jSplitPane1.setLeftComponent(localPanel); 
 
  jSplitPane2.setLeftComponent(jSplitPane1); 
 
  jTabbedPane1.setMinimumSize(new java.awt.Dimension(40, 170)); 
 
  jTabbedPane1.addTab("隊列", queuePanel);// 添加隊列面板 
  jTabbedPane1.addTab("上傳隊列", uploadPanel);// 添加上傳面板 
  jTabbedPane1.addTab("下載隊列", downloadPanel);// 添加下載面板 
 
  jSplitPane2.setBottomComponent(jTabbedPane1); 
 
  gridBagConstraints = new java.awt.GridBagConstraints(); 
  gridBagConstraints.gridx = 0; 
  gridBagConstraints.gridy = 1; 
  gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; //在水平方向和垂直方向上同時調(diào)整組件大小。 
  gridBagConstraints.weightx = 1.0; //指定如何分布額外的水平空間。 
  gridBagConstraints.weighty = 1.0; //指定如何分布額外的垂直空間。 
  getContentPane().add(jSplitPane2, gridBagConstraints); 
 
  fileMenu.setMnemonic('f'); 
  fileMenu.setText("站點(F)"); 
 
  ftpManageMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( 
    java.awt.event.KeyEvent.VK_S, 
    java.awt.event.InputEvent.CTRL_MASK)); 
  ftpManageMenuItem.setText("FTP站點管理(S)"); 
  ftpManageMenuItem.addActionListener(new ActionListener() { 
   @Override 
   public void actionPerformed(ActionEvent e) { 
//    System.out.println("action"); 
    FtpSiteDialog dialog = new FtpSiteDialog(FTPClientFrame.this); 
    dialog.setVisible(true); 
   } 
  }); 
  fileMenu.add(ftpManageMenuItem); 
  fileMenu.add(jSeparator1); 
 
  linkToMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( 
    java.awt.event.KeyEvent.VK_C, 
    java.awt.event.InputEvent.CTRL_MASK)); 
  linkToMenuItem.setText("連接到...(C)"); 
  linkToMenuItem.setAction(LINK_TO_ACTION); 
  fileMenu.add(linkToMenuItem); 
 
  cutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( 
    java.awt.event.KeyEvent.VK_Z, 
    java.awt.event.InputEvent.CTRL_MASK)); 
  cutMenuItem.setText("斷開(Z)"); 
  cutMenuItem.setAction(CUT_LINK_ACTION); 
  fileMenu.add(cutMenuItem); 
  fileMenu.add(jSeparator2); 
 
  exitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( 
    java.awt.event.KeyEvent.VK_X, 
    java.awt.event.InputEvent.CTRL_MASK)); 
  exitMenuItem.setText("退出(X)"); 
  exitMenuItem.addActionListener(new ActionListener() { 
   @Override 
   public void actionPerformed(ActionEvent e) { 
    System.exit(0); 
   } 
  }); 
  fileMenu.add(exitMenuItem); 
 
  MenuBar.add(fileMenu); 
 
  JMenu localMenu = new JMenu(); 
  localMenu.setMnemonic('l'); 
  localMenu.setText("本地(L)"); 
 
  uploadMenuItem.setMnemonic('U'); 
  uploadMenuItem.setText("上傳(U)"); 
  uploadMenuItem.setAction(localPanel.getActionMap().get("uploadAction")); 
 
  localMenu.add(uploadMenuItem); 
  localMenu.add(jSeparator3); 
 
  createFolderMenuItem.setMnemonic('C'); 
  createFolderMenuItem.setText("新建文件夾(C)"); 
  createFolderMenuItem.setAction(localPanel.getActionMap().get( 
    "createFolderAction")); 
  localMenu.add(createFolderMenuItem); 
 
  renameMenuItem.setMnemonic('R'); 
  renameMenuItem.setText("重命名(R)"); 
  renameMenuItem.setAction(localPanel.getActionMap().get("renameAction")); 
  localMenu.add(renameMenuItem); 
 
  delMenuItem.setMnemonic('D'); 
  delMenuItem.setText("刪除(D)"); 
  delMenuItem.setAction(localPanel.getActionMap().get("delAction")); 
  localMenu.add(delMenuItem); 
 
  JMenuItem localrefreshMenuItem = new JMenuItem(); 
  localrefreshMenuItem.setMnemonic('R'); 
  localrefreshMenuItem.setText("刷新(R)"); 
  localrefreshMenuItem.setAction(localPanel.getActionMap().get( 
    "refreshAction")); 
  localMenu.add(localrefreshMenuItem); 
 
  MenuBar.add(localMenu); 
 
  ftpMenu.setMnemonic('r'); 
  ftpMenu.setText("遠(yuǎn)程(R)"); 
 
  downMenuItem.setMnemonic('U'); 
  downMenuItem.setText("下載(U)"); 
  downMenuItem.setAction(ftpPanel.getActionMap().get("downAction")); 
  ftpMenu.add(downMenuItem); 
  ftpMenu.add(jSeparator6); 
 
  ftpDelMenuItem.setMnemonic('D'); 
  ftpDelMenuItem.setText("刪除(D)"); 
  ftpDelMenuItem.setAction(ftpPanel.getActionMap().get("delAction")); 
  ftpMenu.add(ftpDelMenuItem); 
 
  ftpRenameMenuItem.setMnemonic('R'); 
  ftpRenameMenuItem.setText("重命名(R)"); 
  ftpRenameMenuItem 
    .setAction(ftpPanel.getActionMap().get("renameAction")); 
  ftpMenu.add(ftpRenameMenuItem); 
 
  newFolderMenuItem.setMnemonic('C'); 
  newFolderMenuItem.setText("新建文件夾(C)"); 
  newFolderMenuItem.setAction(ftpPanel.getActionMap().get( 
    "createFolderAction")); 
  ftpMenu.add(newFolderMenuItem); 
 
  JMenuItem refreshMenuItem = new JMenuItem(); 
  refreshMenuItem.setMnemonic('R'); 
  refreshMenuItem.setText("刷新(R)"); 
  refreshMenuItem.setAction(ftpPanel.getActionMap().get("refreshAction")); 
  ftpMenu.add(refreshMenuItem); 
 
  MenuBar.add(ftpMenu); 
 
  helpMenu.setText("幫助(H)"); 
  aboutMenuItem.setMnemonic('a'); 
  aboutMenuItem.setText("關(guān)于(A)"); 
  aboutMenuItem.addActionListener(new AboutItemAction(this)); 
  helpMenu.add(aboutMenuItem); 
 
  bugMenuItem.setMnemonic('u'); 
  bugMenuItem.setText("錯誤報告(U)"); 
  bugMenuItem.addActionListener(new BugItemAction()); 
  helpMenu.add(bugMenuItem); 
 
  MenuBar.add(helpMenu); 
 
  setJMenuBar(MenuBar); 
 
  java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit() 
    .getScreenSize(); 
  setBounds((screenSize.width - 800) / 2, (screenSize.height - 600) / 2, 
    800, 700); 
 } 
 
 public JToggleButton getShutdownButton() { 
  return shutdownButton; 
 } 
 
 /** 
  * 窗體裝載的事件處理方法 
  */ 
 private void formWindowOpened(java.awt.event.WindowEvent evt) { 
  jSplitPane1.setDividerLocation(0.50); 
  localPanel.getLocalDiskComboBox().setSelectedIndex(1); 
  localPanel.getLocalDiskComboBox().setSelectedIndex(0); 
 } 
 
 /** 
  * 窗體大小調(diào)整的事件處理方法 
  */ 
 private void formComponentResized(java.awt.event.ComponentEvent evt) { 
  jSplitPane1.setDividerLocation(0.50); 
 } 
 
 /** 
  * 連接按鈕的事件處理方法 
  */ 
 private void linkButtonActionPerformed(java.awt.event.ActionEvent evt) { 
  try { 
   String server = serverTextField.getText(); // 獲取服務(wù)器地址 
   if (server == null) { 
    return; 
   } 
   String portStr = portTextField.getText(); // 獲取端口號 
   if (portStr == null) { 
    portStr = "21"; 
   } 
   int port = Integer.parseInt(portStr.trim()); 
   String userStr = userTextField.getText(); // 獲取用戶名 
   userStr = userStr == null ? "" : userStr.trim(); 
   String passStr = PassField.getText(); // 獲取密碼 
   passStr = passStr == null ? "" : passStr.trim(); 
   cutLinkButton.doClick(); 
   ftpClient = new FtpClient(); 
   ftpClient.openServer(server.trim(), port); // 連接服務(wù)器 
   ftpClient.login(userStr, passStr); // 登錄服務(wù)器 
   ftpClient.binary(); // 使用二進(jìn)制傳輸模式 
   if (ftpClient.serverIsOpen()) { // 如果連接成功 
    CUT_LINK_ACTION.setEnabled(true); // 設(shè)置斷開按鈕可用 
   } else { // 否則 
    CUT_LINK_ACTION.setEnabled(false); // 設(shè)置斷開按鈕不可用 
    return; // 并結(jié)束事件處理 
   } 
   // 設(shè)置本地資源管理面板的FTP連接信息 
   localPanel.setFtpClient(server, port, userStr, passStr); 
   // 設(shè)置上傳按鈕可用 
   localPanel.getActionMap().get("uploadAction").setEnabled(true); 
   ftpPanel.setFtpClient(ftpClient);// 設(shè)置FTP資源管理面板的FTP連接信息 
   // 設(shè)置下載按鈕可用 
   ftpPanel.getActionMap().get("downAction").setEnabled(true); 
   ftpPanel.refreshCurrentFolder();// 刷新FTP資源管理面板的當(dāng)前文件夾 
   queuePanel.startQueue(); // 啟動任務(wù)隊列線程 
  } catch (Exception ex) { 
   ex.printStackTrace(); 
  } 
 } 
 
 /** 
  * 連接FTP相關(guān)的文本框 和密碼框的回車事件 
  */ 
 private void LinkFTPKeyPressed(java.awt.event.KeyEvent evt) { 
  if (evt.getKeyChar() == '\n') { 
   linkButton.doClick(); 
  } 
 } 
 
 public LocalPanel getLocalPanel() { 
  return localPanel; 
 } 
 
 public FtpPanel getFtpPanel() { 
  return ftpPanel; 
 } 
 
 public QueuePanel getQueuePanel() { 
  return queuePanel; 
 } 
 
 public UploadPanel getUploadPanel() { 
  return uploadPanel; 
 } 
 
 public DownloadPanel getDownloadPanel() { 
  return downloadPanel; 
 } 
 
 public FtpClient getFtpClient() { 
  return ftpClient; 
 } 
 
 /** 
  * 設(shè)置FTP連接信息的方法,由FTP站點管理器調(diào)用 
  */ 
 public void setLinkInfo(SiteInfoBean bean) { 
  serverTextField.setText(bean.getServer()); // 設(shè)置主機地址 
  portTextField.setText(bean.getPort() + ""); // 設(shè)置端口號 
  userTextField.setText(bean.getUserName()); // 設(shè)置用戶名 
  PassField.setText(""); // 密碼清空 
  PassField.requestFocus(); // 密碼框請求焦點 
 } 
} 

整體界面如下:

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • springboot?security驗證碼的登錄實例

    springboot?security驗證碼的登錄實例

    這篇文章主要介紹了springboot?security驗證碼的登錄實例,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2025-03-03
  • 詳解Java數(shù)組的四種拷貝方式

    詳解Java數(shù)組的四種拷貝方式

    Java數(shù)組一共有四種拷貝方式: for循環(huán)、copyof/copyOfRange、arraycopy和clone。本文將為大家詳細(xì)介紹一下這四種方式,感興趣的可以了解一下
    2022-02-02
  • 教你使用springSecurity+jwt實現(xiàn)互踢功能

    教你使用springSecurity+jwt實現(xiàn)互踢功能

    JWT作為一個開放的標(biāo)準(zhǔn)( RFC 7519 ),定義了一種簡潔的,自包含的方法用于通信雙方之間以Json對象的形式安全的傳遞信息。接下來通過本文給大家介紹springSecurity+jwt實現(xiàn)互踢功能,需要的朋友可以參考下
    2021-11-11
  • Java數(shù)據(jù)結(jié)構(gòu)之棧的線性結(jié)構(gòu)詳解

    Java數(shù)據(jù)結(jié)構(gòu)之棧的線性結(jié)構(gòu)詳解

    從數(shù)據(jù)結(jié)構(gòu)上看棧和隊列都是線性表,不過是兩種特殊的線性表,棧只允許在的一端進(jìn)行插人或刪除操作,而隊列只允許在表的一端進(jìn)行插人操作、而在另一端進(jìn)行刪除操作,這篇文章主要給大家介紹了關(guān)于Java數(shù)據(jù)結(jié)構(gòu)之棧的線性結(jié)構(gòu)的相關(guān)資料,需要的朋友可以參考下
    2021-08-08
  • 淺談Java 繼承接口同名函數(shù)問題

    淺談Java 繼承接口同名函數(shù)問題

    這篇文章主要介紹了淺談Java 繼承接口同名函數(shù)問題。具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-09-09
  • 如何在Spring?Boot中使用MyBatis訪問數(shù)據(jù)庫

    如何在Spring?Boot中使用MyBatis訪問數(shù)據(jù)庫

    MyBatis可以通過簡單的XML或者注解來配置和映射原始類型,接口,和Java POJO為數(shù)據(jù)庫中記錄,使用MyBatis幫助我們解決各種問題,本文介紹如何在Spring?Boot中使用MyBatis訪問數(shù)據(jù)庫,感興趣的朋友一起看看吧
    2023-11-11
  • 詳解Java8中的Lambda表達(dá)式

    詳解Java8中的Lambda表達(dá)式

    這篇文章主要介紹了Java8中的Lambda表達(dá)式的相關(guān)資料,文中講解非常細(xì)致,代碼幫助大家更好的理解和學(xué)習(xí),感興趣的朋友可以了解下
    2020-07-07
  • java同步器AQS架構(gòu)AbstractQueuedSynchronizer原理解析下

    java同步器AQS架構(gòu)AbstractQueuedSynchronizer原理解析下

    這篇文章主要為大家介紹了java同步器AQS架構(gòu)AbstractQueuedSynchronizer原理解析下,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步
    2022-03-03
  • Spring Boot項目添加外部Jar包以及配置多數(shù)據(jù)源的完整步驟

    Spring Boot項目添加外部Jar包以及配置多數(shù)據(jù)源的完整步驟

    這篇文章主要給大家介紹了關(guān)于Spring Boot項目添加外部Jar包以及配置多數(shù)據(jù)源的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-06-06
  • 使用spring aop統(tǒng)一處理異常和打印日志方式

    使用spring aop統(tǒng)一處理異常和打印日志方式

    這篇文章主要介紹了使用spring aop統(tǒng)一處理異常和打印日志方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-06-06

最新評論

丹巴县| 土默特左旗| 什邡市| 城固县| 武义县| 雷山县| 阳原县| 嫩江县| 清流县| 广东省| 普宁市| 邵东县| 鹤庆县| 太白县| 平度市| 和顺县| 和政县| 岑巩县| 海城市| 芷江| 河池市| 高青县| 康定县| 喀喇沁旗| 鲁甸县| 汉源县| 北宁市| 当阳市| 香河县| 平果县| 磐安县| 威远县| 阿拉善盟| 安阳县| 玉树县| 漳平市| 牟定县| 射阳县| 新兴县| 武义县| 凤阳县|