?? makepldlg.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的整型數(shù)"); } } void finishBT_actionPerformed(ActionEvent e) { dispose(); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -