Forums Register Login

Exception group layout

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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/
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
I solved this by using a box layout.
But I still would like to know why the other way did not work.

Thanks.
+Pie Number of slices to send: Send
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.
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1561 times.
Similar Threads
Ideas on achieving this using group layout?
How to add panel in from other class
Problem with GroupLayout Manager
errors while using swings
Can't Get ScrollBar to Show
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:03:07.