The default behavior of a GridLayout
is that the components are filled row by row, and from left to right. I wonder if I can use it so that the components are filled by columns (from left to right)? Thanks.
Java – How to fill a GridLayout top-to-bottom and then left-to-right
awtgrid layoutjavalayout-managerswing
Related Topic
- Java – When to use LinkedList over ArrayList in Java
- Java – What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do
- Java – Does Java support default parameter values
- Java – How to declare and initialize an array in Java
- Java – How to use java.net.URLConnection to fire and handle HTTP requests
- Java – What’s the difference between @Component, @Repository & @Service annotations in Spring
- Java – Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing
- Java – What are the -Xms and -Xmx parameters when starting JVM
Best Answer
You can extend GridLayout and override just one method instead of
int i = r * ncols + c;
useint i = c * nrows + r;
I think that's enough.