资源简介
使用Java实现操作系统中移动臂磁盘调度算法,包括先来先服务调度算法、最短寻找时间优先调度算法、电梯调度算法、单向扫描和双向扫描调度算法,有简单的图形用户界面和通过线程动态显示

代码片段和文件信息
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.titledBorder;
public class ArithPane extends JPanel implements ActionListener Runnable {
/**
*
*/
private static final long serialVersionUID = 1L;
JButton button1 button2 button3 button4 button5 backButton;
JLabel label;
LogPane log;
int now = 0 max = 0 meth = 0;
private Thread thread;
private int sleeptime = 1000;
public ArithPane() {
// TODO 自动生成的构造函数存根
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
e.printStackTrace();
}
this.setLayout(null);
this.setBorder(new titledBorder(“模拟移动臂磁盘调度界面“));
log = LogPane.getLog();
label = new JLabel(“请选择以下算法来模拟移动臂磁盘调度:“);
label.setBounds(20 20 350 30);
backButton = new JButton(“返回“);
backButton.setBounds(530 15 80 30);
backButton.addActionListener(this);
button1 = new JButton(“先来先服务调度算法“);
button1.setBounds(170 80 250 30);
button1.addActionListener(this);
button2 = new JButton(“最短寻找时间优先调度算法“);
button2.setBounds(170 120 250 30);
button2.addActionListener(this);
button3 = new JButton(“电梯调度算法“);
button3.setBounds(170 160 250 30);
button3.addActionListener(this);
button4 = new JButton(“单向扫描调度算法“);
button4.setBounds(170 200 250 30);
button4.addActionListener(this);
button5 = new JButton(“双向扫描调度算法“);
button5.setBounds(170 240 250 30);
button5.addActionListener(this);
this.add(backButton);
this.add(label);
this.add(button1);
this.add(button2);
this.add(button3);
this.add(button4);
this.add(button5);
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO 自动生成的方法存根
if (e.getSource() == backButton) {
DiskOperation.showCard();
log.addLog(“返回到主界面!“);
meth = 0;
}
if (e.getSource() == button1) {
int len = JOptionPane.showConfirmDialog(this “你选择的是先来先服务调度算法“ “提示“ JOptionPane.YES_NO_OPTION);
if (len == JOptionPane.OK_OPTION) {
try {
String str = JOptionPane.showInputDialog(this “请输入当前磁道号“ “提示“ JOptionPane.INFORMATION_MESSAGE);
now = Integer.parseInt(str);
log.addLog(“正在模拟先来先服务调度算法...“);
log.addLog(“当前磁道号为:“ + now);
meth = 1;
} catch (Exception e1) {
e1.printStackTrace();
JOptionPane.showMessageDialog(this “输入类型错误或者未输入!“ “提示“ JOptionPane.WARNING_MESSAGE);
log.addLog(e1.toString());
}
}
}
if (e.getSource() == button2) {
int len = JOptionPane.showConfirmDialog(this “你选择的是最短寻找时间优先算调度算法“ “提示“ JOptionPane.YES_NO_OPTION);
if (len == JOptionPane.OK_OPTION) {
try {
String str = JOptionPane.showInputDialog(this “请输入当前磁道号“ “提示“ JOptionPane.INFORMATION_MESSAGE);
now = Integer.parseInt(str);
log.addLog(“正在模拟最短寻找时间优先算调度算法...“);
log.addLog(“当前磁道号为:“ + now);
meth = 2;
} catch (Exception e1) {
e1.printStackTrace();
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-29 08:46 Mobile Arm\
文件 301 2018-12-29 08:46 Mobile Arm\.classpath
文件 386 2018-12-29 08:46 Mobile Arm\.project
目录 0 2018-12-29 08:46 Mobile Arm\.settings\
文件 598 2018-12-29 08:46 Mobile Arm\.settings\org.eclipse.jdt.core.prefs
目录 0 2019-01-06 11:11 Mobile Arm\bin\
文件 13990 2019-01-06 11:11 Mobile Arm\bin\ArithPane.class
文件 4937 2019-01-06 14:38 Mobile Arm\bin\DiskOperation.class
文件 1666 2019-01-06 11:11 Mobile Arm\bin\LogPane.class
目录 0 2019-01-03 13:48 Mobile Arm\src\
文件 18527 2019-01-04 23:47 Mobile Arm\src\ArithPane.java
文件 3592 2019-01-06 12:25 Mobile Arm\src\DiskOperation.java
文件 936 2019-01-03 09:59 Mobile Arm\src\LogPane.java
相关资源
- java笔试题大全java笔试,面试笔试,逻
- Windows bat 设置Java环境变量
- java 毕业设计 进销存管理系统 源码
- java图片浏览器跨平台运行程序与源码
- 基于java的在线考试系统-毕业设计
- 微博系统(Java源码,servlet+jsp),适
- java串口通信全套完整代码-导入eclip
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
评论
共有 条评论