?? jftppoolinfoframe.java
字號:
/** * File and FTP Explorer * Copyright 2002 * 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.ressource.*;import javax.swing.*;import javax.swing.border.*;/** *@author BOESCH Vincent *@created 21 janvier 2002 *@version 3.3 */public class JFtpPoolInfoFrame extends JInternalFrame implements ActionListener, Runnable { private JPanel jPanel1 = new JPanel(); private JButton jbtHide = new JButton(); private TitledBorder titledBorder1; private Thread thdPool = null; private JTabbedPane jtpInfo = new JTabbedPane(); private JScrollPane jScrollPane1 = new JScrollPane(jtpInfo); public int poolNumDefault = 5; public long sleepTime = 2000; FtpPoolPanel[] tb_Panel = new FtpPoolPanel[poolNumDefault]; /** * Constructeur objet JInfoFrame * *@param showOnStart Description of the * Parameter */ public JFtpPoolInfoFrame() { super("FTP Info", true, true, false, false); try { jbInit(); } catch (Exception e) { javaexplorer.util.Log.addError(e); } thdPool = new Thread(this); thdPool.start(); } public void run() { try { while (true) { updateProperties(); repaint(); if (thdPool != null && thdPool == Thread.currentThread() ) { Thread.sleep(sleepTime); } } } catch (InterruptedException ie) { javaexplorer.util.Log.addError(ie); } } /** *@param e Description of the Parameter */ public void actionPerformed(ActionEvent e) { Object obj = e.getSource(); if (obj == jbtHide) { this.setVisible(false); } } /** *@throws Exception Description of the * Exception */ private void jbInit() throws Exception { this.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE); this.setTitle("FTP Info"); titledBorder1 = new TitledBorder(""); for (int i = 0; i < poolNumDefault; i++) { tb_Panel[i] = new FtpPoolPanel(null); jtpInfo.addTab("HostName", tb_Panel[i]); } jbtHide.setText("Hide"); jbtHide.addActionListener(this); jPanel1.add(jbtHide, null); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add(jScrollPane1, BorderLayout.CENTER); this.getContentPane().add(jPanel1, BorderLayout.SOUTH); if (ImageRessource.iiInfo != null) { this.setFrameIcon(ImageRessource.iiInfo); } setBounds(10, 10, 450, 250); setOpaque(true); setVisible(true); } public void updateProperties() { FtpPool[] pools = FtpContainer.getContainer().getPools(); int size = (pools != null) ? pools.length : 0; for (int i = 0; i < size; i++) { tb_Panel[i].refreshPool(pools[i]); jtpInfo.setTitleAt(i, pools[i].getFtp().getTitle()); } for (int i = size; i < poolNumDefault; i++) { tb_Panel[i].refreshPool(null); jtpInfo.setTitleAt(i, "HostName"); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -