Link to home
Start Free TrialLog in
Avatar of dirku
dirkuFlag for Germany

asked on

Creating a MatrixLayout

I would like to create a MatrixLayout which is capable to layout out components in a matrix manner.
For instance I want to layout let's say five panels. the MatrixLayout class should now layout the five panels depending on the size of the container, maybe three panels in on row and the remaining two panels in a second row. If the container will be resized the matrix should be rearranged so that maybe now there are four panels in the first row because the user extended the width of the container.

Could anyone provide me with appropriate source code?

Thank you,

Dirk
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Use java.awt.GridLayout
Actually you should look at GridbagLayout
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JohnnyAffa
JohnnyAffa

if youre going for something like that then i think youll need to use  a null layout and then rearrange them using you class's paint method. however, when your main container you need to determine what size they should be, ie a percentage of the available width, a fixed size ( if you resize and there is enough room add a panel from the bottom row to the top).

want example code?
Avatar of dirku

ASKER

Oha. Sorry for that. Have a lot of work to do! Please, don't clean up this topic, I want to continue on it.

objects, I would be happy to write such a Layoutmanager together with you. How should we start it?
> How should we start it?

read the tutorial I posted above :)
its fairly straight forward.
Avatar of dirku

ASKER

These answers aren't worth 125 points! Of course, I expected some source code as posted in my question but I dodn't get any! Thus, the question wasn't answered at all.
As objects suggested I wnated to build a MatrixLayout together with him but it would have been great to get a first part of the code to make a start easier for me. I am not the expert. I'm just the questioner needing some assistance.
For the time being I didn't get any help. Sorry, experts but I'm no step further than before. --> Nothing but expenses this time.

This is disappointing (but does not affect the great assistance I got many times before)!