简体   繁体   中英

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM