UnreachableCode
UnreachableCode

Reputation: 1791

I'm adding a combobox to someone's existing Swing code. What am I doing wrong here?

.addGroup(makeBookingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel48)
                            .addComponent(sittingPull, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(bookingTime2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

I'm trying to place bookingTime2 after sittingPull, to the right. I realise with the current parameters I'm placing them in the same place. I don't understand default_size or preferred_size though. How do I change these parameters to achieve what I want?

Upvotes: 0

Views: 190

Answers (1)

mKorbel
mKorbel

Reputation: 109813

you have (last two code lines in void or contructor) call for JComboBox's container

Xxx.revalidate();
Xxx.repaint();

Upvotes: 1

Related Questions