Ho scritto il seguente programma. Il programma ha una jlabel alla quale setto il colore di background a bianco. Eseguo il programma ed il colore della label non e' bianco. Qualssiasi colore provo ad impostare non mi cambia il colore della jlabel. Come mai?
codice:
import java.awt.Color;
import java.awt.FlowLayout;
import javax.swing.border.*;
import javax.swing.*;
public class BuildDbConverter {
public static JFrame frame;
public static JTextArea textArea;
private static JLabel label;
public BuildDbConverter() {
frame = new JFrame();
label = new JLabel("Lista: ");
label.setBackground(Color.white);
label.setForeground(Color.red);
textArea = new JTextArea();
textArea.setBackground(Color.lightGray);
textArea.setBorder(new LineBorder(Color.darkGray));
textArea.setEditable(false);
textArea.setEnabled(false);
textArea.setForeground(Color.black);
JButton openFileButton = new JButton("apri");
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout());
buttonPanel.add(openFileButton);
JSplitPane northsplitPanel =
new JSplitPane(JSplitPane.VERTICAL_SPLIT, buttonPanel, label);
northsplitPanel.setDividerSize(0);
JSplitPane centerSplitPanel =
new JSplitPane(JSplitPane.VERTICAL_SPLIT, northsplitPanel, textArea);
centerSplitPanel.setDividerSize(0);
frame.setContentPane(centerSplitPanel);
frame.setResizable(false);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
new BuildDbConverter();
}
}