package docman;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;


public class DocumentDatabaseUI extends JFrame {
	
	private JTextField input;

    public DocumentDatabaseUI() {
        super("Document Manager");
        this.buildUI();
    }
    
    private void buildUI() {
    		Container contentPane = this.getContentPane();
    		contentPane.setLayout(new BorderLayout());

    		JLabel searchLabel = new JLabel("Keyword:");
    		contentPane.add(searchLabel, BorderLayout.WEST);
    		this.input = new JTextField(15);
    		contentPane.add(input, BorderLayout.CENTER);
    		JButton searchButton = new JButton("Search");
    		contentPane.add(searchButton, BorderLayout.SOUTH);
    		this.pack();
    		
    		searchButton.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent ev) {
    				JOptionPane.showMessageDialog(
    						DocumentDatabaseUI.this,
    						"Keyword is: " + DocumentDatabaseUI.this.input.getText());
    			}
    		});
    }
        
    public static void main(String[] args) {
        DocumentDatabaseUI databaseUI = new DocumentDatabaseUI();
        databaseUI.setVisible(true);
    }

}
