I want to add components to MigLayout which i can add as sent/recieved message, just like this:
--------------------------------------------
| received message |
| sent Message|
--------------------------------------------
I have created following constructor:
new MigLayout(
// set the automatic wrap after columns
"insets 0, wrap 0",
// hardcode fixed column width and fixed column gap
"",
// hardcode fixed height and a zero row gap
"[]10"));
while adding a component if i use "push, al right" it doest the job for me but the components take average space of height as shown in link below:
so all i want is these components one after another with only gap specified(10) in constructor. Thanks
Try something like:
JPanel parent = JPanel( new BorderLayout() );
parent.add(yourPanelUsingMigLayout, BorderLayout.PAGE_START);
frame.add(parent);
The BorderLayout.PAGE_START will respect the preferred height of the component. Therefore you should not see vertical space between components.
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.