Retreiving actionlistner for jcombobox

I am wanting to remove the actionlistener that is set to a jcombobox and i tried this line
cboPatients.removeActionListener(cboPatients.getActionListeners());but gives me the error
removeActionListener(java.awt.event.ActionListener) in javax.swing.JComboBox cannot be applied to (java.awt.event.ActionListener[])
here is how my jcombobox is setup
private void cboPatientsActionPerformed(java.awt.event.ActionEvent evt) {  I am needing to remove the action listener so that i can do a removeallitems() and then re-enstate the actionlistener.
let me know if more information is needed

Demo:
import java.awt.event.*;
import javax.swing.*;
public class Gui {
    private JComboBox combo = new JComboBox(new String[]{"apple","berry","cherry"});
    private ActionListener al = new ActionListener(){
        public void actionPerformed(ActionEvent evt) {
            System.out.println(combo.getSelectedItem());
    private ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent evt) {
            if (evt.getStateChange() == ItemEvent.SELECTED)
                combo.addActionListener(al);
            else
                combo.removeActionListener(al);
    public Gui() {
        JCheckBox listening = new JCheckBox("Listening");
        listening.addItemListener(il);
        JPanel contentPane = new JPanel();
        contentPane.add(combo);
        contentPane.add(listening);
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setContentPane(contentPane);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable(){
            public void run() {
                JFrame.setDefaultLookAndFeelDecorated(true);
                new Gui();
}

Similar Messages

  • Horizontal scrollbar for JComboBox - Not workable under Mac

    By referring to this thread Re: Horizontal scrollbar for JComboBox across multiple look and feel I try to provide horizontal scroll bar for JComboBox to my clients.
    private void adjustScrollBar() {
        //if (this.getItemCount() == 0) return;
        Object comp = this.getUI().getAccessibleChild(this, 0);
        if (!(comp instanceof JPopupMenu)) {
            return;
        JPopupMenu popup = (JPopupMenu) comp;
        // Works fine under Windows and Ubuntu Linux
        // However, in OSX 10.6.4
        // javax.swing.Box$Filler cannot be cast to javax.swing.JScrollPane
        JScrollPane scrollPane = (JScrollPane) popup.getComponent(0);
        scrollPane.setHorizontalScrollBar(new JScrollBar(JScrollBar.HORIZONTAL));
        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    }The above code will cause ClassException under OSX 10.6.4. (Works fine for Windows and Linux)
    Any suggestion to resolve this problem. Sorry. I do not have a Mac machine. Hence, can't experiment out much with it.
    Thanks

    The following code works quite well for me.
        private void adjustScrollBar() {
            final int max_search = 8;
            // i < max_search is just a safe guard when getAccessibleChildrenCount
            // returns an arbitary large number. 8 is magic number
            JPopupMenu popup = null;
            for (int i = 0, count = this.getUI().getAccessibleChildrenCount(this); i < count && i < max_search; i++) {
                Object o = this.getUI().getAccessibleChild(this, i);
                if (o instanceof JPopupMenu) {
                    popup = (JPopupMenu)o;
                    break;
            if (popup == null) {
                return;
            JScrollPane scrollPane = null;
            for (int i = 0, count = popup.getComponentCount(); i < count && i < max_search; i++) {
                Component c = popup.getComponent(i);
                if (c instanceof JScrollPane) {
                    scrollPane = (JScrollPane)c;
                    break;
            if (scrollPane == null) {
                return;
            scrollPane.setHorizontalScrollBar(new JScrollBar(JScrollBar.HORIZONTAL));
            scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        }

  • Horizontal scrollbar for JComboBox

    Hi,
    I want to use Horizontal scrollbar for JComboBox which i have used as an editor for table column cell and the matter in drop down list is larger but the width of column of a table is relatively small
    Any suggetions!
    Thanks and regards,
    Nilesh

    Hi,
    I want to use Horizontal scrollbar for JComboBox which i have used as an editor for table column cell and the matter in drop down list is larger but the width of column of a table is relatively small
    Any suggetions!
    Thanks and regards,
    Nilesh

  • How to make resizable false for JcomboBox

    hi ,
    I am using JCombobox , but it resizes when length of data inside it is
    increses.I am in trouble because of that.
    Would anybody how to make resizable false for Jcombobox
    --Harish                                                                                                                                                                                                                                                                                                                                                                                   

    Set a preferred size on the combo box, e.g.
    box.setPreferredSize(new Dimension(150,box.getPreferredSize().height));

  • Flickr Publish Service - Inability to Stop "Retreiving Comments for Photostream" Process

    I upload a lot of stuff to Flickr and every time my selected photos complete uploading a process kicks off "Retreiving Comments for Photostream". This never seems to do anything and after a time I get this annoying popup which says:  "Can't download comments for this collection. Could not contact the Flickr web service. Please check your internet connection."  First of all, I do not want to download comments, but I have no user control over preventing it, other than standing by to cancel the process once it starts. Secondly, it appears a change at the Flickr end has broken this functionality anyway.
    How do I convey this info to the Adobe staff responsible for the code writing for Lightroom so they can sort this out? I could find no other way apart from this forum to raise this issue.

    No, you are not alone.  It has been doing that to me for a week or so.  May have been going on longer, but I had not posted in a few days.
    Annoying since canceling the task by clicking on the X to the right of the progress bar makes it 'go away' but the pop-up still appears a few seconds later.

  • Set border for JComboBox

    i'm trying to change the border for a JComboBox...actually the default border for a JComboBox is null but it is the border for the JScrollPane used by the JComboBox that i want to change....i'm lost as to how to access the JScrollPane that the JComboBox uses so i can change it's border...any ideas?...thanx in advance...

    This might help you see the component you're looking for, but at YATArchivist said, it is a look and feel not a JCombobox componentimport  javax.swing.*;
    import  java.awt.*;
    import  java.util.Random;
    import  java.awt.event.*;
    public class ComboScroll {
      static Random rnd = new Random(); 
      public static void main (String[] args) {
        try {
          if (args.length > 0) {
            UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        } catch (Exception ex) {
          ex.printStackTrace();
        final JComboBox combobox = new JComboBox(
          ("foo|bar|baz|" + UIManager.getCrossPlatformLookAndFeelClassName()).split("\\|"));
        combobox.setEditable(true);
        final JFrame frame = new JFrame("ComboScroll");
        frame.getContentPane().add(combobox);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Timer timer = new Timer(800, new ActionListener () {
          public void actionPerformed (ActionEvent e) {
            dumpTree(frame, 0);
            Window[] windows = frame.getOwnedWindows();
            for (int index = 0; index < windows.length; index++) {
              dumpTree(windows[index], 0);
            System.out.println();
        timer.setRepeats(true);
        timer.start();
      static void dumpTree (Component component, int depth) {
        String className = component.getClass().getName();
        System.out.println(indent(depth) + component.getName() + ":" + className);
        if (component instanceof Container) {
          Container container = (Container)component;
          for (int index = 0; index < container.getComponentCount(); index++) {
            dumpTree(container.getComponent(index), depth + 1);
          if (component instanceof JComponent) {
            try {
              ((JComponent)component).setBorder(
                BorderFactory.createTitledBorder(
                  BorderFactory.createMatteBorder(4, 4, 4, 4, new Color(
                    rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256))),
                  className.substring(className.lastIndexOf('.') + 1)));
            } catch (Exception ex) {
        if (depth == 0) {
          System.out.println();
      static String indent (int depth) {
        return "                                         ".substring(0, depth * 2);
    }Pete

  • Multiline tooltip for JComboBox items.

    Hi, As the title suggests I'd like to create a multiline tooltip for items in a combobox list.
    I have implemented a multiline tooltip renderer which works perfectly on any component except JComboBox items.
    I have also implemented a ListCellRenderer for a combobox that enables tooltips for the combobox items. Also works perfectly, except that they are single line tooltips.
    The tooltip text is read from an xml file, therefore I have no control on how long the line of text is. Most of the time the text also contains newlines.
    This is the method (overridden from JComponent) added to a subclass of a component so that that component uses the MultiLineToolTip:
        public JToolTip createToolTip() {
            MultiLineToolTip tip = new MultiLineToolTip(this);
            tip.setComponent(this);
            return tip;
        }And this is the ListCellRenderer used on the combobox, so that items have (single-line) tooltips enabled:
        private class ToolTipEnabledComboBoxRenderer extends JLabel implements ListCellRenderer{
             public ToolTipEnabledComboBoxRenderer(){
                  setOpaque(true);
             public Component getListCellRendererComponent(JList list,Object value,
                                                              int index,boolean isSelected,
                                                              boolean cellHasFocus) {
                  String entry = (String)value;
                  if (isSelected || cellHasFocus) {
                       this.setBackground(list.getSelectionBackground());
                       setForeground(list.getSelectionForeground());
                  } else {
                       this.setBackground(list.getBackground());
                       setForeground(list.getForeground());
                  this.setText(entry);
                  if(isSelected || cellHasFocus){
                       if(constraint!=null &&combobox!=null &&
                                   constraint.getType() == Constrained.CONTROLLED_VOCABULARY){
                            String tooltip = ((ControlledVocabulary)constraint).getEntryDescription(entry);
                            if(tooltip==null || tooltip.equals("")){
                                 tooltip="";
                            list.setToolTipText(tooltip);
                  return this;
        }It seems to me that what I have to do is subclass the list used by the combobox and override the createToolTip() method. But how can I set the list used by the combobox? As far as I know the only time I can access the list is in the getListCellRendererComponent() method of the ListCellRenderer, in which the list is a parameter.
    Any ideas?
    Don

    Hello,
    <p>Have you seen this one?</p>
    Francois

  • InputVerifier for JComboBox

    Hi,
    I'm trying to set an InputVerifier for an editable JComboBox using the setInputVerifier() method, to check the input before the JComboBox looses the focus.
    I've tried several things, as for exmaple extending the 'BasicComboBoxEditor' and set the InputVerifier using the protected 'editor' field. But this also does not work!
    Could anyone give me an advice how I could implement a InputVerifier so the content of the JComboBox is checked before it looses the focus? Maybe someone could even point me to an example?!
    Any help is greatly welcome!!
    Regards,
    Zeljko

    JTextField jtf = (JTextField)comboBox.getEditor().getEditorComponent();
    jtf.setInputVerifier(new YourInputVerifier());

  • Event to watch for JComboBox _finished_ selection?

    When my app's JComboBoxes are clicked I can capture every
    single change while the user is trying to decide with the
    up arrow and down arrow keys. This allows some really neat
    and dynamic things such as changing other components "live" or
    in real time as the user navigates up and down. I make
    extensive use of this Java event capture. The tutorial with
    a little pig is a good example of that kind of event.
    However, what I need additionally is to detect when the user has
    made up her mind and the selecting process is finished. This
    occurs for instance, when the <TAB> key is pressed and as a
    result, the focus is transfered to the next component.
    So, how can I detect not the fine grain event, up&down event,
    but the higher level selection?
    TIA,
    -Ramon F. Herrera

    I would suggest adding an action listener to the combo box and seeing if that will capture the event you are looking for.

  • Recursive background color working except for jcombobox & jbutton

    I'll start this as I usually do: I probably missing somethign obvious but...
    I am trying to setup a gui where all of a JFrames child components change background and foreground color. It seems to be working fine except for my JCombobox (the currently selected item background, not the pulldown), my button backgrounds, my checkbox boxes, and my radio button circles. (all of these are appearing as white) (code below)
    My suspicion is that I'll need to bail on this approach and look into making a custom laf. I have a strong suspicion that if at all possible, I don't want to go down that route: Is there any way I can make this approach work?
    //this is code in my custom JFrame subclass
    public void setComponentsColor ( Color foreColor, Color backColor ) {     
         setContainersComponentsBackground( this.getContentPane(), foreColor, backColor );
    protected void setContainersComponentsBackground ( Container container, Color foreColor, Color backColor  ) {
         Component [] array = container.getComponents();
         for( int i = 0; i < array.length; i++ ) {
              array.setBackground( backColor );
              array[i].setForeground( foreColor );
    //test to see if it is a container
              if( Container.class.isAssignableFrom( array[i].getClass()) ) {
                   setContainersComponentsBackground( (Container)(array[i]), foreColor, backColor );
    thanks all
    -sss

    So to be clearTo be clear you should include code the demonstates the incorrect behaviour. When I run the following code the North combobox is red and the South combobox is blue. It doesn't matter whether the dropdown is visible or not.
    import java.awt.*;
    import javax.swing.*;
    public class ComboBoxTemp extends JFrame
        public ComboBoxTemp()
            String[] items = { "a", "b", "c" };
            JComboBox comboBox1 = new JComboBox( items );
            comboBox1.setBackground( Color.red );
            comboBox1.setForeground( Color.white );
            getContentPane().add( comboBox1, BorderLayout.NORTH );
            JComboBox comboBox2 = new JComboBox( items );
            comboBox2.setEditable( true );
            comboBox2.getEditor().getEditorComponent().setBackground(Color.blue);
            comboBox2.getEditor().getEditorComponent().setForeground(Color.white);
            comboBox2.setBackground( Color.blue );
            comboBox2.setForeground( Color.white );
            getContentPane().add( comboBox2, BorderLayout.SOUTH );
        public static void main(String[] args)
            ComboBoxTemp frame = new ComboBoxTemp();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setLocationRelativeTo( null );
            frame.setVisible( true );
    }

  • A clear workaround for JComboBox bug 4199622 please.

    Hi,
    I'm writing a project management software where you assign a project leader to a project via combo box and in the same step this user must be added to the team member list. Now look what happened! When I open the combo and navigate via arrow keys all project leaders are added just because they are highlighted. This is very funny but I need only 1 project leader, that which is finally selected by the user. So I've spent several hours looking for a solution and find this amazing bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4199622. So regarding JComboBox since 1998 you dont have a way to identify a final selection, is this true (I'm using java 1.6 already)? Anyway, I applied
    projectLeadC.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    and now finally I can make a difference by receiving a new action "comboBoxEdited"
    if (event.getActionCommand().equals("comboBoxEdited") && !item.equals(oldItem)) {
    pushMember(item);
    So now keyboar navigation is ok. But now how can I identify a selection commited by mouse click????? All I get is "comboBoxChanged" but both keyboard and mouse based selections issue this command, so I never know if an item was selected by mouse. I'd need "comboBoxEdited" issued by click or even better something like "CommitedByMouseClick". So can someone help me find a solution, preferably by subclassing JComboBox and fixing the action commands (I dont want to use itemSelectionChange listeners or other listeners just because of this, I dont care which item is selected before commiting, I just care for the action)? Note also, that if my combo is in a table this issue is not that severe, because I can call stopCellEditing on the table which issues a "comboBoxEdited" command.
    Thanks for the help,
    Marton Bokor

    You could use a popup listener to identify the final selection. The popup listener will store the previous selection, and everytime the popup is made invisible you can check whether the new selection is different from the previous selection. If it is, then you notify whoever you need to notify. Example program,
    import javax.swing.*;
    import javax.swing.event.PopupMenuListener;
    import javax.swing.event.PopupMenuEvent;
    public class Tester {
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    new Tester();
        JComboBox theBox;
        public Tester() {
            JFrame frame = new JFrame();
            theBox = new JComboBox(new String[]{"One","Two","Three"});
            theBox.addPopupMenuListener(new FinalSelectionListener());
            frame.setContentPane(theBox);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        private class FinalSelectionListener implements PopupMenuListener {
            private Object oldSelectedItem;
            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
                Object newSelectedItem = theBox.getSelectedItem();
                if(newSelectedItem != oldSelectedItem) {
                    oldSelectedItem = newSelectedItem;
                    selectionChanged(newSelectedItem);
            public void popupMenuWillBecomeVisible(PopupMenuEvent e) {}
            public void popupMenuCanceled(PopupMenuEvent e) {}
        private void selectionChanged(Object changedTo) {
            System.out.println("The selection was changed to: " + changedTo);
    }This way new selections can be made only when the combo box popup is closed. Hence it will still work with the mouse, and it won't have the action event problem mentioned in the bug.

  • Retreiving values for repeated tags

    Hi,
    I am a newbie to Oracle XML Data type.
    I am currently stuck up in what i beleive should be a simiple problem.
    I have an XML stored in the Oracle DB as XML Data type. This XML contains a tag which is repeated 'n' types in the XML. I want to retreive these values as separate elements ....
    For example consider the XML
    <file-list>
    <file>FILE-1</file>
    <file>FILE-2</file>
    </file>
    I want the output of the query as two elements in my result set.
    A query like "SELECT f.ICN.extract('/file-list/file/text()').getStringVal() FROM FILE_LIST_TBL f" returns output as "FILE-1FILE-2" I want the output to be as two rows in the result FILE-1 and FILE-2.
    The reason i want to have it as two rows is because i would have to a join with another relation table.
    I am currently stuck up with this issue; Kindly guide me ....
    Thanks & Regards,
    Sriram

    Be aware that the following are examples, that I fabricated out off my head, without testing them on a database.
    So the syntax could be slightly wrong. Keep Marks advice at hart.
    So -->TABLE(XMLSequence(extract())) should be applied < 10.2 >= XMLTable, for versions equal or higher than.
    Be also aware tha XMLTABLE is much more flexible (and/or its complexity) regarding the syntax used here. See the XMLDB Developers Guides and/or the SQL Reference Guide.
    <file-list>
       <file>FILE-1</file>
       <file>FILE-2</file>
    </file-list>
    select *
    from  FILE_LIST_TBL f
    , TABLE(XMLSequence(extract(f.ICN,'/file-list/file/text()')));
    SELECT *
    FROM   FILE_LIST_TBL f
    ,      XMLTABLE('/file-list/file/text()'
                      passing f.ICN
    BTW. the given xml data isn't wellformed...
    Edited by: Marco Gralike on Feb 26, 2009 9:41 PM

  • Looking For JComboBox Help

    (Sorry about the lack of rendered tags. I don't know how to use them in this forum.)
    I have a JComboBox (a drop menu) that when opened clears all its items and then adds new items from a list. Whenever the list is augmented (and is small), the JComboBox's display size is too small, and it creates a little scrollbar to accomodate. When the popmenu is closed and reopened, the menu is normal. The problem is that when I open the menu after adding a new item to a list, I have to triple click the JComboBox to make it display correctly.
    Numbers 2 and 4 are unwanted displays.
    <img src="http://img.photobucket.com/albums/v251/Trinithis/dynamicDrive/jcombobox.jpg" />
    I could fix it by having the button itself change the contents of the JComboBox (instead of popupMenuWillBecomeVisible()), but I want to have lazy evaluation for it because in my actual program the ArrayList will have to be sorted each time and the JComboBox will have to re-add all its contents. I suppose this is always an option, but I would like to know how to do it this or some other way.
    <pre>
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    public class GUI extends JFrame implements ActionListener, PopupMenuListener {
         private JButton bAdd = new JButton("Add");
         private JComboBox jcb = new JComboBox();
         private ArrayList<String> items = new ArrayList<String>(10);
         private int addCount = 0;
         public GUI() {
              Container c = this.getContentPane();
              c.setLayout(new FlowLayout());
              bAdd.addActionListener(this);
              jcb.addPopupMenuListener(this);
              c.add(bAdd);
              c.add(jcb);
              this.setSize(200, 100);
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              this.setVisible(true);
         public void actionPerformed(ActionEvent e) {
              Object source = e.getSource();
              if(source==bAdd) items.add("Item #" + addCount++);
         public void popupMenuWillBecomeVisible(PopupMenuEvent e){
              Object source = e.getSource();
              if(source==jcb) {
                   jcb.removeAllItems();
                   for(int i=0; i<items.size(); ++i) jcb.addItem(items.get(i));
         public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
         public void popupMenuCanceled(PopupMenuEvent e) {}
         public static void main(String[] args) {
              new GUI();
    </pre>
    Edited by: Trinithis on Sep 21, 2007 11:18 AM
    Edited by: Trinithis on Sep 21, 2007 11:29 AM
    Edited by: Trinithis on Sep 21, 2007 11:33 AM
    Edited by: Trinithis on Sep 21, 2007 11:34 AM

    try it a different way (not using the popupListener)
    public GUI() {
    Container c = this.getContentPane();
    c.setLayout(new FlowLayout());
    bAdd.addActionListener(this);
    jcb.setUI(new javax.swing.plaf.metal.MetalComboBoxUI(){
      protected JButton createArrowButton(){
        JButton btn = super.createArrowButton();
        btn.addMouseListener(new MouseAdapter(){
          public void mousePressed(MouseEvent me){
            if(jcb.getModel().getSize() < items.size()){
              DefaultComboBoxModel model = new DefaultComboBoxModel();
              for(int i=0; i<items.size(); ++i){
                model.addElement(items.get(i));
              jcb.setModel(model);
        return btn;
    //jcb.addPopupMenuListener(this);the tags you're looking for are
    [code]
    paste code here
    [/code]

  • Please Edit Me for JComboBox

    Hi,
    I have a JComboBox. Now i need to alter the a selected item from the list of the JComboBox. After altering the item and when i hit the enter key it should register itself with the JComboBox.
    ok maybe an example will be better.
    Suppose i have three fruits in the JComboBox "Mango","Apple","Grapes". Now when i have given setEditable true for the JComboBox and when i select Mango i should be able to change that to "Banana" and after hitting the enter key the items in the JComboBox should be "Banana","Apple","Grapes".
    I hope i was clear enough. If not i am sorry for tht.
    Any clarification you require feel free to ask.
    Thank You.
    Ehsan

    The attached source code should do the trick...
        UpdatingComboBoxModel m = new UpdatingComboBoxModel(new String[] { "Mango", "Apple", "Grapes" });
        JComboBox cb = new JComboBox(m);
        cb.addActionListener(m);
        cb.setEditable(true);
        public class UpdatingComboBoxModel
            extends DefaultComboBoxModel
            implements ActionListener {
            private int lastIndex;
            public UpdatingComboBoxModel(Object[] items) {
                super(items);
            public void actionPerformed(ActionEvent e) {
                JComboBox cb = (JComboBox) e.getSource();
                if (cb.getModel() != this)
                    throw new Error();
                Object o = cb.getSelectedItem();
                int i = cb.getSelectedIndex();
                if (i == -1) {
                    removeElementAt(lastIndex);
                    insertElementAt(o, lastIndex);
                lastIndex = i;
        }Hope that helps,
    bye

  • ActionListener for JComboBox

    If I add an ActionListener to JComboBox or ComboBoxEditor I can get notified when user types some text into the combo-box and presses enter.
    If I need to get notifications after user types each letter. What should I do ?
    I'm stuck with this problem for a long time (I'm a beginner) - any help would be greatly appreciated. Thanks a lot,
    --Sergei 

    This would be my solution. There may be more but, this is the mest i can do;)
    So adding KeyListener.
    Let "cb" be your JComboBox object name, what you have to do is:
    cb.setEditable(true);
    ComboBoxEditor ce = cb.getEditor();
    ce.getEditorComponent().addKeyListener(this);
    here is the entire example. This progtram will count your keyevents
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Example extends Frame implements KeyListener
         private JComboBox cb = new JComboBox();
         private JLabel lab = new JLabel(" ");
         int numb = 0;
         public Example()
              cb.setEditable(true);
              ComboBoxEditor ce = cb.getEditor();
              ce.getEditorComponent().addKeyListener(this);
              setLayout(new FlowLayout());
              add(cb);
              add(lab);
              setSize(200,200);
              show();
         public static void main(String args[])
              new Example();          
         public void keyPressed(KeyEvent e)
         public void keyReleased(KeyEvent e)
                   numb ++;
                   lab.setText(Integer.toString(numb));
         public void keyTyped(KeyEvent e)

Maybe you are looking for

  • Email - To: and Cc: fields won't show business contacts

    Greetings everyone, my first post... I'm using a BlackBerry Curve 8330 on the Bell network. Email is working great and everything, but I'm sick of dealing with one small problem: Normally when you want to add a contact in the To: or Cc: fields, you j

  • HT4623 my sounds are not working

    My sounds are not working on my iphone.

  • Passing objects to a servlet - session or as byte[]

    Hi I'm creating my first servlet and I want opinions on my design. I plan to sue my servlet to generate an image. So in my jsp page I have an image tag with the following <img src="/Servlet/GenerateImage">But my servlet requires data in an ArrayList

  • Make a picture fit the full screen when published?

    I can´t seem to get my picture to fit the full screen when I publish it. There are some alternatives. To drag the picture into the canvas and enlarge it. Drag it into the Page background or drag it into the web browser background. Iv tried them all a

  • Report change

    I am needing an output for print of my users and the roles assigned to those users. I have seen the report in sqldeveloper but don't know what to do to add roles to the existing report. Any help would be appreciated. select username "Username", creat