📄 ftpframe.java
字号:
* This method initializes receiveButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getReceiveButton() {
if (receiveButton == null) {
receiveButton = new javax.swing.JButton();
receiveButton.setBounds(20, 60, 97, 25);
receiveButton.setText("<< Receive");
receiveButton.setName("receiveButton");
receiveButton.addActionListener(this);
}
return receiveButton;
}
/**
* This method initializes deleteButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getDeleteButton() {
if (deleteButton == null) {
deleteButton = new javax.swing.JButton();
deleteButton.setBounds(20, 110, 97, 25);
deleteButton.setText("Delete File");
deleteButton.setName("deleteButton");
deleteButton.addActionListener(this);
}
return deleteButton;
}
/**
* This method initializes newFolderButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getNewFolderButton() {
if (newFolderButton == null) {
newFolderButton = new javax.swing.JButton();
newFolderButton.setBounds(20, 140, 97, 25);
newFolderButton.setText("New Folder");
newFolderButton.setName("newFolderButton");
newFolderButton.addActionListener(this);
}
return newFolderButton;
}
/**
* This method initializes stopButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getStopButton()
{
if (stopButton == null)
{
stopButton = new javax.swing.JButton();
stopButton.setBounds(20, 200, 97, 25);
stopButton.setText("Stop");
stopButton.setName("stopButton");
stopButton.addActionListener(this);
stopButton.setVisible(false);
}
return stopButton;
}
/**
* This method initializes closeButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getCloseButton() {
if (closeButton == null) {
closeButton = new javax.swing.JButton();
closeButton.setBounds(20, 325, 97, 25);
closeButton.setText("Close");
closeButton.setName("closeButton");
closeButton.addActionListener(this);
}
return closeButton;
}
/**
* This method initializes dummyButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getDummyButton() {
if (dummyButton == null) {
dummyButton = new javax.swing.JButton();
dummyButton.setBounds(12, 206, 99, 25);
dummyButton.setText("aaaaaaaaaaaaaaa");
dummyButton.setName("DummyButton");
dummyButton.setVisible(false);
}
return dummyButton;
}
/**
* This method initializes localDrivesComboBox
*
* @return javax.swing.JComboBox
*/
private javax.swing.JComboBox getLocalDrivesComboBox() {
updateDriveList = true;
// Read in Drive letters from local disk
File[] roots = File.listRoots();
String[] localDisks = new String[roots.length];
for (int i = 0; i < roots.length; i++) {
localDisks[i] = roots[i].toString();
}
// Create the combo box
if (localDrivesComboBox == null) {
localDrivesComboBox = new javax.swing.JComboBox(localDisks);
localDrivesComboBox.setName("LocalDisks");
localDrivesComboBox.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
//Select the second entry (e.g. C:\)
// localDrivesComboBox.setSelectedIndex(1);
localDrivesComboBox.addActionListener(this);
}
updateDriveList = false;
return localDrivesComboBox;
}
/**
* This method initializes remoteDrivesComboBox
*
* @return javax.swing.JComboBox
*/
public javax.swing.JComboBox getRemoteDrivesComboBox() {
if (remoteDrivesComboBox == null) {
remoteDrivesComboBox = new javax.swing.JComboBox();
remoteDrivesComboBox.setName("remoteDisks");
remoteDrivesComboBox.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
remoteDrivesComboBox.addActionListener(this);
}
return remoteDrivesComboBox;
}
/**
* This method initializes localMachineLabel
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getLocalMachineLabel() {
if (localMachineLabel == null) {
localMachineLabel = new javax.swing.JTextField();
localMachineLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
// localMachineLabel.setPreferredSize(new java.awt.Dimension(150, 19));
localMachineLabel.setBackground(java.awt.Color.lightGray);
localMachineLabel.setText(" LOCAL MACHINE");
localMachineLabel.setName("localLocation");
localMachineLabel.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 11));
localMachineLabel.setEditable(false);
}
return localMachineLabel;
}
/**
* This method initializes remoteMachineLabel
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getRemoteMachineLabel() {
if (remoteMachineLabel == null) {
remoteMachineLabel = new javax.swing.JTextField();
// remoteMachineLabel.setPreferredSize(new java.awt.Dimension(150, 19));
remoteMachineLabel.setName("remoteLocation");
remoteMachineLabel.setText(" REMOTE MACHINE");
remoteMachineLabel.setBackground(java.awt.Color.lightGray);
remoteMachineLabel.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 11));
remoteMachineLabel.setEditable(false);
}
return remoteMachineLabel;
}
/**
* This method initializes localTopButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getLocalTopButton() {
if (localTopButton == null) {
localTopButton = new javax.swing.JButton();
localTopButton.setText("Root (\\)");
// localTopButton.setPreferredSize(new java.awt.Dimension(30, 19));
localTopButton.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
localTopButton.addActionListener(this);
}
return localTopButton;
}
/**
* This method initializes remoteTopButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getRemoteTopButton() {
if (remoteTopButton == null) {
remoteTopButton = new javax.swing.JButton();
remoteTopButton.setText("Root (\\)");
// remoteTopButton.setPreferredSize(new java.awt.Dimension(49, 25));
remoteTopButton.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
remoteTopButton.addActionListener(this);
}
return remoteTopButton;
}
/**
* This method initializes localFileTable
*
* @return javax.swing.JTable
*/
private javax.swing.JList getLocalFileTable() {
if (localFileTable == null) {
localList = new Vector(0);
localFileTable = new JList(localList);
localFileTable.addMouseListener(this);
localFileTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
return localFileTable;
}
/**
* This method initializes localScrollPane
*
* @return javax.swing.JScrollPane
*/
private javax.swing.JScrollPane getLocalScrollPane() {
if (localScrollPane == null) {
localScrollPane = new javax.swing.JScrollPane();
localScrollPane.setViewportView(getLocalFileTable());
localScrollPane.setPreferredSize(new java.awt.Dimension(325, 418));
localScrollPane.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
localScrollPane.setName("localFileList");
}
return localScrollPane;
}
/**
* This method initializes remoteFileTable
*
* @return javax.swing.JTable
*/
private javax.swing.JList getRemoteFileTable() {
if (remoteFileTable == null) {
remoteList = new Vector(0);
remoteFileTable = new JList(remoteList);
remoteFileTable.addMouseListener(this);
remoteFileTable.setSelectedValue("C:\\", false);
remoteFileTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
return remoteFileTable;
}
/**
* This method initializes remoteScrollPane
*
* @return javax.swing.JScrollPane
*/
private javax.swing.JScrollPane getRemoteScrollPane() {
if (remoteScrollPane == null) {
remoteScrollPane = new javax.swing.JScrollPane();
remoteScrollPane.setViewportView(getRemoteFileTable());
remoteScrollPane.setPreferredSize(new java.awt.Dimension(325, 418));
}
return remoteScrollPane;
}
/**
* This method initializes remoteLocation
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getRemoteLocation()
{
if (remoteLocation == null)
{
remoteLocation = new javax.swing.JTextField();
remoteLocation.setText("");
remoteLocation.setEditable(false); // sf@2004
remoteLocation.setBackground(new Color(255,255,238));
remoteLocation.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
}
return remoteLocation;
}
/**
* This method initializes localLocation
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getLocalLocation() {
if (localLocation == null) {
localLocation = new javax.swing.JTextField();
localLocation.setText("");
localLocation.setEditable(false); // sf@2004
localLocation.setBackground( new Color(255,255,238));
localLocation.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
}
return localLocation;
}
/**
* This method initializes localStatus
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getLocalStatus() {
if (localStatus == null) {
localStatus = new javax.swing.JTextField();
// localStatus.setText("> Found 63 File(s) 7 Directorie(s)");
localStatus.setBackground(java.awt.Color.lightGray);
localStatus.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
localStatus.setEditable(false);
}
return localStatus;
}
/**
* This method initializes remoteStatus
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getRemoteStatus() {
if (remoteStatus == null) {
remoteStatus = new javax.swing.JTextField();
// remoteStatus.setText("> Found 15 File(s) 2 Directorie(s)");
remoteStatus.setBackground(java.awt.Color.lightGray);
remoteStatus.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
remoteStatus.setEditable(false);
}
return remoteStatus;
}
/**
* This method initializes historyComboBox
*
* @return javax.swing.JComboBox
*/
private javax.swing.JComboBox getHistoryComboBox() {
if (historyComboBox == null) {
historyComboBox = new javax.swing.JComboBox();
historyComboBox.setFont(
new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
historyComboBox.insertItemAt(new String("Pulldown to view history ..."),0);
historyComboBox.setSelectedIndex(0);
historyComboBox.addActionListener(this);
}
return historyComboBox;
}
/**
* This method initializes jProgressBar
*
* @return javax.swing.JProgressBar
*/
private javax.swing.JProgressBar getJProgressBar() {
if (jProgressBar == null) {
jProgressBar = new javax.swing.JProgressBar();
}
return jProgressBar;
}
/**
* This method initializes connectionStatus
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getConnectionStatus() {
if (connectionStatus == null) {
connectionStatus = new javax.swing.JTextField();
connectionStatus.setText("Connected...");
connectionStatus.setBackground(java.awt.Color.lightGray);
connectionStatus.setFont(
new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10));
}
connectionStatus.setEditable(false);
return connectionStatus;
}
/**
* Implements Action listener.
*/
public void actionPerformed(ActionEvent evt) {
System.out.println(evt.getSource());
if (evt.getSource() == closeButton)
{ // Close Button
doClose();
}
else if (evt.getSource() == sendButton)
{
doSend();
}
else if (evt.getSource() == receiveButton)
{
doReceive();
}
else if (evt.getSource() == localDrivesComboBox)
{
changeLocalDrive();
}
else if (evt.getSource() == remoteDrivesComboBox)
{
changeRemoteDrive();
remoteList.clear();
remoteFileTable.setListData(remoteList);
}
else if (evt.getSource() == localTopButton)
{
changeLocalDrive();
}
else if (evt.getSource() == remoteTopButton)
{
changeRemoteDrive();
}
else if(evt.getSource() == deleteButton)
{
doDelete();
}
else if(evt.getSource()==newFolderButton)
{
doNewFolder();
}
else if (evt.getSource() == stopButton)
{
doStop();
}
}
private void doNewFolder()
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -