KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > gui > config > accountlist > AccountListTable


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.mail.gui.config.accountlist;
17
18 import javax.swing.JTable JavaDoc;
19 import javax.swing.ListSelectionModel JavaDoc;
20 import javax.swing.table.DefaultTableCellRenderer JavaDoc;
21 import javax.swing.table.TableColumn JavaDoc;
22
23 import org.columba.mail.config.AccountList;
24
25
26  class AccountListTable extends JTable JavaDoc {
27     public AccountListTable(AccountList accountList, AccountListDialog frame) {
28         super(new AccountListDataModel(accountList));
29
30         setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
31         setShowGrid(false);
32         setIntercellSpacing(new java.awt.Dimension JavaDoc(0, 0));
33
34         TableColumn JavaDoc tc = getColumnModel().getColumn(0);
35         tc.setCellRenderer(new NameRenderer());
36
37         tc = getColumnModel().getColumn(1);
38         tc.setMaxWidth(100);
39         tc.setMinWidth(100);
40         tc.setCellRenderer(new StringAccountRenderer(true));
41
42         sizeColumnsToFit(AUTO_RESIZE_NEXT_COLUMN);
43
44         DefaultTableCellRenderer JavaDoc renderer = (DefaultTableCellRenderer JavaDoc) tableHeader.getDefaultRenderer();
45         renderer.setHorizontalAlignment(DefaultTableCellRenderer.LEFT);
46     }
47
48     public void update() {
49         ((AccountListDataModel) getModel()).fireTableDataChanged();
50     }
51 }
52
Popular Tags