01: package test.contrib;
02:
03: import java.awt.*;
04:
05: import javax.swing.*;
06: import javax.swing.table.DefaultTableCellRenderer;
07:
08: import org.jdesktop.swingx.JXPanel;
09:
10: /*
11: * InternalFrameDemo.java requires:
12: * MyInternalFrame.java
13: */
14: public class JXPanelDemo extends JFrame {
15: public JXPanelDemo() {
16: super ("InternalFrameDemo");
17:
18: this .setSize(500, 300);
19: this .setLocationRelativeTo(null);
20:
21: JXPanel panel = new JXPanel();
22:
23: // panel.setOpaque(false);
24: panel.setAlpha(0.5f);
25: this .setLayout(new BorderLayout());
26: this .add(panel, BorderLayout.CENTER);
27:
28: panel.setLayout(new GridLayout(1, 2));
29: String[] columnNames = { "First Name", "Last Name" };
30:
31: Object[][] data = { { "Mary", "Campione" },
32: { "Alison", "Huml" }, { "Kathy", "Walrath" } };
33:
34: JTable table = new JTable(data, columnNames);
35: // table.setBackground(new Color(255, 200, 200));
36: panel.add(table);
37: // A simple tree
38: panel.add(new JTree());
39: }
40:
41: /**
42: * Create the GUI and show it. For thread safety, this method should be
43: * invoked from the event-dispatching thread.
44: */
45: private static void createAndShowGUI() {
46: // Make sure we have nice window decorations.
47: // JFrame.setDefaultLookAndFeelDecorated(true);
48: try {
49: UIManager
50: .setLookAndFeel("org.jvnet.substance.SubstanceLookAndFeel");
51: // Create and set up the window.
52: JXPanelDemo frame = new JXPanelDemo();
53: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
54:
55: // Display the window.
56: frame.setVisible(true);
57: } catch (Exception e) {
58: e.printStackTrace();
59: }
60: }
61:
62: public static void main(String[] args) {
63: // Schedule a job for the event-dispatching thread:
64: // creating and showing this application's GUI.
65: javax.swing.SwingUtilities.invokeLater(new Runnable() {
66: public void run() {
67: createAndShowGUI();
68: }
69: });
70: }
71: }
|