📄 澶嶄欢 startdialog.java
字号:
package desktop;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.UIManager;
import javax.swing.tree.*;
import java.io.*;
import javax.swing.table.*;
import java.util.*;
import javax.swing.event.*;
import javax.swing.filechooser.*;
public class startDialog extends JFrame implements ActionListener
{
private JButton BT_OK = new JButton("确定");
private JButton BT_CANCEL = new JButton("取消");
private JLabel CPUTIME_JL1 = new JLabel("系统时钟");
private JTextField CPUTIME_JTF = new JTextField("1000");
private JLabel CPUTIME_JL2 = new JLabel("ms");
private JLabel MEMBLOCK_JL1 = new JLabel("内存块数");
private JTextField MEMBLOCK_JTF = new JTextField("10");
private JLabel MEMBLOCK_JL2 = new JLabel("个");
private JLabel PAGE_SIZE_JL1 = new JLabel("内存块的大小");
private JTextField PAGE_SIZE_JTF = new JTextField("4");
private JLabel PAGE_SIZE_JL2 = new JLabel("块");
private JLabel HD_SIZE_JL1 = new JLabel("硬盘大小");
private JTextField HD_SIZE_JTF = new JTextField("10");
private JLabel HD_SIZE_JL2 = new JLabel("条作业");
private JLabel PAGES_JL1 = new JLabel("每个作业分配的页面数");
private JTextField PAGES_JTF = new JTextField("");
private JLabel PAGES_JL2 = new JLabel("页");
private JLabel TIMEBLOCK_JL1 = new JLabel("每个进程分配的时间片");
private JTextField TIMEBLOCK_JTF = new JTextField("1");
private JLabel TIMEBLOCK_JL2 = new JLabel("片");
private JLabel TABLECOUNTS_JL1 = new JLabel("页表缓冲");
private JTextField TABLECOUNTS_JTF = new JTextField("5");
private JLabel TABLECOUNTS_JL2 = new JLabel("个");
private JPanel JP_contentPane = new JPanel(null);
public startDialog(String title)
{
super(title);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
dispose();
System.exit(0);
}
});
Container Desktop_frame=getContentPane();
Desktop_frame.setLayout(null);
this.setSize(400,300);
this.setVisible(true);
this.setResizable(false);
Toolkit t=Toolkit.getDefaultToolkit();
Dimension w=t.getScreenSize();
this.setLocation((w.width)/2-200,(w.height)/2-150);
BT_OK.addActionListener(this);
Desktop_frame.add(BT_OK);
Desktop_frame.add(BT_CANCEL);
Desktop_frame.add(CPUTIME_JL1);
Desktop_frame.add(CPUTIME_JTF);
Desktop_frame.add(CPUTIME_JL2);
Desktop_frame.add(MEMBLOCK_JL1);
Desktop_frame.add(MEMBLOCK_JTF);
Desktop_frame.add(MEMBLOCK_JL2);
Desktop_frame.add(PAGE_SIZE_JL1);
Desktop_frame.add(PAGE_SIZE_JTF);
Desktop_frame.add(PAGE_SIZE_JL2);
Desktop_frame.add(HD_SIZE_JL1);
Desktop_frame.add(HD_SIZE_JTF);
Desktop_frame.add(HD_SIZE_JL2);
Desktop_frame.add(PAGES_JL1);
Desktop_frame.add(PAGES_JTF);
Desktop_frame.add(PAGES_JL2);
Desktop_frame.add(TIMEBLOCK_JL1);
Desktop_frame.add(TIMEBLOCK_JTF);
Desktop_frame.add(TIMEBLOCK_JL2);
Desktop_frame.add(TABLECOUNTS_JL1);
Desktop_frame.add(TABLECOUNTS_JTF);
Desktop_frame.add(TABLECOUNTS_JL2);
BT_OK.setBounds(0,0,100,30);
BT_CANCEL.setBounds(0,40,100,30);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==BT_OK)
{
this.setVisible(false);
new Desktop();
}
}
public static void main(String args[])
{
try {
LookAndFeel alloy = new com.incors.plaf.alloy.AlloyLookAndFeel();
UIManager.setLookAndFeel(alloy);
Font font =new Font("宋体",Font.PLAIN,12);
String names[]={"Label","CheckBox","PopupMenu","TextPane",
"MenuItem","CheckBoxMenuItem","JRadioButtonMenuItem",
"ComboBox","Button","Tree","ScrollPane","TabbedPane",
"EditorPane","TitledBorder","Menu","TextArea","OptionPane",
"MenuBar","ToolBar","ToggleButton","ToolTip","ProgressBar",
"TableHeader","Panel","List","ColorChooser","PasswordField",
"TextField","Table","Label","Viewport","RadioButtonMenuItem",
"RadioButton"};
for(int i=0;i<names.length;i++)UIManager.put(names[i]+".font",font);
UIManager.put("Label.foreground",Color.black);
UIManager.put("Border.foreground",Color.black);
UIManager.put("TitledBorder.titleColor",Color.black);
new startDialog("初始化对话框");
}catch(Exception e){
e.printStackTrace();
}
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -