Here's another method:
private void RenkMouseClicked(java.awt.event.MouseEvent evt) {
renk = JColorChooser.showDialog(null, "Select the background color",
renk);
Container a = this.getContentPane();
a.setBackground(renk);
}
I'm using netbeans ide. For me, JFrame.getContentPane()
didn't run. I used JFrame.getContentPane()
's class equivalent this.getContentPane
.