java - Swing: How do i create an east hugging component that will not move over western components -
i've tried several ways render correctly. want logo area hug east window resized, not overlap western components. following code not hug east, think makes sense because the logoarea box not know should take rest of horizontal space. if add logoarea directly 'area' hugs east, overlap western components if window shrinks much. ideas? box box = box.createhorizontalbox(); box.add( main ); for( jcomponent item : items ) //western stuff { box.add( box.createhorizontalstrut( 8 ) ); box.add( item ); } //eastern stuff box logoarea= box.createhorizontalbox(); logoarea.add( new jlabel( laf.icon.png( "companylogo" ) ), borderlayout.east ); box.add( box.createhorizontalstrut( 8 ) ); box.add( logoarea, borderlayout.east ); jpanel area = new jpanel( new borderlayout() ); area.setborder( borderfactory.createemptyborder( 2, 2, 2, 2 ) ); area.add( box, borderlayout.west ); return area; //dashboard built edit to answer @nitin i'd move lef...