简体   繁体   中英

Positioning using GridBagLayout

As you can see in my output below, the label is displayed on top of my "next piece" grid. I know why this is happening (because my grid bag constraints are at the same location) but if I increase the y component of these constraints, my "next piece" grid is moved the the y coordinate after the larger grid. I would like to have the "next piece" grid where it is with the label right over top of it.

Any suggestions?

在此输入图像描述

Either

  1. Use a compound layout (placing the two components on the left in there own container and then adding that to the main container) or
  2. Take a look at the gridheight property of GridBagConstraints (for the other two components right of the problem area)

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