001: /*
002: * This program is free software; you can redistribute it and/or
003: * modify it under the terms of the GNU General Public License
004: * as published by the Free Software Foundation; either version 2
005: * of the License, or (at your option) any later version.
006: *
007: * This program is distributed in the hope that it will be useful,
008: * but WITHOUT ANY WARRANTY; without even the implied warranty of
009: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
010: * GNU General Public License for more details.
011:
012: * You should have received a copy of the GNU General Public License
013: * along with this program; if not, write to the Free Software
014: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
015: */
016: package net.sf.jftp.gui.framework;
017:
018: import java.awt.*;
019:
020: import javax.swing.*;
021:
022: public class HComboBox extends JPanel //implements ActionListener
023: {
024: private JLabel label;
025: public JComboBox comboBox;
026:
027: public HComboBox(String l) {
028: setLayout(new BorderLayout(5, 5));
029:
030: label = new JLabel(l + " ");
031: add("West", label);
032:
033: //comboBox = new JComboBox(t, 12);
034: comboBox = new JComboBox();
035: add("East", comboBox);
036:
037: setVisible(true);
038: }
039:
040: public HComboBox(String l, String[] t) {
041: setLayout(new BorderLayout(5, 5));
042:
043: label = new JLabel(l + " ");
044: add("West", label);
045:
046: //comboBox = new JComboBox(t, 12);
047: comboBox = new JComboBox(t);
048: add("East", comboBox);
049:
050: setVisible(true);
051: }
052:
053: /*
054: public HComboBox(String l, String t, int size)
055: {
056: setLayout(new BorderLayout(5, 5));
057:
058: label = new JLabel(l + " ");
059: add("West", label);
060:
061: comboBox = new JComboBox(t, size);
062: add("East", comboBox);
063:
064: setVisible(true);
065: }
066: */
067: public String getLabel() {
068: return label.getText();
069: }
070:
071: public void setLabel(String l) {
072: label.setText(l + " ");
073: }
074:
075: public Object getSelectedItem() {
076: return comboBox.getSelectedItem();
077: }
078:
079: public void addItem(Object obj) {
080: comboBox.addItem(obj);
081: }
082:
083: public void addActionListener(
084: java.awt.event.ActionListener actListen) {
085: comboBox.addActionListener(actListen);
086: }
087:
088: /*
089: public String getText()
090: {
091: return comboBox.getText();
092: }
093:
094: public void setText(String t)
095: {
096: comboBox.setText(t);
097: }
098:
099: /*
100: public void requestFocus()
101: {
102: text.requestFocus();
103: }
104: */
105: public void setEditable(boolean yesno) {
106: comboBox.setEditable(yesno);
107: }
108: }
|