KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > core > MyTreeTableView


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.tasklist.core;
21
22 import java.awt.Dimension JavaDoc;
23 import javax.swing.*;
24 import javax.swing.table.TableColumnModel JavaDoc;
25 import javax.swing.table.TableModel JavaDoc;
26 import org.openide.explorer.view.TreeTableView;
27
28 /**
29  * Contains fixes that need access to final protected methods.
30  */

31 public final class MyTreeTableView extends TreeTableView {
32
33     private static final long serialVersionUID = 1;
34
35     public MyTreeTableView() {
36
37         JTable table = treeTable;
38         table.setShowHorizontalLines(true);
39         table.setShowVerticalLines(false);
40         
41         //table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
42
// No, I can use TreeTableView.setTableAutoResizeMode(int) for this
43

44         // No white clipping lines on selected table rows: reduce separator
45
// to 0. That means text may touch but HIE prefers this.
46
table.setIntercellSpacing(new Dimension JavaDoc(0, table.getRowMargin()));
47         double height = new JLabel("Z").getPreferredSize().getHeight(); // NOI18N
48
int intheight = (int) height;
49         table.setRowHeight(intheight);
50
51             /* Issue 23993 was fixed which probably makes this unnecessary:
52 // Grid color: HIE's asked for (230,230,230) but that seems troublesome
53 // since we'd have to make a GUI for customizing it. Instead, go
54 // with Metal's secondary2, since for alternative UIs this will continue
55 // to look good (and it's customizable by the user). And secondary2
56 // is close to the request valued - it's (204,204,204).
57 table.setGridColor((java.awt.Color)javax.swing.UIManager.getDefaults().get("Label.background")); // NOI18N
58              */

59     }
60     
61     public JTree getTree() {
62         return tree;
63     }
64     
65     public JTable getTable() {
66         return treeTable;
67     }
68     
69     public TableModel JavaDoc getModel() {
70         return treeTable.getModel();
71     }
72     
73     public TableColumnModel JavaDoc getHeaderModel() {
74         return treeTable.getTableHeader().getColumnModel();
75     }
76 }
77
78
Popular Tags