import javax.swing.table.*;
import java.awt.*;
import javax.swing.*;
/**
*
* @author prn2009
* 表格模式
*/
public class FIFO_Sim extends javax.swing.JFrame {
/** Creates new form FIFO_Sim */
java.util.Vector refList,tList;
FIFO_Table ftable;
Object Pages[][],Algo[];
boolean flg,erf,erf2;
String msg,sAlgo;
int row,col,drow,refId,i,j,pfi,phi,k,fset,tmp;
java.lang.Integer tmpint,tmpint1;
public FIFO_Sim() {
msg="";
col=0;
erf=true;
row=0;
Algo=new Object[3];
Algo[0]="Select";
Algo[1]="FIFO";
Algo[2]="LRU";
ftable = new FIFO_Table(row,col);
refList= new java.util.Vector();
initComponents();
this.setIconImage(new javax.swing.ImageIcon(getClass().getResource("/Ico.png")).getImage());
this.setLocation(200,150);
this.setBackground(new java.awt.Color(170, 201, 235));
this.setSize(742,452+35);
}
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jSpinner_PageFrame = new javax.swing.JSpinner();
jButton_Set = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jButton_Simulate = new javax.swing.JButton();
jButton_Reset = new javax.swing.JButton();
jButton_About = new javax.swing.JButton();
jButton_Exit = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jScrollPane_RefField = new javax.swing.JScrollPane();
jList_RefField = new javax.swing.JList();
jSpinner_RefField = new javax.swing.JSpinner();
jButton_AddEdit = new javax.swing.JButton();
jButton_Delete = new javax.swing.JButton();
jButton_DeleteAll = new javax.swing.JButton();
jButton_Reverse = new javax.swing.JButton();
jButton_Reverse.setToolTipText("Makes reverse order of whole list.");
jLabel4 = new javax.swing.JLabel();
jTextField_refField = new javax.swing.JTextField();
jPanel_PageTable = new javax.swing.JPanel();
jScrollPane_PageTable = new javax.swing.JScrollPane();
jTable_PageTable = new javax.swing.JTable();
jCheckBox_Autoresize = new javax.swing.JCheckBox();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField_PHits = new javax.swing.JTextField();
jTextField_PFaults = new javax.swing.JTextField();
jComboBox_Algo = new javax.swing.JComboBox(Algo);
jLabel9 = new javax.swing.JLabel();
getContentPane().setLayout(null);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("表格显示模式演示 www.cujava.com");
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});
jLabel1.setText("Page Frames :");
getContentPane().add(jLabel1);
jLabel1.setBounds(40, 60, 80, 14);
getContentPane().add(jSpinner_PageFrame);
jSpinner_PageFrame.setBounds(120, 60, 50, 20);
jButton_Set.setText("Set");
jButton_Set.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_SetActionPerformed(evt);
}
});
getContentPane().add(jButton_Set);
jButton_Set.setBounds(182, 63, 63, 21);
jPanel2.setLayout(null);
jPanel2.setBackground(new java.awt.Color(170, 201, 235));
jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
jButton_Simulate.setText("Simulate");
jButton_Simulate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_SimulateActionPerformed(evt);
}
});
jPanel2.add(jButton_Simulate);
jButton_Simulate.setBounds(20, 10, 80, 30);
jButton_Reset.setText("Reset");
jButton_Reset.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ResetActionPerformed(evt);
}
});
jPanel2.add(jButton_Reset);
jButton_Reset.setBounds(120, 10, 90, 30);
jButton_About.setText("About");
jButton_About.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_AboutActionPerformed(evt);
}
});
jPanel2.add(jButton_About);
jButton_About.setBounds(230, 10, 80, 30);
jButton_Exit.setText("Exit");
jButton_Exit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ExitActionPerformed(evt);
}
});
jPanel2.add(jButton_Exit);
jButton_Exit.setBounds(330, 10, 73, 30);
getContentPane().add(jPanel2);
jPanel2.setBounds(280, 370, 420, 50);
jPanel3.setLayout(null);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 255, 255)), "Reference Fields"));
jPanel3.setEnabled(false);
jScrollPane_RefField.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
jScrollPane_RefField.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
jList_RefField.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane_RefField.setViewportView(jList_RefField);
jPanel3.add(jScrollPane_RefField);
jScrollPane_RefField.setBounds(30, 70, 50, 130);
jPanel3.add(jSpinner_RefField);
jSpinner_RefField.setBounds(30, 30, 50, 20);
jButton_AddEdit.setText("Add");
jButton_AddEdit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_AddEditActionPerformed(evt);
}
});
jPanel3.add(jButton_AddEdit);
jButton_AddEdit.setBounds(98, 28, 105, 21);
jButton_Delete.setText("Delete");
jButton_Delete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_DeleteActionPerformed(evt);
}
});
jPanel3.add(jButton_Delete);
jButton_Delete.setBounds(98, 77, 105, 21);
jButton_DeleteAll.setText("Delete All");
jButton_DeleteAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_DeleteAllActionPerformed(evt);
}
});
jPanel3.add(jButton_DeleteAll);
jButton_DeleteAll.setBounds(98, 119, 105, 21);
jButton_Reverse.setText("Reverse");
jButton_Reverse.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ReverseActionPerformed(evt);
}