Advertisement Jump to content
Sign in to follow this  

very quick question

This topic is 4915 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im creating a calendar widget to allow people to select a date (in java), much like what you would see in setting the system time under windows, where the dates show up under the correct days etc. im using a gridlayout for the days, but sometimes the layout needs a 6th week (if the month starts on a friday ) but when i do that, the layout goes bad. nothing aligns properly because the gridlayout creates a new column (the first day would show up next to the SAT label... offsetting everything. why does the layout create a new column when you specify the size? and how do i stop it? thanks.

Share this post

Link to post
Share on other sites

I think your problem stems from the constructor for GridLayout only respecting *one* its initial size parameters. So if you specify a non-zero row value the layout will completely ignore your column value and add as many columns as it needs! (for the components that are being added)

For further details see:

I think you can fix your problem by supplying a row value of zero and I guess a value of seven for your columns ( provided your just displaying the seven days and nothing else interesting )

f.setLayout(new GridLayout(0,7));



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!