KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > core > gui > config > LocaleComboBoxRenderer


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

17 package org.columba.core.gui.config;
18
19 import java.awt.Component JavaDoc;
20 import java.util.Locale JavaDoc;
21
22 import javax.swing.DefaultListCellRenderer JavaDoc;
23 import javax.swing.JLabel JavaDoc;
24 import javax.swing.JList JavaDoc;
25
26 /**
27  * Renders locales.
28  */

29 public class LocaleComboBoxRenderer extends DefaultListCellRenderer JavaDoc {
30     public LocaleComboBoxRenderer() {}
31     
32     public Component JavaDoc getListCellRendererComponent(JList JavaDoc list,
33         Object JavaDoc value, int index, boolean isSelected,
34         boolean hasFocus) {
35         
36         JLabel JavaDoc label = (JLabel JavaDoc) super.getListCellRendererComponent(list,
37                 value, index, isSelected, hasFocus);
38         label.setText(((Locale JavaDoc) value).getDisplayName((Locale JavaDoc)value));
39         return label;
40     }
41 }
42
Popular Tags