Set background color in Java on a JPanel doesn't work -
i working on "paint-like" application (a little drawing software) familiarize java 2d components. here problem: have jframe contentpane instance of class inheriting jpanel. want set background color white remains on default color... class name corresponding contentpane container. here simplified code:
public class container extends jpanel { public container() { super(); this.setbackground(color.white); } }
the jframe constructor contains line:
this.setcontentpane(maincontainer);
have missed something?
thx.
this fix it...
public class container extends jpanel { public container() { super(); this.setopaque(true); this.setbackground(color.white); } }
Comments
Post a Comment