📄 6-5.txt
字号:
package CopyFile;
import java.awt.*;
import java.awt.event.*;
import borland.jbcl.layout.*;
import borland.jbcl.control.*;
import.java.io.*;
import.java.util.*;
public class MainFrame extends Frame {
TextField textFedle1=new textField();
Bubtton button1=new Button();
Label labell=new Label();
Label labe12=new Label();
TextField textField2=new TextField();
Button button2=new Button();
Button button3=new Button();
Filer filer1=new Filer(″选择源文件″,Filer.LOAD);
Filer filer2=new Filer(this,″选择目的文件″, Filer.SAVE);
Button button4=new Button();
PrepareCopyFile pCopyFile=null;
Labe label3=new Label();
Panel panel=new Pane();
Panel panel1=new Panel();
PaneLayout paneLayout1=new PaneLayout();
PaneLayout paneLayout2=new PaneLayout();
GroupBox groupBox1=new GroupBox();
List list1=new List();
PaneLayout paneLayout3=new PaneLayout();
Public MainFrame()
{
try{
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
private void jbInit() thows Excption {
this.setSize(new Dimension(454.154));
this.setBackgrond(new Color(192,192,192));
button1.setLabl(″浏览...″)
btton.addActionListener(new MainFrame_button1_actionAdapter(this));
Btton.addActionListener(new MainFrame_button1_actionAdapter(this));
labell.setAlignment(2);
labell.setText(″源文件″);
labell.setAlignment(2);
label2.setText(“目的文件″);
button2.setLabel(″复制″);
button2.addActionListener(new MainFrame_button2_actionAdapter(this));
button3.setLabel(″退出″);
button3.addActionListener(new MainFrame_button3_actionAdapter(this));
button4.setLabel(″浏览...″);
button4.addActionListener(new MainFrame_button4_actionAdqapter(this));
label3.setText(“请输入选择源文件(夹)和目标文件(夹):”);
groupBox1.setLayout(paneLayout3);
groupBox1.setLabele(″下载队列″);
panel1.setLayout(paneLayout2);
this.setLayout(paneLayout1);
this.add(pane11,new PaneConstraint
(″panell″, ″panell″,PaneConstraints.ROOT,0.5f));
panel.add(groupBox1. , new PaneConstraints
(“groutpBox1”,“groupBox1”,PaneConstraints.ROOT,1.0f));
GroupBo1.add(list1, new PaneConstraints
(“list”,“listl”,PaneConstraint.ROOT,1.0f));
this.add(labe13, new PaneConstraint
(“label3”, “panell”,PaneConstraints.LEET,0.6300448f));
this.add(labell. ,new PaneConstraint
(“labell”,“label3”,PaneConstraints.BOTTOM,0.68589747f))this.add(textFieldl,new PaneConstraint
(“label2”,“labell”,PaneConstraints.BOTTOM,0.6730769f))
this.add(textField,new PaneConstrains
(“textField1”,“labell”,PaneConstraints.RIGHT,0.76868325f))
this.add(buttonl,new PaneConstraints
(“buttonl”,“textFieldl”,PaneConstraints.RIGHT,0.3442623f));
this.add(button2,new PaneConstraints
(“button2”,“label2”,PaneConstraints,BOTTOM,0.57142854f));
this.add(textField2,new PaneConstraints
(“textField2”,“Label2”,PaneConstraints.RIGHT,0.76868325f));
this.add(button4,new PaneConstraints
(“button4”,“textFileld2”,PaneConstraints.RIGHT,0.3442623f));
this.add(button3,new PaneConstraints
(“button3”,“button2”,PaneConstraints.RIGHT,0.4798851f));
}
public static void main(String[] args) {
MainFrame frame=new MainFrame();
frame.setLocation(200.200);
frame.setSize(450,150)l
frame.show();
}
void buttonl_actionPerformed(ActionEvent e) {
filerl.show();
String dir=feler1.getDirectory();
String file=feler1.getFile();
if(dir.equals(″null″)&&file.equals(″null″)return;
textField1.setText(dir+file);
}
void button2_actionPerformed(ActionEvent e) {
String sourceName=textFileld.getText();
String desName=textField2.getText();
if(sourceName.equals(′′′′)‖desName.equals(′′′′)return;
pCopyFile=new PrepareCopyFile(this,sourceName,desName);
pCopyFile.stary();
}
void addCopyingFile(String sname) {
File file=new File(same);
String sfilename=file.getName();
list1.addItem(sfilename);
}
void removeCopyingFile(String sname) {
File file=new File(sname);
String sfilename=file.getName();
}
void button3_actionPerformed(ActionEvent e) {
MessageDialog mdlg=new MessageDialog(this,“警告”,确定要退出吗?”,6);
mdlg.setSize(150,80);
mdlg.show();
if(mdlg.getResult()= =MessageDialog.No)
return;
System.exit(0);
}
void button4_actionPerformed(ActionEvent e) {
filer2.show();
String dir=filer2.getDirectory();
String file=filer2.getFile();
if(dir.equals(″null″)&&file.equals(″null″))return;
textField2.setText(dir+file);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -