Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.*;
- public class Client {
- // Debug/Status
- JTextArea debugLog = new JTextArea(10,10);
- // Login Card
- JTextField userName = new JTextField("", 20);
- JPasswordField userPass = new JPasswordField("", 20);
- JButton loginButton = new JButton("Log In");
- public void init(Container pane) {
- JTabbedPane tabbedPane = new JTabbedPane();
- // Debug Panel
- JPanel log = new JPanel();
- log.setLayout(new BorderLayout());
- log.add(debugLog);
- // Cards for pages
- JPanel loginCard = new JPanel();
- JPanel publicCard = new JPanel();
- JPanel privateCard = new JPanel();
- JPanel groupCard = new JPanel();
- // Populate the panel cards
- // Login Page
- loginCard.setLayout(new GridLayout(4,2,5,5));
- loginCard.add(new JLabel("User Name: ", JLabel.LEFT));
- loginCard.add(userName);
- loginCard.add(new JLabel("Password: ", JLabel.LEFT));
- loginCard.add(userPass);
- loginCard.add(loginButton);
- JPanel card2 = new JPanel();
- card2.add(new JTextField("TextField", 20));
- tabbedPane.addTab("Log In", loginCard);
- tabbedPane.addTab("Public Groups", publicCard);
- tabbedPane.addTab("Private Groups", privateCard);
- tabbedPane.addTab("Friend's Groups", groupCard);
- tabbedPane.setSize(600,400);
- pane.add(tabbedPane, BorderLayout.NORTH);
- pane.add(log, BorderLayout.SOUTH);
- }
- /**
- * Create the GUI and show it. For thread safety,
- * this method should be invoked from the
- * event dispatch thread.
- */
- private static void createAndShowGUI() {
- //Create and set up the window.
- JFrame frame = new JFrame("Online Membership System");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- //Create and set up the content pane.
- Client cli = new Client();
- cli.init(frame.getContentPane());
- //Display the window.
- frame.pack();
- frame.setSize(600, 500);
- frame.setVisible(true);
- }
- public static void main(String[] args) {
- //Schedule a job for the event dispatch thread:
- //creating and showing this application's GUI.
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- createAndShowGUI();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement