Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package library;
- /**
- *
- * @author Lowe
- */
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.io.*;
- public class Gui {
- private JFrame frame = new JFrame("Bibblan");
- private JPanel background, centerPanel, southPanel;
- private JLabel l_isbn,l_title, l_reclaim,l_lend,l_storage;
- private JTextField tf_isbn,tf_title, tf_reclaim,tf_lend,tf_storage;
- private JButton b_find,b_reclaim,b_lend,b_clear,b_newBook,b_save,b_load;
- private Book findB;
- private Library libraryN;
- public Gui(Library l){
- libraryN = l;
- background = new JPanel();
- background.setLayout((new BorderLayout()));
- centerPanel = new JPanel();
- background.setBorder(BorderFactory.createLineBorder(Color.BLUE,9,false));
- centerPanel.setLayout((new GridLayout(5,2)));
- southPanel = new JPanel();
- southPanel.setLayout((new GridLayout(3,2)));
- b_find = new JButton("find");
- b_reclaim = new JButton("return");
- b_lend = new JButton("lend");
- b_clear = new JButton("clear");
- b_newBook = new JButton("Add");
- b_save = new JButton("save");
- b_load = new JButton("load");
- southPanel.add(b_find);
- southPanel.add(b_reclaim);
- southPanel.add(b_lend);
- southPanel.add(b_clear);
- southPanel.add(b_newBook);
- southPanel.add(b_save);
- southPanel.add(b_load);
- l_isbn = new JLabel("isbn:");
- l_title = new JLabel("title:");
- l_reclaim = new JLabel("return:");
- l_lend = new JLabel("lend:");
- l_storage = new JLabel("storage:");
- tf_isbn = new JTextField(12);
- tf_title = new JTextField(12);
- tf_reclaim = new JTextField(12);
- tf_lend = new JTextField(12);
- tf_storage = new JTextField(12);
- centerPanel.add(l_isbn);
- centerPanel.add(tf_isbn);
- centerPanel.add(l_title);
- centerPanel.add(tf_title);
- centerPanel.add(l_reclaim);
- centerPanel.add(tf_reclaim);
- centerPanel.add(l_lend);
- centerPanel.add(tf_lend);
- centerPanel.add(l_storage);
- centerPanel.add(tf_storage);
- frame.setContentPane(background);
- frame.pack();
- frame.setVisible(true);
- background.add(centerPanel,BorderLayout.CENTER);
- background.add(southPanel,BorderLayout.SOUTH);
- SaveHandler SL = new SaveHandler();
- ClearHandler cl = new ClearHandler();
- FindHandler fh = new FindHandler();
- LendHandler LE = new LendHandler();
- ReclaimHandler RE = new ReclaimHandler();
- AddHandler AH = new AddHandler();
- this.b_save.addActionListener(SL);
- this.b_clear.addActionListener(cl);
- this.b_lend.addActionListener(LE);
- this.b_reclaim.addActionListener(RE);
- this.b_find.addActionListener(fh);
- this.b_newBook.addActionListener(AH);
- this.libraryN = libraryN;
- }
- private class ClearHandler implements ActionListener{
- public void actionPerformed(ActionEvent ae){
- System.out.println("clear");
- tf_isbn.setText("");
- tf_title.setText("");
- tf_storage.setText("");
- tf_lend.setText("");
- tf_reclaim.setText("");
- }
- }
- private class SaveHandler implements ActionListener{
- public void actionPerformed(ActionEvent ae){
- System.out.println("save");
- }
- }
- private class FindHandler implements ActionListener{
- public void actionPerformed(ActionEvent ae){
- System.out.println("find");
- }
- }
- private class LendHandler implements ActionListener{
- public void actionPerformed(ActionEvent ae){
- System.out.println("lend");
- }
- }
- private class ReclaimHandler implements ActionListener{
- public void actionPerformed(ActionEvent ae){
- System.out.println("reclaim");
- }
- }
- private class AddHandler implements ActionListener{
- public void actionPerformed(ActionEvent ae){
- System.out.println("add");
- }
- }
- }
Add Comment
Please, Sign In to add comment