title: java JList size
body: <p>Hi i want to set JList height as height as screen is</p>
  
  <pre><code>public Locations() {
      Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
      screenWidth = screen.width;
      screenHeight = screen.height;
      initComponents();
  }
  
  private void initComponents() {
      setLayout(new GroupLayout());
      add(getJScrollPane0(), new Constraints(new Leading(8, 100, 10, 10), new Leading(5, 135, 10, 10)));
      setSize(1366, 768);
  }
  
  private JScrollPane getJScrollPane0() {
      if (jScrollPane0 == null) {
          jScrollPane0 = new JScrollPane();
          jScrollPane0.setSize(screenWidth, screenHeight);
          jScrollPane0.setViewportView(getJList0());
      }
      return jScrollPane0;
  }
  
  private JList getJList0() {
      if (jList0 == null) {
          jList0 = new JList();
          jList0.setSize(400, screenHeight);
          DefaultListModel listModel = new DefaultListModel();
          listModel.addElement("item0");
          listModel.addElement("item1item1item1item1item1");
          listModel.addElement("item2");
          listModel.addElement("item3");
          jList0.setModel(listModel);
      }
      return jList0;
  }
  
  private static void installLnF() {
      try {
          String lnfClassname = PREFERRED_LOOK_AND_FEEL;
          if (lnfClassname == null)
              lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName();
          UIManager.setLookAndFeel(lnfClassname);
      } catch (Exception e) {
          System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL
                  + " on this platform:" + e.getMessage());
      }
  }
  
  /**
   * Main entry of the class.
   * Note: This class is only created so that you can easily preview the result at runtime.
   * It is not expected to be managed by the designer.
   * You can modify it as you like.
   */
  public static void main(String[] args) {
      installLnF();
      SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setTitle("Locations");
              Locations content = new Locations();
              content.setPreferredSize(content.getSize());
              frame.add(content, BorderLayout.CENTER);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
          }
      });
  }
  </code></pre>
  
  <p>But list size is like i draw it in editor, how to change it ??</p>
  
  <p>Edit:</p>
  
  <p>I have solved the problem by adding</p>
  
  <pre><code>add(getJScrollPane0(), new Constraints(new Leading(8, 100, 10, 10), new Leading(5, screenHeight - 115, 10, 10)));
  </code></pre>