1 |
|
---|
2 | /*
|
---|
3 | * BerryBasketPanel.java
|
---|
4 | * Copyright (C) 2001 New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * This program is free software; you can redistribute it and/or modify
|
---|
7 | * it under the terms of the GNU General Public License as published by
|
---|
8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
9 | * (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This program is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | * GNU General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU General Public License
|
---|
17 | * along with this program; if not, write to the Free Software
|
---|
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
19 | */
|
---|
20 | package org.nzdl.gsdl.SimpleGraphicalClient;
|
---|
21 |
|
---|
22 |
|
---|
23 | import javax.swing.*;
|
---|
24 | import javax.swing.table.*;
|
---|
25 | import javax.swing.border.*;
|
---|
26 | import java.awt.*;
|
---|
27 | import java.awt.event.*;
|
---|
28 | import java.util.*;
|
---|
29 |
|
---|
30 |
|
---|
31 | public class BerryBasketPanel extends JPanel implements Constants {
|
---|
32 |
|
---|
33 | BerryBasketModel berryModel;
|
---|
34 | JTable berryTable;
|
---|
35 | JList berryList;
|
---|
36 | JScrollPane scrollBerryPane;
|
---|
37 |
|
---|
38 | public BerryBasketPanel(CSModel csModel) {
|
---|
39 | super();
|
---|
40 | setLayout( new BorderLayout() );
|
---|
41 | setBorder(BorderFactory.createTitledBorder("BerryBasket"));
|
---|
42 | berryModel = csModel.getBerryBasketModel();
|
---|
43 | berryTable = new JTable(berryModel);
|
---|
44 |
|
---|
45 | berryTable.setFont(berryFont);
|
---|
46 | berryTable.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
|
---|
47 |
|
---|
48 | //berryTable.setDefaultRenderer(Color.class, new BerryCellRenderer());
|
---|
49 | scrollBerryPane = new JScrollPane(berryTable);
|
---|
50 | berryTable.setPreferredScrollableViewportSize(new Dimension(100, 70));
|
---|
51 |
|
---|
52 | add(scrollBerryPane, BorderLayout.CENTER);
|
---|
53 | } //end constructor
|
---|
54 |
|
---|
55 |
|
---|
56 | class BerryCellRenderer extends JLabel implements TableCellRenderer {
|
---|
57 |
|
---|
58 | public Component getTableCellRendererComponent(JTable table,
|
---|
59 | Object value,
|
---|
60 | boolean isSelected,
|
---|
61 | boolean hasFocus,
|
---|
62 | int row,
|
---|
63 | int column) {
|
---|
64 | this.setText(value.toString());
|
---|
65 | return this;
|
---|
66 | } // end getTableCellRendererComponent
|
---|
67 |
|
---|
68 |
|
---|
69 | } // end BerryCellRenderer
|
---|
70 |
|
---|
71 | } // end BerryBasketPanel
|
---|