Thomas Darimont
Erfahrenes Mitglied
Servus!
Hier mal eine Möglichkeit eure Swing-Komponenten unabhänig vom verwendeten LookAndFeel einzufärben:
hier : findet ihr eine Liste mit den passenden Keywords für den passenden UIManager.put - Aufruf ....
Gruß Tom
Hier mal eine Möglichkeit eure Swing-Komponenten unabhänig vom verwendeten LookAndFeel einzufärben:
Code:
/*
* ColorTestForm.java
*
* Created on 17. August 2003, 22:45
*/
/**
*
* @author Administrator
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ColorTestForm extends javax.swing.JFrame {
/** Creates new form ColorTestForm */
public ColorTestForm() {
initComponents();
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Test0", "Test1", "Test2", "Test3", "Test4", "Test5" }));
UIManager.put("ComboBox.selectionBackground", Color.yellow);
UIManager.put("ComboBox.foreground", Color.red);
jComboBox1.updateUI();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jPanel1 = new javax.swing.JPanel();
jComboBox1 = new javax.swing.JComboBox();
jLabel1 = new javax.swing.JLabel();
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
jPanel1.setLayout(new java.awt.GridBagLayout());
jPanel1.setPreferredSize(new java.awt.Dimension(320, 240));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
jPanel1.add(jComboBox1, gridBagConstraints);
jLabel1.setText("jLabel1");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
jPanel1.add(jLabel1, gridBagConstraints);
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
pack();
}
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new ColorTestForm().show();
}
// Variables declaration - do not modify
private javax.swing.JComboBox jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
hier : findet ihr eine Liste mit den passenden Keywords für den passenden UIManager.put - Aufruf ....
Gruß Tom