Advertisement
Guest User

IUT E-Library

a guest
Oct 12th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 23.91 KB | None | 0 0
  1. import java.awt.BorderLayout;
  2. import java.awt.Color;
  3. import java.awt.FlowLayout;
  4. import java.awt.Font;
  5. import java.awt.Label;
  6. import java.awt.event.ActionListener;
  7. import java.awt.event.ItemEvent;
  8. import java.awt.event.ItemListener;
  9. import java.nio.charset.MalformedInputException;
  10. import java.nio.file.SecureDirectoryStream;
  11. import java.awt.event.ActionEvent;
  12.  
  13. import javax.swing.ImageIcon;
  14. import javax.swing.JButton;
  15. import javax.swing.JComboBox;
  16. import javax.swing.JFrame;
  17. import javax.swing.JLabel;
  18. import javax.swing.JList;
  19. import javax.swing.JTextField;
  20. import javax.swing.ListSelectionModel;
  21. import javax.swing.event.ListSelectionEvent;
  22. import javax.swing.event.ListSelectionListener;
  23. import javax.xml.crypto.dsig.SignedInfo;
  24.  
  25. import javax.swing.JPasswordField;
  26. import javax.swing.JScrollPane;
  27. import javax.swing.JOptionPane;
  28. import javax.swing.JPanel;
  29.  
  30. public class Interface extends JFrame {
  31.     private JFrame mainframe;
  32.     private JPanel controlPanel;
  33.  
  34.     private JButton studentButton;
  35.     private JButton adminButton;
  36.     private JButton teacherButton;
  37.     private JButton signIn;
  38.     private JButton button1;
  39.     private JButton button3;
  40.     private JButton button2;
  41.     private JButton back;
  42.     private JButton mainMenu;
  43.    
  44.     private JPasswordField studentPass;
  45.     private JPasswordField teacherPass;
  46.     private JPasswordField adminPass;
  47.    
  48.     private JTextField usertext1;
  49.     private JTextField usertext2;
  50.     private JTextField usertext3;
  51.     private JTextField text1;
  52.     private JTextField text2;
  53.     private JTextField text3;
  54.     private JTextField text4;
  55.     private JTextField text5;
  56.    
  57.     private JLabel userLabel;
  58.     private JLabel passLabel;
  59.     private JLabel label1;
  60.     private JLabel label2;
  61.     private JLabel label3;
  62.     private JLabel label4;
  63.     private JLabel label5;
  64.     private JLabel label6;
  65.     private JLabel label7;
  66.     private JLabel label8;
  67.     private JLabel backgroundLabel;
  68.    
  69.     private JComboBox<String> departmentList;
  70.     private static final String[] department = {"CSE", "MCE", "EEE", "CEE", "TVE"};
  71.    
  72.     private JComboBox<String> semesterList;
  73.     private static final String[] semester = {"1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th"};
  74.    
  75.     private JComboBox<String> categoryList;
  76.    
  77.     private JComboBox<String> courseList;
  78.     private static final String[] cseCourses = {"--","CSE4401", "CSE 4405", "Math 4407", "EEE 4435", "CSE 4407", "CSE 4403"};
  79.     private static final String[] eeeCourses = {"EEE4401", "EEE 4405", "Math 4107", "EEE 4435", "CSE 4407", "CSE 4403"};
  80.     private static final String[] mceCourses = {"MCE4401", "MCE 4405", "Math 4107", "EEE 4435", "MCE 4407", "MCE 4403"};
  81.     private static final String[] category = {"Educational", "Literary"};
  82.    
  83.    
  84.    
  85.     void createMainframe(){
  86.         mainframe= new JFrame("IUT E-LIBRARY");
  87.         mainframe.setSize(900,700);
  88.  
  89.         studentButton = new JButton("Log-In as Student");
  90.         teacherButton = new JButton("Log-In as Teacher");
  91.         adminButton   = new JButton("Log-In as Admin");
  92.        
  93.         backgroundLabel = new JLabel();
  94.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\main.jpg");
  95.         backgroundLabel.setIcon(icon);
  96.         backgroundLabel.setSize(500,600);
  97.        
  98.         label8 = new JLabel("WELCOME TO IUT E-LIBRARY!");
  99.         label8.setFont(new Font("Forte", Font.BOLD, 34));
  100.         label8.setForeground(Color.white);
  101.        
  102.         mainframe.add(backgroundLabel);
  103.         mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  104.        
  105.         backgroundLabel.add(label8);
  106.         backgroundLabel.add(studentButton);
  107.         backgroundLabel.add(teacherButton);
  108.         backgroundLabel.add(adminButton);
  109.         //backgroundLabel.add(label8);
  110.        
  111.        
  112.        
  113.         studentButton.setBounds(280,220,180,40);
  114.         adminButton.setBounds(280,290,180,40);
  115.         teacherButton.setBounds(280,360,180,40);
  116.         label8.setBounds(170, -220, 600, 600);
  117.         //label8.setSize(500,600);
  118.        
  119.         mainframe.setVisible(true);
  120.        
  121.         studentButton.addActionListener(new ActionListener(){
  122.             public void actionPerformed(ActionEvent e){
  123.                 createStudentPanel();
  124.             }
  125.         }
  126.         );
  127.         teacherButton.addActionListener(new ActionListener(){
  128.             public void actionPerformed(ActionEvent e){
  129.                 createTeacherPanel();
  130.             }
  131.         }
  132.         );
  133.         adminButton.addActionListener(new ActionListener(){
  134.             public void actionPerformed(ActionEvent e){
  135.                 createAdminPanel();
  136.             }
  137.         }
  138.         );
  139.        
  140.     }
  141.    
  142.     void createStudentPanel(){
  143.         mainframe.dispose();
  144.         mainframe= new JFrame("Student LogIn");
  145.         mainframe.setSize(900,700);
  146.        
  147.         studentPass = new JPasswordField(8);
  148.         studentPass.setEchoChar('*');
  149.        
  150.         backgroundLabel = new JLabel();
  151.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\main.jpg");
  152.         backgroundLabel.setIcon(icon);
  153.         backgroundLabel.setSize(500,600);
  154.        
  155.        
  156.         usertext1 = new JTextField(20);
  157.         userLabel= new JLabel("Enter Username:",JLabel.LEFT);
  158.         passLabel= new JLabel("Enter Password:",JLabel.LEFT);
  159.         userLabel.setForeground(Color.white);
  160.         passLabel.setForeground(Color.white);
  161.         backgroundLabel.add(userLabel);
  162.         backgroundLabel.add(passLabel);
  163.         backgroundLabel.add(usertext1);
  164.         backgroundLabel.add(studentPass);
  165.        
  166.         userLabel.setBounds(90,135,250,40);
  167.         passLabel.setBounds(90,175,250,40);
  168.         usertext1.setBounds(250,150,200,20);
  169.         studentPass.setBounds(250,190,200,20);
  170.        
  171.         signIn = new JButton("Sign-In");
  172.         back = new JButton("Go Back");
  173.         backgroundLabel.add(signIn);
  174.         backgroundLabel.add(back);
  175.         signIn.setBounds(220,300,250,40);
  176.         back.setBounds(700, 60, 100, 20);
  177.        
  178.         mainframe.add(backgroundLabel);
  179.         mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  180.         mainframe.setVisible(true);
  181.        
  182.         signIn.addActionListener(new ActionListener(){
  183.             public void actionPerformed(ActionEvent e){
  184.                 studentVerified();
  185.             }
  186.         }  
  187.         );
  188.         back.addActionListener(new ActionListener(){
  189.             public void actionPerformed(ActionEvent e){
  190.                 createMainframe();
  191.             }
  192.         }  
  193.         );
  194.        
  195.        
  196.     }
  197.    
  198.     void createTeacherPanel(){
  199.         mainframe.dispose();
  200.         mainframe= new JFrame("Teacher LogIn");
  201.         mainframe.setSize(900,700);
  202.        
  203.         studentPass = new JPasswordField(8);
  204.         studentPass.setEchoChar('*');
  205.        
  206.         backgroundLabel = new JLabel();
  207.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\libraries3.jpg");
  208.         backgroundLabel.setIcon(icon);
  209.         backgroundLabel.setSize(500,600);
  210.        
  211.        
  212.         usertext1 = new JTextField(20);
  213.         userLabel= new JLabel("Enter Username:",JLabel.LEFT);
  214.         passLabel= new JLabel("Enter Password:",JLabel.LEFT);
  215.         userLabel.setForeground(Color.white);
  216.         passLabel.setForeground(Color.white);
  217.         backgroundLabel.add(userLabel);
  218.         backgroundLabel.add(passLabel);
  219.         backgroundLabel.add(usertext1);
  220.         backgroundLabel.add(studentPass);
  221.        
  222.         userLabel.setBounds(90,135,250,40);
  223.         passLabel.setBounds(90,175,250,40);
  224.         usertext1.setBounds(250,150,200,20);
  225.         studentPass.setBounds(250,190,200,20);
  226.        
  227.         signIn = new JButton("Sign-In");
  228.         back = new JButton("Go Back");
  229.         backgroundLabel.add(signIn);
  230.         backgroundLabel.add(back);
  231.         signIn.setBounds(220,300,250,40);
  232.         back.setBounds(700, 60, 100, 20);
  233.        
  234.         mainframe.add(backgroundLabel);
  235.         mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  236.         mainframe.setVisible(true);
  237.        
  238.         signIn.addActionListener(new ActionListener(){
  239.             public void actionPerformed(ActionEvent e){
  240.                 teacherVerified();
  241.             }
  242.         }  
  243.         );
  244.         back.addActionListener(new ActionListener(){
  245.             public void actionPerformed(ActionEvent e){
  246.                 createMainframe();
  247.             }
  248.         }  
  249.         );
  250.        
  251.     }
  252.    
  253.     void createAdminPanel(){
  254.         mainframe.dispose();
  255.         mainframe= new JFrame("Admin LogIn");
  256.         mainframe.setSize(900,700);
  257.        
  258.         studentPass = new JPasswordField(8);
  259.         studentPass.setEchoChar('*');
  260.        
  261.         backgroundLabel = new JLabel();
  262.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\Books.png");
  263.         backgroundLabel.setIcon(icon);
  264.         backgroundLabel.setSize(500,600);
  265.        
  266.        
  267.         usertext1 = new JTextField(20);
  268.         userLabel= new JLabel("Enter Username:",JLabel.LEFT);
  269.         passLabel= new JLabel("Enter Password:",JLabel.LEFT);
  270.         userLabel.setForeground(Color.white);
  271.         passLabel.setForeground(Color.white);
  272.         backgroundLabel.add(userLabel);
  273.         backgroundLabel.add(passLabel);
  274.         backgroundLabel.add(usertext1);
  275.         backgroundLabel.add(studentPass);
  276.        
  277.         userLabel.setBounds(160,75,250,40);
  278.         passLabel.setBounds(160,115,250,40);
  279.         usertext1.setBounds(320,90,200,20);
  280.         studentPass.setBounds(320,130,200,20);
  281.        
  282.         signIn = new JButton("Sign-In");
  283.         back = new JButton("Go Back");
  284.         backgroundLabel.add(signIn);
  285.         backgroundLabel.add(back);
  286.         signIn.setBounds(220,300,250,40);
  287.         back.setBounds(700, 60, 100, 20);
  288.        
  289.         mainframe.add(backgroundLabel);
  290.         mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  291.         mainframe.setVisible(true);
  292.        
  293.         signIn.addActionListener(new ActionListener(){
  294.             public void actionPerformed(ActionEvent e){
  295.                 adminVerified();
  296.             }
  297.         }  
  298.         );
  299.         back.addActionListener(new ActionListener(){
  300.             public void actionPerformed(ActionEvent e){
  301.                 createMainframe();
  302.             }
  303.         }  
  304.         );
  305.        
  306.     }
  307.    
  308.     void studentVerified(){
  309.         mainframe.dispose();
  310.         mainframe= new JFrame("Browse");
  311.         mainframe.setSize(900,700);
  312.        
  313.         backgroundLabel = new JLabel();
  314.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\main.jpg");
  315.         backgroundLabel.setIcon(icon);
  316.         backgroundLabel.setSize(500,600);
  317.        
  318.         button1 = new JButton("Browse Books");
  319.         button3 = new JButton("Browse Videos");
  320.         back = new JButton("Go Back");
  321.        
  322.         label8 = new JLabel("What do you want to do?");
  323.         label8.setFont(new Font("Lucida Handwriting", Font.BOLD, 34));
  324.         label8.setForeground(Color.white);
  325.        
  326.          backgroundLabel.add(button1);
  327.          backgroundLabel.add(button3);
  328.          backgroundLabel.add(label8);
  329.          backgroundLabel.add(back);
  330.          
  331.          button1.setBounds(290,240,170,40);
  332.          button3.setBounds(290,310,170,40);
  333.          label8.setBounds(170, -220, 600, 600);
  334.          back.setBounds(700, 60, 100, 20);
  335.          
  336.         mainframe.add(backgroundLabel);
  337.         mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  338.         mainframe.setVisible(true);
  339.        
  340.        
  341.         button1.addActionListener(new ActionListener(){
  342.             public void actionPerformed(ActionEvent e){
  343.                 bookVerified();
  344.             }
  345.         }  
  346.         );
  347.         button3.addActionListener(new ActionListener(){
  348.             public void actionPerformed(ActionEvent e){
  349.                 bookVerified();
  350.             }
  351.         }  
  352.         );
  353.        
  354.         back.addActionListener(new ActionListener(){
  355.             public void actionPerformed(ActionEvent e){
  356.                 createStudentPanel();
  357.             }
  358.         }  
  359.         );
  360.     }
  361.    
  362.     void bookVerified(){
  363.         mainframe.dispose();
  364.         mainframe= new JFrame("Choose Category");
  365.         mainframe.setSize(900,700);
  366.        
  367.         backgroundLabel = new JLabel();
  368.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\main.jpg");
  369.         backgroundLabel.setIcon(icon);
  370.         backgroundLabel.setSize(500,600);
  371.        
  372.         userLabel= new JLabel("Select Department:",JLabel.LEFT);
  373.         passLabel= new JLabel("Select Semester:",JLabel.LEFT);
  374.         userLabel.setForeground(Color.white);
  375.         passLabel.setForeground(Color.white);
  376.        
  377.         departmentList = new JComboBox<>(department);
  378.         departmentList.setMaximumRowCount(5);
  379.         semesterList = new JComboBox<>(semester);
  380.         semesterList.setMaximumRowCount(8);
  381.        
  382.         button1 = new JButton("Browse");
  383.         back = new JButton("Go Back");
  384.        
  385.         backgroundLabel.add(userLabel);
  386.         backgroundLabel.add(passLabel);
  387.         backgroundLabel.add(departmentList);
  388.         backgroundLabel.add(semesterList);
  389.         backgroundLabel.add(button1);
  390.         backgroundLabel.add(back);
  391.        
  392.         label1= new JLabel("Select Course:",JLabel.LEFT);
  393.         label1.setForeground(Color.white);
  394.         courseList = new JComboBox<>(cseCourses);
  395.         courseList.setMaximumRowCount(6);
  396.        
  397.         backgroundLabel.add(courseList);
  398.         backgroundLabel.add(label1);
  399.        
  400.         label1.setBounds(140,240,250,40);
  401.         courseList.setBounds(300,250, 200, 20);
  402.        
  403.         userLabel.setBounds(140,160,250,40);
  404.         passLabel.setBounds(140,200,250,40);
  405.         departmentList.setBounds(300,170,200,20);
  406.         semesterList.setBounds(300,210,200,20);
  407.         button1.setBounds(220,350,250,40);
  408.         back.setBounds(700, 60, 100, 20);
  409.        
  410.        
  411.         mainframe.add(backgroundLabel);
  412.         mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  413.         mainframe.setVisible(true);
  414.        
  415.         button1.addActionListener(new ActionListener(){
  416.             public void actionPerformed(ActionEvent e){
  417.                 bookList();
  418.             }
  419.         }  
  420.         );
  421.         back.addActionListener(new ActionListener(){
  422.             public void actionPerformed(ActionEvent e){
  423.                 studentVerified();
  424.             }
  425.         }  
  426.         );
  427.    
  428.    
  429.        
  430.        
  431.     }
  432.    
  433.     void teacherVerified(){
  434.         mainframe.dispose();
  435.         mainframe= new JFrame("Teacher Options");
  436.         mainframe.setSize(900,700);
  437.        
  438.         backgroundLabel = new JLabel();
  439.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\libraries3.jpg");
  440.         backgroundLabel.setIcon(icon);
  441.         backgroundLabel.setSize(500,600);
  442.        
  443.         button1 = new JButton("Upload Videos");
  444.         button2 = new JButton("Browse Books");
  445.         button3 = new JButton("Upload Lecture Materials");
  446.         back = new JButton("Go Back");
  447.        
  448.         label8 = new JLabel("What do you want to do?");
  449.         label8.setFont(new Font("Lucida Handwriting", Font.BOLD, 34));
  450.         label8.setForeground(Color.white);
  451.        
  452.          backgroundLabel.add(button1);
  453.          backgroundLabel.add(button3);
  454.          backgroundLabel.add(button2);
  455.          backgroundLabel.add(label8);
  456.          backgroundLabel.add(back);
  457.          
  458.          
  459.          button1.setBounds(220,150,250,40);
  460.          button3.setBounds(220,220,250,40);
  461.          button2.setBounds(220,290,250,40);
  462.          label8.setBounds(170, -220, 600, 600);
  463.          back.setBounds(700, 60, 100, 20);
  464.          
  465.             mainframe.add(backgroundLabel);
  466.             mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  467.             mainframe.setVisible(true);
  468.            
  469.            
  470.             button1.addActionListener(new ActionListener(){
  471.                 public void actionPerformed(ActionEvent e){
  472.                     teacherUpload();
  473.                 }
  474.             }  
  475.             );
  476.             button3.addActionListener(new ActionListener(){
  477.                 public void actionPerformed(ActionEvent e){
  478.                     teacherUpload();
  479.                 }
  480.             }  
  481.             );
  482.             button2.addActionListener(new ActionListener(){
  483.                 public void actionPerformed(ActionEvent e){
  484.                     bookVerified();
  485.                 }
  486.             }  
  487.             );
  488.             back.addActionListener(new ActionListener(){
  489.                 public void actionPerformed(ActionEvent e){
  490.                     createTeacherPanel();
  491.                 }
  492.             }  
  493.             );
  494.          
  495.     }
  496.     void adminVerified(){
  497.         mainframe.dispose();
  498.         mainframe= new JFrame("Admin Options");
  499.         mainframe.setSize(900,700);
  500.        
  501.         backgroundLabel = new JLabel();
  502.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\Books.png");
  503.         backgroundLabel.setIcon(icon);
  504.         backgroundLabel.setSize(500,600);
  505.        
  506.         button1 = new JButton("Add New Book");
  507.         button2 = new JButton("Update Versions");
  508.         back = new JButton("Go Back");
  509.        
  510.         label8 = new JLabel("What do you want to do?");
  511.         label8.setFont(new Font("Lucida Handwriting", Font.BOLD, 34));
  512.         label8.setForeground(Color.white);
  513.        
  514.         backgroundLabel.add(button1);
  515.          backgroundLabel.add(button2);
  516.          backgroundLabel.add(label8);
  517.          backgroundLabel.add(back);
  518.          
  519.          
  520.          button1.setBounds(270,200,250,40);
  521.          button2.setBounds(270,270,250,40);
  522.          label8.setBounds(170, -220, 600, 600);
  523.          back.setBounds(700, 60, 100, 20);
  524.          
  525.             mainframe.add(backgroundLabel);
  526.             mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  527.             mainframe.setVisible(true);
  528.            
  529.            
  530.             button1.addActionListener(new ActionListener(){
  531.                 public void actionPerformed(ActionEvent e){
  532.                     addBook();
  533.                 }
  534.             }  
  535.             );
  536.             button2.addActionListener(new ActionListener(){
  537.                 public void actionPerformed(ActionEvent e){
  538.                     updateVersion();
  539.                 }
  540.             }  
  541.             );
  542.             back.addActionListener(new ActionListener(){
  543.                 public void actionPerformed(ActionEvent e){
  544.                     createAdminPanel();
  545.                 }
  546.             }  
  547.             );
  548.     }
  549.    
  550.     void teacherUpload(){
  551.         mainframe.dispose();
  552.         mainframe= new JFrame("Teacher Category");
  553.         mainframe.setSize(900,700);
  554.        
  555.         backgroundLabel = new JLabel();
  556.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\libraries3.jpg");
  557.         backgroundLabel.setIcon(icon);
  558.         backgroundLabel.setSize(500,600);
  559.        
  560.         userLabel= new JLabel("Select Department:",JLabel.LEFT);
  561.         passLabel= new JLabel("Select Semester:",JLabel.LEFT);
  562.         label2= new JLabel("Title:",JLabel.LEFT);
  563.         userLabel.setForeground(Color.white);
  564.         passLabel.setForeground(Color.white);
  565.         label2.setForeground(Color.white);
  566.        
  567.         usertext1 = new JTextField();
  568.        
  569.         departmentList = new JComboBox<>(department);
  570.         departmentList.setMaximumRowCount(5);
  571.         semesterList = new JComboBox<>(semester);
  572.         semesterList.setMaximumRowCount(8);
  573.        
  574.         button1 = new JButton("Upload");
  575.         back = new JButton("Go Back");
  576.         mainMenu = new JButton("Back to Main");
  577.        
  578.         backgroundLabel.add(userLabel);
  579.         backgroundLabel.add(passLabel);
  580.         backgroundLabel.add(departmentList);
  581.         backgroundLabel.add(semesterList);
  582.         backgroundLabel.add(button1);
  583.         backgroundLabel.add(usertext1);
  584.         backgroundLabel.add(label2);
  585.         backgroundLabel.add(back);
  586.         backgroundLabel.add(mainMenu);
  587.        
  588.         label1= new JLabel("Select Course:",JLabel.LEFT);
  589.         label1.setForeground(Color.white);
  590.         courseList = new JComboBox<>(cseCourses);
  591.         courseList.setMaximumRowCount(6);
  592.        
  593.        
  594.         backgroundLabel.add(courseList);
  595.         backgroundLabel.add(label1);
  596.        
  597.         label1.setBounds(60,120,250,40);
  598.         courseList.setBounds(220,130, 200, 20);
  599.         label2.setBounds(60, 160, 250, 40);
  600.         usertext1.setBounds(220, 170, 200, 20);
  601.        
  602.         userLabel.setBounds(60,40,250,40);
  603.         passLabel.setBounds(60,80,250,40);
  604.         departmentList.setBounds(220,50,200,20);
  605.         semesterList.setBounds(220,90,200,20);
  606.         button1.setBounds(180,230,250,40);
  607.         back.setBounds(700, 60, 100, 20);
  608.         mainMenu.setBounds(700, 30, 130, 20);
  609.        
  610.        
  611.         mainframe.add(backgroundLabel);
  612.         mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  613.         mainframe.setVisible(true);
  614.         button1.addActionListener(new ActionListener(){
  615.             public void actionPerformed(ActionEvent e){
  616.                 teacherUpload();
  617.             }
  618.         }  
  619.         );
  620.         back.addActionListener(new ActionListener(){
  621.             public void actionPerformed(ActionEvent e){
  622.                 teacherVerified();
  623.             }
  624.         }  
  625.         );
  626.         mainMenu.addActionListener(new ActionListener(){
  627.             public void actionPerformed(ActionEvent e){
  628.                 createMainframe();
  629.             }
  630.         }  
  631.         );
  632.     }
  633.    
  634.     void addBook(){
  635.         mainframe.dispose();
  636.         mainframe= new JFrame("Add Book");
  637.         mainframe.setSize(900,700);
  638.        
  639.         backgroundLabel = new JLabel();
  640.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\Books.png");
  641.         backgroundLabel.setIcon(icon);
  642.         backgroundLabel.setSize(500,600);
  643.        
  644.         label1 = new JLabel("Book Name: ",JLabel.LEFT);
  645.         label2 = new JLabel("Book ID: ",JLabel.LEFT);
  646.         label3 = new JLabel("Author:  ",JLabel.LEFT);
  647.         label4 = new JLabel("Publication: ",JLabel.LEFT);
  648.         label5 = new JLabel("Transaction ID: ",JLabel.LEFT);
  649.         label6 = new JLabel("Category: ",JLabel.LEFT);
  650.         label7 = new JLabel("Department: ",JLabel.LEFT);
  651.        
  652.         label1.setForeground(Color.white);
  653.         label2.setForeground(Color.white);
  654.         label3.setForeground(Color.white);
  655.         label4.setForeground(Color.white);
  656.         label5.setForeground(Color.white);
  657.         label6.setForeground(Color.white);
  658.         label7.setForeground(Color.white);
  659.        
  660.         text1 = new JTextField(20);
  661.         text2 = new JTextField(20);
  662.         text3 = new JTextField(20);
  663.         text4 = new JTextField(20);
  664.         text5 = new JTextField(20);
  665.        
  666.         button1 = new JButton("ADD");
  667.         back = new JButton("Go Back");
  668.         mainMenu = new JButton("Back to Main");
  669.        
  670.         label1.setBounds(200,90,250,40);
  671.         label2.setBounds(200,130,250,40);
  672.         label3.setBounds(200,170,250,40);
  673.         label4.setBounds(200,210,250,40);
  674.         label5.setBounds(200,250,250,40);
  675.         label6.setBounds(200,290,250,40);
  676.         label7.setBounds(200,330,250,40);
  677.         text1.setBounds(360,100,200,20);
  678.         text2.setBounds(360,140,200,20);
  679.         text3.setBounds(360,180,200,20);
  680.         text4.setBounds(360,220,200,20);
  681.         text5.setBounds(360,260,200,20);
  682.         button1.setBounds(190,400,320,40);
  683.         back.setBounds(700, 60, 100, 20);
  684.         mainMenu.setBounds(700, 30, 130, 20);
  685.        
  686.         departmentList = new JComboBox<>(department);
  687.         departmentList.setMaximumRowCount(5);
  688.         categoryList = new JComboBox<>(category);
  689.         categoryList.setMaximumRowCount(5);
  690.        
  691.         categoryList.setBounds(360, 300, 200, 20);
  692.         departmentList.setBounds(360, 340, 200, 20);
  693.        
  694.         backgroundLabel.add(label1);
  695.         backgroundLabel.add(label2);
  696.         backgroundLabel.add(label3);
  697.         backgroundLabel.add(label4);
  698.         backgroundLabel.add(label5);
  699.         backgroundLabel.add(label6);
  700.         backgroundLabel.add(label7);
  701.         backgroundLabel.add(text1);
  702.         backgroundLabel.add(text2);
  703.         backgroundLabel.add(text3);
  704.         backgroundLabel.add(text4);
  705.         backgroundLabel.add(text5);
  706.         backgroundLabel.add(departmentList);
  707.         backgroundLabel.add(categoryList);
  708.         backgroundLabel.add(button1);
  709.         backgroundLabel.add(back);
  710.         backgroundLabel.add(mainMenu);
  711.        
  712.         mainframe.add(backgroundLabel);
  713.         mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  714.         mainframe.setVisible(true);
  715.        
  716.         back.addActionListener(new ActionListener(){
  717.             public void actionPerformed(ActionEvent e){
  718.                 adminVerified();
  719.             }
  720.         }  
  721.         );
  722.         mainMenu.addActionListener(new ActionListener(){
  723.             public void actionPerformed(ActionEvent e){
  724.                 createMainframe();
  725.             }
  726.         }  
  727.         );
  728.     }
  729.    
  730.     void updateVersion(){
  731.        
  732.     }
  733.    
  734.     void bookList(){
  735.         mainframe.dispose();
  736.         mainframe= new JFrame("Book List");
  737.         mainframe.setSize(900,700);
  738.        
  739.         backgroundLabel = new JLabel();
  740.         ImageIcon icon = new ImageIcon("C:\\Users\\shiha\\Desktop\\booklist.jpg");
  741.         backgroundLabel.setIcon(icon);
  742.         backgroundLabel.setSize(500,600);
  743.        
  744.         label1 = new JLabel("->Java How To Program.pdf",JLabel.CENTER);
  745.         label2 = new JLabel("->Algorithms by Corman.pdf",JLabel.CENTER);
  746.         label3 = new JLabel("->JAVA code by dietel.pdf",JLabel.CENTER);
  747.         label4 = new JLabel("->Systems Analysis and Design.pdf",JLabel.CENTER);
  748.         label5 = new JLabel("->Digital Signal Processing by Mubin.pdf",JLabel.CENTER);
  749.         label6 = new JLabel("->Telecommunications by Abir.pdf",JLabel.CENTER);
  750.         label7 = new JLabel("->Statistical and Probabilitical Analysis.pdf",JLabel.CENTER);
  751.        
  752.         back = new JButton("Go Back");
  753.         mainMenu = new JButton("Back to Main");
  754.        
  755.         label1.setForeground(Color.blue);
  756.         label2.setForeground(Color.blue);
  757.         label3.setForeground(Color.blue);
  758.         label4.setForeground(Color.blue);
  759.         label5.setForeground(Color.blue);
  760.         label6.setForeground(Color.blue);
  761.         label7.setForeground(Color.blue);
  762.        
  763.         label1.setBounds(100,70,250,40);
  764.         label2.setBounds(100,110,250,40);
  765.         label3.setBounds(100,150,250,40);
  766.         label4.setBounds(100,190,250,40);
  767.         label5.setBounds(100,230,250,40);
  768.         label6.setBounds(100,270,250,40);
  769.         label7.setBounds(100,310,250,40);
  770.         back.setBounds(700, 60, 100, 20);
  771.         mainMenu.setBounds(700, 30, 130, 20);
  772.        
  773.             backgroundLabel.add(label1);
  774.             backgroundLabel.add(label2);
  775.             backgroundLabel.add(label3);
  776.             backgroundLabel.add(label4);
  777.             backgroundLabel.add(label5);
  778.             backgroundLabel.add(label6);
  779.             backgroundLabel.add(label7);
  780.             backgroundLabel.add(back);
  781.             backgroundLabel.add(mainMenu);
  782.            
  783.             mainframe.add(backgroundLabel);
  784.             mainframe.setDefaultCloseOperation(EXIT_ON_CLOSE);
  785.             mainframe.setVisible(true);
  786.            
  787.             back.addActionListener(new ActionListener(){
  788.                 public void actionPerformed(ActionEvent e){
  789.                     bookVerified();
  790.                 }
  791.             }  
  792.             );
  793.            
  794.             mainMenu.addActionListener(new ActionListener(){
  795.                 public void actionPerformed(ActionEvent e){
  796.                     createMainframe();
  797.                 }
  798.             }  
  799.             );
  800.         }
  801.    
  802.     public Interface(){
  803.         createMainframe();
  804.     }
  805.    
  806.    
  807.    
  808.     public static void main(String[] args){
  809.         Interface a = new Interface();
  810.     }
  811.  
  812. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement