Monday, 15 March 2010

java - Null layout - components hide after repainting -



java - Null layout - components hide after repainting -

so have big panel with: setlayout(null). want add together button it. in big panel's constructor add together such code:

jbutton button = new jbutton("eeee"); button.setbounds(100, 100, 100, 50); add(button);

and it's okay. when repaint big panel button hides. appears 1 time again when move mouse place should be... how prevent unusual behaviour? maybe connected fact add together button in constrcutor?

you need allow paint panel components first "super.paint (g)" if not not draw components added

@override public void paint(graphics g){ super.paint(g); //draw button default // hear, can draw others things }

java

No comments:

Post a Comment