📄 ftpfilepanel.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.ftp.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import server.ftp.FtpConfig;
/**
* This panel displays all the logged in users.
*
* @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>.
*/
public
class FtpFilePanel extends PluginPanel {
private FtpConfig mConfig;
private FtpFileTableModel mModel;
private String mstHeader;
/**
* Instantiate login panel.
*/
public FtpFilePanel(FtpTree tree, FtpFileTableModel model, String header) {
super(tree);
mModel = model;
mstHeader = header;
initComponents();
}
/**
* Initialize UI components
*/
private void initComponents() {
setLayout(new BorderLayout());
JPanel topPane = new JPanel();
JLabel headerLab = new JLabel(mstHeader);
headerLab.setForeground(Color.black);
topPane.add(headerLab);
add(topPane, BorderLayout.NORTH);
JTable fileTable = new JTable(mModel);
fileTable.setPreferredScrollableViewportSize(new Dimension(470, 300));
fileTable.setColumnSelectionAllowed(false);
JScrollPane scrollPane = new JScrollPane(fileTable,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
add(scrollPane, BorderLayout.CENTER);
// button
JPanel bottomPanel = new JPanel();
JButton jResetBtn = new JButton("Clear");
bottomPanel.add(jResetBtn);
add(bottomPanel, BorderLayout.SOUTH);
// event handler
jResetBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
mModel.reset();
}
});
}
/**
* Refresh window.
*/
public void refresh(FtpConfig config) {
mModel.reset();
mConfig = config;
}
/**
* Not displayable when server stopped.
*/
public boolean isDisplayable() {
return mConfig != null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -