?? ftppoolpanel.java
字號:
/** * File and FTP Explorer * Copyright 2003 * BOESCH Vincent * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */package javaexplorer.gui.internal;import java.awt.*;import java.awt.event.*;import javaexplorer.manager.ftp.*;import javaexplorer.util.Log;import javax.swing.*;/** * Description of the Class * *@author VEEB7280 *@created 13 juin 2002 */public class FtpPoolPanel extends JPanel implements ActionListener { FtpPool fpool = null; JLabel jlbFtpInfo = new JLabel("FTP Info"); GridLayout gridLayout1 = new GridLayout(1, 5, 5, 5); private JPanel jPanel1 = new JPanel(); private JPanel jPanel2 = new JPanel(); private JCheckBox jcbIsBinary = new JCheckBox("Binary", true); private JLabel jlbHostName = new JLabel("HostName"); private JPanel jPanel3 = new JPanel(); private JButton addFtp = new JButton("Add"); private JButton closeFtp = new JButton("Close"); private JButton remFtp = new JButton("Rem"); private GridLayout gridLayout2 = new GridLayout(); /** * Constructor for the FtpPoolPanel object * *@param fp Description of the Parameter */ public FtpPoolPanel(FtpPool fp) { super(); fpool = fp; try { jbInit(); } catch (Exception e) { Log.addError(e); } } /** * Description of the Method */ public void jbInit() { setLayout(gridLayout1); jPanel1.setLayout(gridLayout2); jcbIsBinary.setToolTipText("Use binary transfer"); jcbIsBinary.addActionListener(this); addFtp.setToolTipText("Add a connection to this pool"); addFtp.addActionListener(this); closeFtp.setToolTipText("Close this pool"); closeFtp.addActionListener(this); remFtp.setToolTipText("Remove a connection from this pool"); remFtp.addActionListener(this); gridLayout2.setRows(2); this.add(jPanel1, null); jPanel1.add(jPanel2, null); jPanel2.add(jlbHostName, null); jPanel2.add(jcbIsBinary, null); jPanel1.add(jPanel3, null); jPanel3.add(addFtp, null); jPanel3.add(closeFtp, null); jPanel3.add(remFtp, null); add(jlbFtpInfo); jlbHostName.setFont(jlbHostName.getFont().deriveFont(Font.BOLD)); jlbFtpInfo.setText("Nothing active"); setSize(250, 40); } public void refreshPool(FtpPool fp) { fpool = fp; if (fpool == null) { jlbHostName.setText("HostName"); jlbFtpInfo.setText("Nothing active"); return; } int nbFtps = fpool.getPoolSize(); jlbHostName.setText(fpool.getFtp().getTitle()); int active = 0; for (int i = 0; i < nbFtps; i++) { if (fpool.isBusy(i)) { active++; } } jlbFtpInfo.setText(nbFtps + " conn, " + active + " busy"); } /** * Description of the Method * *@param e Description of the Parameter */ public void actionPerformed(ActionEvent e) { if (fpool == null) { return; } Object obj = e.getSource(); if (obj == addFtp) { fpool.addFtpClient(); } else if (obj == remFtp) { fpool.removeFtpClient(); } else if (obj == closeFtp) { FtpContainer.getContainer().removeFtpPool(fpool.getFtp()); } else if (obj == jcbIsBinary) { fpool.setBinary(jcbIsBinary.isSelected()); } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -