I'm trying to implement this GUI and I'm missing just a JTextField
. I want it to be below everything, and as wide as the 2 comboboxes. Also add some height. I was trying to use it inside the GroupLayout
(in the code below), but everything gets messed up if I do so. Is there a way of creating a new group layout underneath this one and just add the textfield
? Thank you for your help
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
GroupLayout.SequentialGroup horizontalGroup = layout.createSequentialGroup();
horizontalGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addGap(50, 50, 50)
));
horizontalGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fromLabel)
.addComponent(timeLabel)
));
horizontalGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainLabel)
.addComponent(queryLabel)
.addComponent(employeeMsg)
.addComponent(stopListDeparture)
.addComponent(departureTime, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField)
));
horizontalGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(toLabel)
));
horizontalGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(stopListArrival)
.addComponent(queryButton)
.addGap(200, 200, 200)
));
layout.setHorizontalGroup(horizontalGroup);
/////////////////////////////////////////////////////////////////////////////////////
// creating the vertical view
GroupLayout.SequentialGroup verticalGroup = layout.createSequentialGroup();
verticalGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainLabel)
.addGap(50, 50, 50)
));
verticalGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(employeeMsg)
.addGap(50, 50, 50)
));
verticalGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(queryLabel)
.addGap(40,40,40)
));
verticalGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(jButton1)
//.addComponent(jSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fromLabel)
.addComponent(toLabel)
.addComponent(stopListDeparture)
.addComponent(stopListArrival)
);
verticalGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(departureTime, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
GroupLayout.PREFERRED_SIZE)
.addComponent(timeLabel)
.addComponent(queryButton)
);
verticalGroup.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(jTextField)
);
layout.setVerticalGroup(verticalGroup);