mainframe.java
来自「java网络高级编程的配套源码,java网络高级编程为清华出版社出版.」· Java 代码 · 共 158 行
JAVA
158 行
/*源程序清单7-6*/
package CopyFile;
import java.awt.*;
import java.awt.event.*;
import borland.jbcl.layout.*;
import borland.jbcl.control.*;
public class MainFrame extends Frame
{
TextField textField1 = new TextField();
Button button1 = new Button();
Label label1 = new Label();
Label label2 = new Label();
TextField textField2 = new TextField();
Button button2 = new Button();
Button button3 = new Button();
Button button4 = new Button();
Label label3 = new Label();
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() throws Exception
{
this.setSize(new Dimension(454, 154));
this.setTitle("拷贝文件");
this.setBackground(new Color(192,192,192));
button1.setLabel("浏览...");
button1.addActionListener(new MainFrame_button1_actionAdapter(this));
label1.setAlignment(2);
label1.setText("源文件:");
label2.setAlignment(2);
label2.setText("目的文件:");
button2.setLabel("复制");
button2.addActionListener(new MainFrame_button2_actionAdapter(this));
button3.setLabel("退出");
button4.setLabel("浏览...");
label3.setText("请输入或选择源文件(夹)和目标文件(夹):");
groupBox1.setLayout(paneLayout3);
groupBox1.setLabel("下载队列");
panel1.setLayout(paneLayout2);
button4.addActionListener(new MainFrame_button4_actionAdapter(this));
button3.addActionListener(new MainFrame_button3_actionAdapter(this));
this.setLayout(paneLayout1);
this.add(panel1, new PaneConstraints("panel1", "panel1", PaneConstraints.ROOT, 0.5f));
panel1.add(groupBox1, new PaneConstraints("groupBox1", "groupBox1", PaneConstraints.ROOT, 1.0f));
groupBox1.add(list1, new PaneConstraints("list1", "list1", PaneConstraints.ROOT, 1.0f));
this.add(label3, new PaneConstraints("label3", "panel1", PaneConstraints.LEFT, 0.6300448f));
this.add(label1, new PaneConstraints("label1", "label3", PaneConstraints.BOTTOM, 0.68589747f));
this.add(label2, new PaneConstraints("label2", "label1", PaneConstraints.BOTTOM, 0.6730769f));
this.add(textField1, new PaneConstraints("textField1", "label1", PaneConstraints.RIGHT, 0.76868325f));
this.add(button1, new PaneConstraints("button1", "textField1", 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", "textField2", 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);
frame.show();
}
void button1_actionPerformed(ActionEvent e)
{
}
void button2_actionPerformed(ActionEvent e)
{
}
void button3_actionPerformed(ActionEvent e)
{
}
void button4_actionPerformed(ActionEvent e)
{
}
}
class MainFrame_button1_actionAdapter implements java.awt.event.ActionListener
{
MainFrame adaptee;
MainFrame_button1_actionAdapter(MainFrame adaptee)
{
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e)
{
adaptee.button1_actionPerformed(e);
}
}
class MainFrame_button2_actionAdapter implements java.awt.event.ActionListener
{
MainFrame adaptee;
MainFrame_button2_actionAdapter(MainFrame adaptee)
{
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e)
{
adaptee.button2_actionPerformed(e);
}
}
class MainFrame_button3_actionAdapter implements java.awt.event.ActionListener
{
MainFrame adaptee;
MainFrame_button3_actionAdapter(MainFrame adaptee)
{
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e)
{
adaptee.button3_actionPerformed(e);
}
}
class MainFrame_button4_actionAdapter implements java.awt.event.ActionListener
{
MainFrame adaptee;
MainFrame_button4_actionAdapter(MainFrame adaptee)
{
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e)
{
adaptee.button4_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?