📄 datacollectsysframe.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DataCollectSysFrame extends JFrame {
public DataCollectSysFrame() {
super( "The data collection system" );
JMenuBar menuBar = new JMenuBar();
setJMenuBar ( menuBar );
JMenu menuServer = new JMenu("TheServer");
JMenuItem menuCreateFormat= new JMenuItem( "Create Format-file" );
// Add action listener.for the menu button
menuCreateFormat.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ServerCreateFile();
}
}
);
JMenuItem menuReadFormat = new JMenuItem( "Display Format-file" );
// Add action listener.for the menu button
menuReadFormat.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ClientReadFile();
}
}
);
menuServer.add(menuCreateFormat);
menuServer.add(menuReadFormat);
menuBar.add(menuServer);
JMenu menuClient = new JMenu( "TheClient");
JMenuItem menuCreateDataFile = new JMenuItem( "Create Data-file " );
menuCreateDataFile.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
new CreateFile();
}
}
);
JMenuItem menuReadDataFile = new JMenuItem( "Read Data-file " );
menuReadDataFile.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ReadFile();
}
}
);
JMenuItem menuShowFormat = new JMenuItem( "Show Format-file" );
// Add action listener.for the menu button
menuShowFormat.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
new ClientReadFile();
}
}
);
menuClient.add(menuCreateDataFile);
menuClient.add(menuReadDataFile);
menuClient.add(menuShowFormat);
menuBar.add(menuClient);
JMenu menuModify = new JMenu( "Modify");
JMenuItem menuModifyDo = new JMenuItem( "Modify data file" );
// Add action listener.for the menu button
//JPanel m;
menuModifyDo.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Modify2();
//I can not implement the internal frame!!
}
}
);
menuModify.add( menuModifyDo );
menuBar.add( menuModify );
addWindowListener(
new WindowAdapter() {
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
}
);
setTitle("DataCollectSys");
setSize(new Dimension(600, 400));
show();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -