⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makepldlg.java

📁 进程调度和存储管理模拟
💻 JAVA
字号:
package cn.edu.cauc.crab.ossimulate;import java.awt.*;import javax.swing.*;import com.borland.jbcl.layout.*;import java.awt.event.*;/** * <p>Title: OS simulate</p> * <p>Description: This is my home work.</p> * <p>Copyright: Copyleft (c) 2004</p> * <p>Company: CAUC</p> * @author Crab * @version 0.1 */public class makePLDLG extends JDialog {    PageReplacement pR;    private JPanel panel1 = new JPanel();    private XYLayout xYLayout1 = new XYLayout();    private JTextField pNumTA = new JTextField();    private JLabel jLabel1 = new JLabel();    private JButton addBT = new JButton();    private JButton finishBT = new JButton();    private JScrollPane jScrollPane1 = new JScrollPane();    private JTextArea outTA = new JTextArea();    public makePLDLG(Frame frame, String title, boolean modal) {        super(frame, title, modal);        try {            jbInit();            pack();        }        catch(Exception ex) {            ex.printStackTrace();        }    }    public makePLDLG(Frame frame, PageReplacement pR) {        this(null, "建立页面申请列表", false);        this.pR = pR;    }    private void jbInit() throws Exception {        panel1.setLayout(xYLayout1);        jLabel1.setText("页面号:");        addBT.setText("添加");        addBT.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(ActionEvent e) {                addBT_actionPerformed(e);            }        });        finishBT.setText("完成");        finishBT.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(ActionEvent e) {                finishBT_actionPerformed(e);            }        });        getContentPane().add(panel1);        panel1.add(jLabel1,   new XYConstraints(35, 50, 48, 21));        panel1.add(addBT, new XYConstraints(35, 104, 68, 26));        panel1.add(finishBT,    new XYConstraints(35, 160, 68, 26));        panel1.add(jScrollPane1, new XYConstraints(175, 25, 195, 262));        panel1.add(pNumTA,  new XYConstraints(82, 49, 69, -1));        jScrollPane1.getViewport().add(outTA, null);    }    void addBT_actionPerformed(ActionEvent e) {        try {            int pn = Integer.parseInt(pNumTA.getText());            if (pn < 0)                throw new Exception();            pR.addPage(pn);            outTA.append("页面号:" + pn +"\n");            pNumTA.setText("");        } catch (Exception ex) {            pNumTA.setText("");            JOptionPane.showMessageDialog(this, "页面号必须是大于0的整型数");        }    }    void finishBT_actionPerformed(ActionEvent e) {        dispose();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -