Jump to content
  • Advertisement
Sign in to follow this  
xSKOTTIEx

very quick question

This topic is 4849 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
Advertisement
Skottie,

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: http://java.sun.com/developer/onlineTraining/GUI/AWTLayoutMgr/shortcourse.html#gridLayout

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));


Cheers,

Tom

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!