ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
1077
1077
EMPFEHLEN
-
17.08.03 23:05 #1
- Registriert seit
- Jun 2002
- Ort
- Saarbrücken (Saarland)
- Beiträge
- 9.886
- Blog-Einträge
- 29
Servus!
Hier mal eine Möglichkeit eure Swing-Komponenten unabhänig vom verwendeten LookAndFeel einzufärben:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
/* * 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ß TomJava rocks!
How to become a good Java Programmer?
Does IT in Java and .Net
The only valid measurement of code quality: WTFs / minute
Blog
Xing
Twitter
Ähnliche Themen
-
Swing-Komponenten proportional skalieren?
Von Frezl im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 5Letzter Beitrag: 12.07.09, 18:01 -
Swing Komponenten Dynamisch Erstellen
Von superwitti im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 8Letzter Beitrag: 01.04.08, 18:18 -
Freie Swing Komponenten von swinglabs
Von Thomas Darimont im Forum Java Technology NewsAntworten: 2Letzter Beitrag: 27.02.06, 18:51 -
IDs von Swing-Komponenten
Von Bullitt im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 1Letzter Beitrag: 11.03.04, 21:50 -
Eigene Swing Komponenten
Von CosmoKey im Forum Swing, Java2D/3D, SWT, JFaceAntworten: 1Letzter Beitrag: 28.10.03, 20:32






Zitieren
Login





