01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
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;
19: import javax.swing.ListSelectionModel;
20: import javax.swing.table.DefaultTableCellRenderer;
21: import javax.swing.table.TableColumn;
22:
23: import org.columba.mail.config.AccountList;
24:
25: class AccountListTable extends JTable {
26: public AccountListTable(AccountList accountList,
27: AccountListDialog frame) {
28: super (new AccountListDataModel(accountList));
29:
30: setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
31: setShowGrid(false);
32: setIntercellSpacing(new java.awt.Dimension(0, 0));
33:
34: TableColumn 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 renderer = (DefaultTableCellRenderer) tableHeader
45: .getDefaultRenderer();
46: renderer.setHorizontalAlignment(DefaultTableCellRenderer.LEFT);
47: }
48:
49: public void update() {
50: ((AccountListDataModel) getModel()).fireTableDataChanged();
51: }
52: }
|