Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 1.40 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. set size wont work in java
  2. public void start_Gui() {
  3.  
  4.         JFrame window = new JFrame("Client Program");
  5.         window.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE);
  6.  
  7.         JPanel panel = new JPanel();
  8.         window.setContentPane(panel);
  9.         panel.setLayout(new GridLayout(1,2));
  10.  
  11.         JLabel leftside = new JLabel();
  12.         leftside.setLayout(new GridLayout(2, 1));
  13.  
  14.         JTextArea rightside = new JTextArea();
  15.         rightside.setEditable(false);   //add scroll pane.
  16.         rightside.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  17.         rightside.setLayout(new FlowLayout());
  18.  
  19.         JTextArea client_text_input = new JTextArea();
  20.         client_text_input.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  21.         leftside.add(client_text_input);
  22.  
  23.         JLabel buttons_layer = new JLabel();
  24.         JButton login = new JButton("Login");
  25.         JButton logout = new JButton("Logout");
  26.         buttons_layer.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  27.         buttons_layer.setLayout(new GridLayout(2, 1));
  28.         buttons_layer.add(login);
  29.         buttons_layer.add(logout);
  30.         leftside.add(buttons_layer);
  31.  
  32.         panel.add(leftside);
  33.         panel.add(rightside);
  34.  
  35.         window.setSize(300, 400);
  36.         window.setResizable(false);
  37.         window.setVisible(true);
  38.     }
  39.        
  40. JTextArea client_text_input = new JTextArea();
  41.     client_text_input.setSize(100,200);