Search code examples
javacomponentspane

Java: Arranging my GUI


so i have a general knowledge of java but i am just learning more in depth and i thought what better way t do that than to set my self a target this was to make a todo program for the misses ;).

anyways iv got all the database stuff sorted through SQL and all my other forms dont have much on them so dont require much formatting!

now i have come to my to do list input GUI basically iv looked at loads of tutorials and lots of posts on this site that just touch the tip of what need. so below is the design i want. i wont bore you with my code as its very messy and hard to understand (from following so many tutorials to make bits!)

but my main problem is i can declare the frames around the text boxes in todo and date to complete but then how do i get it so it goes Label 1. Textbox 1. new line label 2 textbox 2. i then run into another problem in that i cant figure out how to get it to go todo frame then date to the right of it. finally while i have you all reading and coming up with tips how do you make the frame fit the size of the components and panes inside of it?

(cant post an image sadly so ill explain, i have file name combo box and 2 buttons at the top. then a todo frame with 1-9 in labels each label should have a textbox next to it. then to the right of the todo frame a date to comeplete frame with 10 text boxes in all lined up vertically

thanks for your help in advance! it may be that there is a tutorial out there that explains this all to me but the java resource pages just confused me on this matter!

thanks again!


Solution

  • How do you make the frame fit the size of the components and panes inside of it?

    myFrame.pack();
    

    Pack will resize your frame to just fit everything, but you have to use setPrefferedSize to inner components. That's the only thing i can answer based on your description. Why can't you post a picture? Windows paint is pretty easy to use.