JCheckBox colours
From: Peter Greenwood (peterg_at_reel.demon.co.uk)
Date: 10/30/04
- Next message: Bill Lawson: "JFileChooser question"
- Previous message: Andrew Thompson: "Re: How to make java dispatch mouse events to my component"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Oct 2004 22:16:38 +0000 (UTC)
I'm trying to make my applet accept a parameter to set the background
colour (so it will blend into the web page colour scheme). For nearly
everything, this works fine. However, I can't seem to get access to the
border round the JCheckBox selected/deselected icon. (Not the border
round the whole JCheckBox component, the one round the check mark
itself). Whatever I do it stays persistently grey.
Apologies if I'm missing something obvious.
The following illustrates the problem; it shows a JLabel in default
colours, a Checkbox in turquoise (which is fine) and a JCheckBox in red
(which has a default grey outline).
public class chkbox_applet extends javax.swing.JApplet {
public void init() {
initComponents();
}
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jCheckBox1 = new javax.swing.JCheckBox();
checkbox1 = new java.awt.Checkbox();
jLabel1.setText("Checkbox Applet");
getContentPane().add(jLabel1, java.awt.BorderLayout.NORTH);
jCheckBox1.setBackground(new java.awt.Color(192, 0, 0));
jCheckBox1.setText("Test JCheckBox");
jCheckBox1.setBorderPainted(true);
jCheckBox1.setBorderPaintedFlat(true);
getContentPane().add(jCheckBox1, java.awt.BorderLayout.SOUTH);
checkbox1.setBackground(new java.awt.Color(128, 192, 192));
checkbox1.setLabel("Test Checkbox");
getContentPane().add(checkbox1, java.awt.BorderLayout.CENTER);
}
private java.awt.Checkbox checkbox1;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JLabel jLabel1;
}
-- Peter Greenwood peterg@reel.demon.co.uk http://www.reel.demon.co.uk +44 1253 821678
- Next message: Bill Lawson: "JFileChooser question"
- Previous message: Andrew Thompson: "Re: How to make java dispatch mouse events to my component"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]