java - MigLayout - Need help on how to use the dock parameters (or need an alternative) -



java - MigLayout - Need help on how to use the dock parameters (or need an alternative) -

i started using miglayout swing in java , i'm liking far. thing, though, dock parameters don't seem work way thought worked , can't figure out i'm doing wrong.

the problem is: i'm trying add together jbutton within jpanel , docking right side using panel.add(button, "east");. while makes rightmost component, still takes same space in flowlayout. i'd stick right side of panel.

here's compilable code recreates problem:

public class miglayouttest extends jframe { public miglayouttest() { setsize(500,500); jpanel panel = new jpanel(new miglayout()); panel.setbackground(color.yellow); setcontentpane(panel); panel.setsize(500,500); panel.add(new jbutton("dock east"), "east"); panel.add(new jbutton("no dock")); } public static void main(string[] args) { jframe frame = new miglayouttest(); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.exit_on_close); } }

here's output looks like:

and here's i'd want "dock east" button:

if i'm using parameters wrong, i'd if tell me how i'm supposed create button dock right side of panel.

thanks!

you have specify growth paarameters:

new miglayout("", "[grow]", "[]")

be careful though how utilize - may not work way think is. here read on miglayout features http://www.miglayout.com/quickstart.pdf

java swing layout miglayout

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -