Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Interface.java
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.io.*;
- import javax.swing.*;
- import java.awt.Cursor.*;
- import javax.swing.text.*;
- import java.text.*;
- import java.util.*;
- import javax.swing.undo.*;
- import javax.swing.event.*;
- import java.net.*;
- import java.awt.print.*;
- import java.awt.geom.*;
- import java.util.Vector;
- import javax.swing.JToolBar;
- import javax.swing.JPanel;
- import javax.swing.filechooser.*;
- import java.awt.geom.*;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import java.awt.print.PrinterJob;
- import java.awt.event.ActionListener;
- import javax.swing.filechooser.*;
- import javax.swing.JEditorPane;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.JScrollPane;
- import javax.swing.JSplitPane;
- import javax.swing.JButton;
- import javax.swing.table.TableColumn;
- import javax.swing.JTree;
- import javax.swing.tree.DefaultMutableTreeNode;
- import javax.swing.tree.TreeSelectionModel;
- import javax.swing.event.TreeSelectionEvent;
- import javax.swing.event.TreeSelectionListener;
- import javax.swing.tree.DefaultTreeCellRenderer;
- import javax.swing.ToolTipManager;
- import javax.swing.ImageIcon;
- import javax.swing.Icon;
- import java.net.URL;
- import java.io.IOException;
- import java.awt.Dimension;
- import java.awt.GridLayout;
- import java.awt.Component;
- import java.awt.Polygon;
- //import file/OPEN.*;
- import java.io.*;
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.text.DecimalFormat;
- import javax.swing.table.DefaultTableModel;
- import javax.swing.table.DefaultTableCellRenderer;
- import javax.swing.table.JTableHeader;
- import javax.swing.table.TableCellRenderer;
- public class Interface extends JFrame {
- // global variables:
- //Scheduling_Session SS = new Scheduling_Session();
- //Paging_Session PS = new Paging_Session();
- Scheduling_Session SS;
- Paging_Session PS;
- Scheduling_Algorithm S_Algorithm;
- Paging_Algorithm P_Algorithm;
- Schedule schedule;
- boolean Schanged = false;
- boolean Pchanged = false;
- int graphWidth = 0;
- private final Color colorValues[] = {Color.black, Color.blue, Color.red, Color.green};
- private JRadioButtonMenuItem colorItems[], fonts[];
- private JCheckBoxMenuItem styleItems[];
- private JLabel displayLabel;
- //private JTextField outputG2;
- PageFaultPanel PageFault;
- private JTextArea outputGraphArea;
- private ButtonGroup fontGroup, colorGroup;
- private JTabbedPane tabbedPane;
- private int style;
- private JMenuItem Session_a[];
- private JPanel panel1, panel2;
- private FlowLayout layout;
- private JDesktopPane theDesktop;
- private JFileChooser fc;
- private JButton OpenItem;
- private JScrollPane OutputPane;
- private JInternalFrame ResultFrame;
- private SchedulingOutput outputGraph;
- private SchedulingOutput DetailedOutputGraph;
- private PagingOutput PO;
- private JTable outputTable, outputTableP;
- private JTable input, input2;
- private JInternalFrame frame, frame2;
- private JTextField PenaltyAverage = new JTextField(), CPU = new JTextField();
- //private CalculationPanel calculations;
- private JTextField quantum = new JTextField();
- private AveragePanel Average;
- private JButton Enlarge;
- private JButton Steps, StepsB;
- private JPanel PriorityPanel;
- private JSplitPane inputSplitPane;
- private JTextField mField, fsField, fField, CBField;
- private JTextField mField2, fsField2, fField2;
- private JButton Cal;
- private JLabel QLabel, fLabel, fsLabel, mLabel, CBLabel;
- private JLabel fLabel2, fsLabel2, mLabel2, inputTableTextP;
- private JLabel inputTableTextP3, outputTableTextP;
- private JLabel outputGraphLabel2, outputGraphText2;
- private JCheckBox showCache;
- private JRadioButton frameNo, memSize, frameNo2, memSize2;
- private ButtonGroup radioGroup1, radioGroup2;
- private ObjectOutputStream output;
- private ObjectInputStream inputS;
- JButton PrintButton = new JButton("Print", new ImageIcon("images/printer2.png"));
- JRadioButton Preemptive = new JRadioButton("Pre-emptive", false), nonPreemptive = new JRadioButton("Non Pre-emptive", true);
- private FileInputStream fileInput;
- private File fileName;
- int Length = 35;
- JComboBox algorithmsComboBox;
- JComboBox PalgorithmsComboBox;
- String SAlgorithms[] = {"Choose Algorithm", "First Come First Served (FCFS)",
- "Round Robin (RR)", "Shortest Process Next (SPN)", "Shortest Remaining Time (SRT)", "Highest Response Ratio Next (HRRN)",
- "Priority scheduling", "Multilevel Feedback Queue Scheduling"};
- ;
- //if choice=1 show number of frame field else show memory size& frame size field
- private int choice = 1;
- //if b=true show cache memory
- private boolean b = false;
- boolean pre = false;
- // set up GUI
- public Interface() {
- super("CPU Scheduler");
- // Set the OS Magnifier slogan
- ImageIcon image = new ImageIcon("images/1.png");
- this.setIconImage(image.getImage());
- theDesktop = new JDesktopPane();
- getContentPane().add(theDesktop);
- JToolBar toolBar = new JToolBar();
- toolBar.setFloatable(false);
- addButtons(toolBar);
- toolBar.setVisible(true);
- // add toolBar to container
- //setSize(270,80);
- toolBar.setSize(270, 80);
- getContentPane().add(toolBar);
- setVisible(true);
- getContentPane().setLayout(new BorderLayout());
- // set the bounds of the toolbar
- toolBar.setBounds(5, 0, 900, 50);
- // create JTabbedPane
- tabbedPane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
- // set up pane11 and add it to JTabbedPane
- panel1 = new JPanel();
- tabbedPane.addTab(" Scheduling ", null, panel1, "Scheduling Session");
- //pressing Alt-1 makes the Scheduling tab appear and the index of the tab =0
- tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
- // set up pane11 and add it to JTabbedPane
- panel2 = new JPanel();
- tabbedPane.addTab(" Paging ", null, panel2, "Paging Session"); // this is the tab content that I DO NOT want to display
- // to create imageicon in the top of tap
- ImageIcon sicon = new ImageIcon("images/s.png");
- ImageIcon picon = new ImageIcon("images/p.png");
- .......
- ..........
- ......
- .....
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement