Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - Swing: easiest way to align width of [dynamic][static][dynamic] components? -


what easiest way in standard java swing align 3 components in such way that:

  • the dynamic widths of component1 , component3 adjusted equal,

  • while component2 (which in between) has constant width?

imagine have resizable jpanel (such inside jframe).

small width should this:

[----------------whole jpanel----------------] [--component1--] [component2] [--component3--] 

big width should this:

[------------------------whole jpanel------------------------] [------component1------] [component2] [------component3------] 

note: "trialed-and-errored" grouplayout long.

one option using gridbaglayout. quick , dirty snippet started:

gridbagconstraints gbc; final int a_center = gridbagconstraints.center;  // anchor: center final int f_none = gridbagconstraints.none;  // fill: none final int f_dx = gridbagconstraints.horizontal;  // fill: dx final insets in_0 = new insets(0, 0, 0, 0);  // empty insets  setlayout(new gridbaglayout() ); gbc = new gridbagconstraints(0, 0, 1, 1, 50.0, 0.0, a_center, f_dx, in_0, 0, 0); add(new jbutton("test1"), gbc); gbc = new gridbagconstraints(1, 0, 1, 1, 0.0, 0.0, a_center, f_none, in_0, 0, 0); add(new jbutton("test2"), gbc); gbc = new gridbagconstraints(2, 0, 1, 1, 50.0, 0.0, a_center, f_dx, in_0, 0, 0); add(new jbutton("test1"), gbc); 

obviously there's lot more can gridbag, , you'll need polishing want see, should started.

the fifth parameter in gbc constructor weight stretching in x direction. setting them equal, , forcing center component not stretch (f_none) dirty work.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -