Guest User

Untitled

a guest
Dec 23rd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. import java.awt.*;
  2. import javax.swing.*;
  3.  
  4.  
  5. public class ConnectGui extends JPanel
  6. {
  7. JPanel ConnectPanel;
  8. JLabel serverLabel;
  9. JLabel usernameLabel;
  10. JLabel passwordLabel;
  11.  
  12. JTextField serverField;
  13. JTextField portField;
  14.  
  15. JTextField usernameField;
  16. JTextField passwordField;
  17.  
  18. public ConnectGui()
  19. {
  20. ConnectPanel = new JPanel();
  21.  
  22. serverLabel = new JLabel("Server: ");
  23. usernameLabel = new JLabel("Username: ");
  24. passwordLabel = new JLabel("Password: ");
  25.  
  26. serverField = new JTextField (7);
  27. portField = new JTextField(7);
  28.  
  29. usernameField = new JTextField(7);
  30. passwordField = new JTextField(7);
  31.  
  32. ConnectPanel.setLayout(new BoxLayout(ConnectPanel,BoxLayout.X_AXIS));
  33. ConnectPanel.add(serverLabel);
  34. ConnectPanel.add(serverField);
  35. ConnectPanel.add(portField);
  36. ConnectPanel.add(usernameLabel);
  37. ConnectPanel.add(usernameField);
  38. ConnectPanel.add(passwordLabel);
  39. ConnectPanel.add(passwordField);
  40. }
  41. public static void main (String args[])
  42. {
  43.  
  44. }
  45. }
  46.  
  47. import java.awt.*;
  48. import javax.swing.*;
  49.  
  50.  
  51. public class ShareGui extends JFrame
  52. {
  53.  
  54. public static void main (String args[])
  55. {
  56. ConnectGui test2 = new ConnectGui();
  57. ShareGui test = new ShareGui();
  58.  
  59. test.setLayout(new FlowLayout());
  60. test.add(test2.ConnectPanel);
  61.  
  62. test.setSize(600,400);
  63. test.setVisible(true);
  64.  
  65.  
  66. }
  67.  
  68. }
Add Comment
Please, Sign In to add comment