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

📄 procsyn.java

📁 实现操作系统几个经典问题:生产者消费者,读者写者,哲学家进餐问题.共做一个界面
💻 JAVA
字号:
/*
 * ProcSyn.java
 *
 * Created on 2007年7月15日, 上午12:17
 */

package processSyn;

import java.awt.Dimension;
import java.awt.Toolkit;

/**
 *
 * @author  jzf
 */
public class ProcSyn extends javax.swing.JFrame {
    
    /** Creates new form ProcSyn */
    public ProcSyn() {
        initComponents();
        Toolkit kit=Toolkit.getDefaultToolkit();
        Dimension dim=kit.getScreenSize();
        int locationX=((int)dim.getWidth()-this.getWidth())/2;
        int locationY=((int)dim.getHeight()-this.getHeight())/5;
        setLocation(locationX,locationY);
        
        jtab.addTab("生产者消费者", new PronCons());
        jtab.addTab("读者写者问题", new ReaderWriter(getWidth(),getHeight()));
        jtab.addTab("哲学家进餐问题", new DiningPhilosophers());
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jtab = new javax.swing.JTabbedPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jtab, javax.swing.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jtab, javax.swing.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE)
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ProcSyn().setVisible(true);
            }
        });
    }
    
    // 变量声明 - 不进行修改//GEN-BEGIN:variables
    private javax.swing.JTabbedPane jtab;
    // 变量声明结束//GEN-END:variables
    
}

⌨️ 快捷键说明

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