Forums Register Login

Urgent Swing help needed

+Pie Number of slices to send: Send
In the middle of a Swing assessment for a job im going for (has to be done in next hour)

am wasting time trying to figure out how to display my JTextfields and align them when i should be coding the rest of the project

Its been a couple of years since i did any swing so cant remember much..

basically what i need is 2 columns the first has all the field titles (i.e PersonID, First Name, DOB ...etc) uneditable
the second will have corresponding editable JTextfields that will contain the data for each person

I know this is simple but like i said im rusty so a couple of lines showing how to get setlayout and get them in the roght place would be greatly appreciated
+Pie Number of slices to send: Send
from your description, generally, you would have two gridlayout panels, both (0,1)
the labels would be added to the first gridlayout
the textfields added to the second

the gridlayout panels would be added to a borderlayout panel
label gridlayout to borderlayout.west
textfield gridlayout to borderlayout.center

the labels/textfields should line up alongside each other,
and if the frame is dragged wider, the additional space will go to the textfields
+Pie Number of slices to send: Send
 

Keith Mc C wrote:Urgent Swing help needed [...] (has to be done in next hour)


Please EaseUp. You may be in a hurry, but we are all volunteers with our own jobs. I myself am now on my break.

Also, next time UseAMeaningfulSubjectLine. 99% of the posts in this sub forum are about request for help with Swing.
+Pie Number of slices to send: Send
 

Michael Dunn wrote:from your description, generally, you would have two gridlayout panels, both (0,1)
the labels would be added to the first gridlayout
the textfields added to the second

the gridlayout panels would be added to a borderlayout panel
label gridlayout to borderlayout.west
textfield gridlayout to borderlayout.center

the labels/textfields should line up alongside each other,
and if the frame is dragged wider, the additional space will go to the textfields



Thanks Michael, found that very helpful.

Unfortunately didnt get alot of the functionality done in the time allocated but at least the GUI was readable and I got the data that was read in from file displayed on it.

Better brush up on my swing for future, thanks again. Keith.
You showed up just in time for the waffles! And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 821 times.
Similar Threads
swing basics..
GUI Access Problems
about JTextField input
GridBagLayout ipadx help.
Best practise for displaying live log files in swing
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:43:45.