资源描述:
《java fsfc sjf 带界面完整实现(源代码)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、JavaFSFCSJF带界面完整实现(源代码)packagework1;importjava.awt.FileDialog;importjava.awt.Font;importjava.awt.GridLayout;importjava.awt.TextArea;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.awt.event.WindowAdapter;importjava.awt.event.WindowE
2、vent;importjava.io.File;importjava.io.FileNotFoundException;importjava.io.FileReader;importjava.io.FileWriter;importjava.io.IOException;importjava.util.ArrayList;importjavax.swing.JButton;importjavax.swing.JFileChooser;importjavax.swing.JFrame;importjavax.swing.JO
3、ptionPane;importjavax.swing.JPanel;importjavax.swing.JToolBar;importjavax.swing.filechooser.FileNameExtensionFilter;publicclassMainextendsJFrameimplementsActionListener{staticpublicTextAreatext,output0,output1;privateJFileChooserfchooser;FileDialogfile_dialog_load
4、=newFileDialog(this,"Openfile...",FileDialog.LOAD);JPanelpan1=newJPanel();JPanelpan2=newJPanel();inttime=0;privateFilefile;publicMain(){//TODOAuto-generatedconstructorstubsuper("先来先服务FCFS和短作业优先SJF进程调度算法实现");Fontx=newFont("Serif",0,20);this.setBounds(400,300,900,90
5、0);this.setDefaultCloseOperation(HIDE_ON_CLOSE);this.text=newTextArea("作业情况输入");text.setEditable(true);text.setFont(x);//this.getContentPane().add(newJScrollPane(this.text),"Center");this.output0=newTextArea("FCFS");output0.setEditable(false);output0.setFont(x);//
6、this.getContentPane().add(newJScrollPane(this.output0),"South");this.output1=newTextArea("SJF");output1.setEditable(false);output1.setFont(x);//this.getContentPane().add(newJScrollPane(this.output1),"North");pan1.setLayout(newGridLayout(3,1));pan1.add(text,"North"
7、);//pan2.setLayout(newGridLayout(2,1));pan1.add(output0,"Center");pan1.add(output1,"South");getContentPane().add(pan1,"Center");//getContentPane().add(pan2,"South");///////////////////////////////////JToolBartoolbar=newJToolBar();this.getContentPane().add(toolbar,
8、"North");JButtonbopen=newJButton("导入作业情况文件");bopen.addActionListener(this);toolbar.add(bopen);JButtonbsave0=newJButton("保存FCFS结果");bsave0.addActionListe