Skip to main content
gamedev.net
🔒 Locked

very quick question

Started by xSKOTTIEx Aug 8, 2005 at 8:20 AM 0 replies 400+ views
Original Post
xSKOTTIEx
xSKOTTIEx
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.
---------Coming soon! Microcosm II.
TomH
TomH
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.