• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception group layout  RSS feed

 
Alexander Jon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello I am making an expert system using Jess about animals.
I wanted to make an interface using Swing and so I did.
I have a problem using group layouts. The application works fine but at the end a exceptions is thrown:


The application ask the user some questions about the animal. When the expert system has enough information to know the animal it tells the name of the animal and shows a picture of it.
The exception is thrown when the application has guessed the animal and shows the response.
Here is the code:


I think the problem is related to the group layouts.
I will attach the eclipse project too but I think you will not need it.

I hope you can help me. Thanks in advance.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

GroupLayout was created for and used by (mainly) DnD style UI builders. I would recommend using a a combination of standard layout managers or use a third party layout manager like http://www.miglayout.com/
 
Campbell Ritchie
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome again

I had to break the long line in the exception printout otherwise the thread is difficult to read. There is an alternative solution, which appears in the exception printout. Always read exception printouts carefully.
It says
... is not attached to a horizontal group
There is one label which you have not attached to a horizontal group, so try attaching it.

But I agree with Maneesh. Group Layout is designed for automatic tools, so let the automatic tools use it.
 
Alexander Jon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tank you all.
The exception message says that I did not attach the label but I think I did:


Or is there something I am missing?
 
Alexander Jon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved this by using a box layout.
But I still would like to know why the other way did not work.

Thanks.
 
Campbell Ritchie
Sheriff
Posts: 53720
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is a sequential group the same as a horizontal group?

If you want to find out what went wrong, go back to group layout and remove every component except one. Then compile and run the app. Then add them back one by one and see what happens. You may be able simply to delete the add() invocations and maybe the code will still compile.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!