KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > imr > util > ImRTableCellEditor


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1999-2004 Gerald Brose
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */

21 package org.jacorb.imr.util;
22
23 import javax.swing.*;
24 import java.awt.Component JavaDoc;
25 /**
26  * This class sets the combo box in the server table
27  * and preselects the correct host name for a server.
28  *
29  * @author Nicolas Noffke
30  *
31  * $Id: ImRTableCellEditor.java,v 1.7 2004/05/06 12:39:59 nicolas Exp $
32  */

33
34 public class ImRTableCellEditor extends DefaultCellEditor {
35     
36     public ImRTableCellEditor(JComboBox box){
37     super(box);
38     }
39
40     /**
41      * Return HostSelector JComboBox.
42      */

43     public Component JavaDoc getTableCellEditorComponent(JTable table,
44                          Object JavaDoc value,
45                          boolean isSelected,
46                          int row,
47                          int column){
48
49     super.getTableCellEditorComponent(table, value, isSelected, row, column);
50     
51     JComboBox _box = (JComboBox) editorComponent;
52     
53     // preselect host name for server
54
for(int _i = 0; _i < _box.getItemCount(); _i++){
55         if(((String JavaDoc) value).equals((String JavaDoc) _box.getItemAt(_i))){
56         _box.setSelectedIndex(_i);
57         break;
58         }
59     }
60
61     return _box;
62     }
63     
64 } // ImRTableCellEditor
65

66
67
68
69
70
71
72
73
74
75
76
77
78
79
Popular Tags