Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. import java.awt.*;
  2. import javax.swing.*;
  3.  
  4. public class Client {
  5.  
  6. // Debug/Status
  7. JTextArea debugLog = new JTextArea(10,10);
  8.  
  9. // Login Card
  10. JTextField userName = new JTextField("", 20);
  11. JPasswordField userPass = new JPasswordField("", 20);
  12. JButton loginButton = new JButton("Log In");
  13.  
  14.  
  15. public void init(Container pane) {
  16. JTabbedPane tabbedPane = new JTabbedPane();
  17.  
  18.  
  19. // Debug Panel
  20. JPanel log = new JPanel();
  21. log.setLayout(new BorderLayout());
  22. log.add(debugLog);
  23.  
  24.  
  25. // Cards for pages
  26. JPanel loginCard = new JPanel();
  27. JPanel publicCard = new JPanel();
  28. JPanel privateCard = new JPanel();
  29. JPanel groupCard = new JPanel();
  30.  
  31.  
  32. // Populate the panel cards
  33.  
  34. // Login Page
  35. loginCard.setLayout(new GridLayout(4,2,5,5));
  36.  
  37. loginCard.add(new JLabel("User Name: ", JLabel.LEFT));
  38. loginCard.add(userName);
  39.  
  40. loginCard.add(new JLabel("Password: ", JLabel.LEFT));
  41. loginCard.add(userPass);
  42.  
  43. loginCard.add(loginButton);
  44.  
  45.  
  46.  
  47. JPanel card2 = new JPanel();
  48. card2.add(new JTextField("TextField", 20));
  49.  
  50. tabbedPane.addTab("Log In", loginCard);
  51. tabbedPane.addTab("Public Groups", publicCard);
  52. tabbedPane.addTab("Private Groups", privateCard);
  53. tabbedPane.addTab("Friend's Groups", groupCard);
  54.  
  55.  
  56. tabbedPane.setSize(600,400);
  57. pane.add(tabbedPane, BorderLayout.NORTH);
  58. pane.add(log, BorderLayout.SOUTH);
  59. }
  60.  
  61. /**
  62. * Create the GUI and show it. For thread safety,
  63. * this method should be invoked from the
  64. * event dispatch thread.
  65. */
  66. private static void createAndShowGUI() {
  67. //Create and set up the window.
  68. JFrame frame = new JFrame("Online Membership System");
  69. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  70.  
  71. //Create and set up the content pane.
  72. Client cli = new Client();
  73. cli.init(frame.getContentPane());
  74.  
  75. //Display the window.
  76. frame.pack();
  77. frame.setSize(600, 500);
  78. frame.setVisible(true);
  79. }
  80.  
  81. public static void main(String[] args) {
  82.  
  83. //Schedule a job for the event dispatch thread:
  84. //creating and showing this application's GUI.
  85. javax.swing.SwingUtilities.invokeLater(new Runnable() {
  86. public void run() {
  87. createAndShowGUI();
  88. }
  89. });
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement