91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 31KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-14
  • 語言: Java
  • 標簽: java??ui界面??

資源簡介

JAVA實現的銀行家算法 做了ui有界面,原本來源于網絡,但是自己做了修改!適合用于對付老師的大實驗!

資源截圖

代碼片段和文件信息

import?java.awt.GridLayout;
import?java.awt.event.ActionEvent;
import?java.awt.event.ActionListener;
import?javax.swing.JButton;
import?javax.swing.JDialog;
import?javax.swing.Jframe;
import?javax.swing.JLabel;
import?javax.swing.JOptionPane;
import?javax.swing.JPanel;
import?javax.swing.JTextField;

public?class?AddProcess?extends?JDialog?implements?ActionListener?{
private?static?final?long?serialVersionUID?=?-4063443304983396100L;

public?static?boolean?InputEffiencent?=?true;
public?static?boolean?InputError?=?false;

private?JButton?okButton;
private?JButton?cancelButton;

private?JTextField?processName;
private?JTextField[]?textMaxNeed;
private?JTextField[]?textAllocated;
private?int[]?maxNeed?=?null;
private?int[]?allocated?=?null;
private?String?name;

private?boolean?returnResult?=?InputError;?//?InputEffiencent?InputError.

private?final?int?lineHeight?=?35;
private?final?int?width?=?65;

public?AddProcess(Jframe?owner?int?resourceClassesCount)?{
super(owner?“添加新進程“?true);
textMaxNeed?=?new?JTextField[resourceClassesCount];
textAllocated?=?new?JTextField[resourceClassesCount];
maxNeed?=?new?int[resourceClassesCount];
allocated?=?new?int[resourceClassesCount];
processName?=?new?JTextField();
JPanel?panel?=?new?JPanel(new?GridLayout(resourceClassesCount?+?3?3));
panel.add(new?JLabel(“進程名“));
panel.add(processName);
panel.add(new?JLabel());?//?站位作用.
panel.add(new?JLabel(“資源名“));?//?站位作用.
panel.add(new?JLabel(“Max“));
panel.add(new?JLabel(“Allocation“));

for?(int?i?=?0;?i? String?resourceName?=?“資源R“?+?String.valueOf(i)?+?“:“;
panel.add(new?JLabel(resourceName));
textMaxNeed[i]?=?new?JTextField();
panel.add(textMaxNeed[i]);
textAllocated[i]?=?new?JTextField();
panel.add(textAllocated[i]);
}

panel.add(new?JLabel());?//?站位作用.
okButton?=?new?JButton(“確定“);
okButton.addActionListener(this);
panel.add(okButton);
cancelButton?=?new?JButton(“取消“);
cancelButton.addActionListener(this);
panel.add(cancelButton);

this.getContentPane().add(panel);
setBounds();
}

public?void?setBounds()?{
this.setBounds(getX()?getY()?width?*?3?+?width?+?100?lineHeight
*?(textMaxNeed.length?+?3));
this.setLocationRelativeTo(this.getOwner());
}

private?void?setProcess()?{
if?(setName()?&&?setMaxNeed()?&&?setAllocated())?{
for?(int?i?=?0;?i? if?(maxNeed[i]? returnResult?=?InputError;
JOptionPane.showMessageDialog(this?“進程已分配資源量大于進程所需資源最大量!“);
return;
}
}
returnResult?=?InputEffiencent;
}
}

private?boolean?setName()?{
returnResult?=?InputEffiencent;
name?=?processName.getText().trim();
if?(name.isEmpty())?{
JOptionPane.showMessageDialog(this?“進程名不能為空!“);
returnResult?=?InputError;
return?returnResult;
}
processName.setText(““);
return?returnResu

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????301??2014-01-07?03:38??Banker?Algorithm\.classpath

?????文件????????392??2014-01-07?03:38??Banker?Algorithm\.project

?????文件????????598??2014-01-07?03:38??Banker?Algorithm\.settings\org.eclipse.jdt.core.prefs

?????文件???????5108??2014-01-07?04:32??Banker?Algorithm\bin\AddProcess.class

?????文件???????3922??2014-01-07?04:32??Banker?Algorithm\bin\AddResource.class

?????文件??????10685??2014-01-07?04:32??Banker?Algorithm\bin\BankerMainUI.class

?????文件???????8806??2014-01-07?04:32??Banker?Algorithm\bin\BankersAlgorithm.class

?????文件???????4239??2014-01-07?04:20??Banker?Algorithm\bin\RequestResource.class

?????文件???????4514??2014-01-07?04:32??Banker?Algorithm\bin\SystemProcess.class

?????文件???????4961??2014-01-07?04:32??Banker?Algorithm\src\AddProcess.java

?????文件???????2992??2014-01-07?04:32??Banker?Algorithm\src\AddResource.java

?????文件??????11726??2014-01-07?04:32??Banker?Algorithm\src\BankerMainUI.java

?????文件???????7761??2014-01-07?04:32??Banker?Algorithm\src\BankersAlgorithm.java

?????文件???????3411??2014-01-07?04:20??Banker?Algorithm\src\RequestResource.java

?????文件???????3973??2014-01-07?04:32??Banker?Algorithm\src\SystemProcess.java

?????目錄??????????0??2014-01-07?05:26??Banker?Algorithm\.settings

?????目錄??????????0??2014-01-07?05:26??Banker?Algorithm\bin

?????目錄??????????0??2014-01-07?05:26??Banker?Algorithm\src

?????目錄??????????0??2014-01-07?05:26??Banker?Algorithm

-----------?---------??----------?-----??----

????????????????73389????????????????????19


評論

共有 條評論