| 1 26 27 package org.objectweb.openccm.explorer.CosTrading.gui; 28 29 30 import javax.swing.JComboBox ; 31 import javax.swing.JLabel ; 32 import javax.swing.Box ; 33 import javax.swing.BoxLayout ; 34 import javax.swing.SwingConstants ; 35 36 import java.awt.Component ; 37 import java.awt.Dimension ; 38 39 47 public class AvailableServiceTypesBox extends Box { 48 49 55 56 protected JComboBox types_; 57 58 64 70 public AvailableServiceTypesBox(String label, String [] available_types) { 71 super(BoxLayout.X_AXIS); 72 add(Box.createHorizontalGlue()); 73 JLabel fieldLabel = new JLabel (label, SwingConstants.RIGHT); 74 fieldLabel.setAlignmentX(Component.RIGHT_ALIGNMENT); 75 fieldLabel.setAlignmentY(Component.CENTER_ALIGNMENT); 76 add(fieldLabel); 77 add(Box.createHorizontalStrut(5)); 78 types_ = new JComboBox (available_types); 79 types_.setPreferredSize(new Dimension (225, 20)); 80 types_.setMaximumSize(new Dimension (225, 20)); 81 add(types_); 82 } 83 84 90 96 101 public String getTypeName() { 102 return (String )types_.getSelectedItem(); 103 } 104 105 110 public void addItemListener(java.awt.event.ItemListener listener) { 111 types_.addItemListener(listener); 112 } 113 } 114 | Popular Tags |