I'm wondering what the ideal way is to organize buttons, textfields, text, etc. In JFrame, because the way i'm doing it now takes up a lot of lines and I struggle with making a good layout. I'm currently using GridBagConstraints so a more specific question is how could I have a button between gridx 1 and 2 without a big gap. Here's the code I have.
myGrid.gridy = 1;
myGrid.gridx = 1;
getContentPane().add(firstName, myGrid);
myGrid.gridx = 2;
getContentPane().add(firstNameField, myGrid);
myGrid.gridy = 2;
myGrid.gridx = 1;
getContentPane().add(lastName, myGrid);
myGrid.gridx = 2;
getContentPane().add(lastNameField, myGrid);
myGrid.gridy = 3;
myGrid.gridx = 1;
getContentPane().add(studentID, myGrid);
myGrid.gridx = 2;
getContentPane().add(studentIDField, myGrid);
myGrid.gridx = 1;
myGrid.gridy = 4;
getContentPane().add(grade, myGrid);
myGrid.gridx = 2;
getContentPane().add(gradeField, myGrid);
myGrid.gridx = 1;
myGrid.gridy = 5;
getContentPane().add(hours, myGrid);
myGrid.gridx = 2;
getContentPane().add(hoursField, myGrid);