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 - Why does setBounds() method not work even after setting setLayout() as null? -


usually setbounds() method positions called object in specified location , in specified size..right? created jframe class , demonstrated working on button setting setlayout(null). created class extends jpanel , put components in it. bounds these components set inside method. object of class included in class extends jframe. object calls setbound() method. result not show components in jpanel extended class. cde fragment given below.

class administrator extends jframe implements actionlistener {   public administrator()   {     settitle("administration");      setsize(500,500);     setdefaultcloseoperation(exit_on_close);     setlayout(null);         jbutton newbutton=new jbutton(" new.. ");     newbutton.addactionlistener(this);     add(newbutton);     newbutton.setbounds(100,100,100,25);     setvisible(true);      public static void main(string arg[])     {       new administrator();     }       public void actionperformed(actionevent ae)   {     string act=(string)ae.getactioncommand();     if(act.equals("new registry..")||act.equals(" new.. "))      {         regpanel rgpnl=new regpanel();          dimension sz;         sz=rgpnl.getpreferredsize();          rgpnl.setbounds(800,800,sz.width,sz.height);                rgpnl.arrangecomponents();            add(rgpnl);           repaint();         setvisible(true);      } } class regpanel extends jpanel  {   label namelab;   jtextfield name;   jbutton do_register;   public regpanel()   {     //container   = ();     setlayout(null);      namelab=new label("name :");     name=new jtextfield(20);      add(namelab);      add(name);     add(do_register);     }    public void arrangecomponents()    {     dimension size;      size=namelab.getpreferredsize();     namelab.setbounds(20,10,size.width,size.height);     name.getpreferredsize();     name.setbounds(150,10,size.width,size.height);      do_register.setbounds(10,10,size.width,size.height);      repaint();    }     }      

apart questionable parts of code -- missing curly brackets, null pointers , such errors -- code creates components @ (800,800) while interface 500x500 px in size. put components out-of-view. put components @ smaller offset window origin , show. (i tested this, along modifications code, order in calls made respect setlayout(null). call should seemingly occur @ right time, otherwise components wouldn't show me.)


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 -