Results 1 to 2 of 2

Thread: GroupLayout

  1. #1
    Unknown101 is offline Member
    Join Date
    Jul 2014
    Posts
    1
    Rep Power
    0

    Question GroupLayout

    It gives me a error saying

    java.lang.IllegalStateException: javax.swing.JButton[,0,0,0x0,invalid

    [...]

    is not attached to a horizontal group.

    But the button is attcahed to the horizotal group:

    Java Code:
    	layout = new GroupLayout(getContentPane());
    		getContentPane().setLayout(layout);	
    		start = new JButton();
    		start.addActionListener(handler);
    		start.setText("Start");
    		start.setVisible(true);
    [...]
    layout.setAutoCreateContainerGaps(true);
    		layout.setAutoCreateGaps(true);
    		layout.setHorizontalGroup(layout
    				.createSequentialGroup()
    				.addGroup(
    						layout.createParallelGroup(
    								GroupLayout.Alignment.LEADING)
    								.addComponent(key_label)
    								.addComponent(charset_label))
    				.addGroup(
    						layout.createParallelGroup(
    								GroupLayout.Alignment.LEADING)
    								.addComponent(key_path)
    								.addComponent(charset_path).addComponent(start)) //HERE
    				.addGroup(
    						layout.createParallelGroup(
    								GroupLayout.Alignment.LEADING)
    								.addComponent(key_label)
    								.addComponent(charset_label)));
    		layout.setVerticalGroup(layout
    				.createSequentialGroup()
    				.addGroup(
    						layout.createParallelGroup(
    								GroupLayout.Alignment.BASELINE)
    								.addComponent(key_label).addComponent(key_path)
    								.addComponent(key_chooser))
    				.addGroup(
    						layout.createParallelGroup(
    								GroupLayout.Alignment.BASELINE)
    								.addComponent(charset_label)
    								.addComponent(charset_path)
    								.addComponent(key_chooser))
    				.addGroup(
    						layout.createParallelGroup(
    								GroupLayout.Alignment.LEADING).addComponent(
    								start)));
    Can someone explain this?

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default Re: GroupLayout

    Can you post the full text of the compiler's error message?
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. need help with GroupLayout .. please help
    By atrodeyo in forum AWT / Swing
    Replies: 0
    Last Post: 05-18-2012, 12:28 AM
  2. Needing help with GroupLayout
    By Janohjk in forum AWT / Swing
    Replies: 2
    Last Post: 06-18-2011, 10:41 AM
  3. GroupLayout problem
    By batia in forum New To Java
    Replies: 5
    Last Post: 04-27-2011, 07:31 PM
  4. GroupLayout
    By Itun in forum AWT / Swing
    Replies: 3
    Last Post: 03-24-2011, 05:19 PM
  5. GroupLayout Issue
    By m_patten2 in forum AWT / Swing
    Replies: 2
    Last Post: 11-10-2010, 10:50 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •