Action « JComboBox « Java Swing Q&A





1. JComboBox actions    stackoverflow.com

Is there a way to distinguish between a JComboBox's index being changed programatically using setSelectedBoundValue and by clicking on the JComboBox?

2. Attach action Event on JComboBox arrow JButton    stackoverflow.com

I try to attach action Events on the JCombobox arrow JButton. So I make a custom ComboBoxUI:

public class CustomBasicComboBoxUI extends BasicComboBoxUI {

    public static CustomBasicComboBoxUI createUI(JComponent c) {
  ...

3. Performing action on JComboBox - SwingUI    stackoverflow.com

I've implemented a ComboBox using NetBeans that has a list of values, I want to be able to perform an action whenever the selected index has changed. An example being when ...

4. JComboBox Action listener    stackoverflow.com

I'm having this problem. I have multiple JComboBoxes (5 total). To each comboBox I add an ActionListener, but the same ActionListener for all of them, called:

ComboBoxActionPerformed(java.awt.event.ActionEvent e)
and when that action is performed ...

5. Action Listener for Combo box    coderanch.com

6. JComboBox Action Issues.    coderanch.com

/* * Handles the action when the user uses the color bit JComboBox. */ public class colorHandler implements ActionListener { public void actionPerformed(ActionEvent event) { Gui gui = new Gui(); if (gui.colorChoice.getSelectedIndex() == 0) { theColorChoice = 16; } else if (gui.colorChoice.getSelectedIndex() == 1) { theColorChoice = 24; } else { theColorChoice = 32; } } }

7. Help with Combo box and action listener    coderanch.com

Hi, I have problem with below code, i want to populate the value of combobox into textfield, I have defined action listener- migButtonAction. seems its in the new actionlistener class-migButtonAction, the object combo1 and myField is not visible, I know it cant be as its defined in main class, Please suggest me . I tried defining those object as public but ...

8. having issues getting my action listener to listen to my combo boxes    java-forums.org

import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.JFrame; import javax.swing.JPanel; public class PongInterfaceViewer extends JFrame { /** * */ private static final long serialVersionUID = 1L; public static void main(String[]args) throws IOException { ActionListener listener = (ActionListener) new ComboListener(); PlayerCombo pong2 = new PlayerCombo(listener); SpeedCombo pong3 = new SpeedCombo(listener); JFrame frame = new JFrame(); BackGround component = new BackGround( ...

9. Help with Combo box and action listener    java-forums.org

Hi, I have problem with below code, i want to populate the value of combobox into textfield, I have defined action listener- migButtonAction. seems its in the new actionlistener class-migButtonAction, the object combo1 and myField is not visible, I know it cant be as its defined in main class, Please suggest me . I tried defining those object as public but ...





10. trying to hide frame after jcombobox action    forums.oracle.com

Your frame variable seems to be null at the time of your call. Are you sure that this variable is referencing your JFrame? You may need to show more of your code, especially how you are handling the frame variable: where it is created, are you creating two such variables with one shadowing the other...?

11. JComboBox Disable key action    forums.oracle.com

I am using a combo box to let clients to choose two options. I got some other jTextFields in front of or follow it. I am told to use up and down arrow key to travel through these fields (including combo box). For example, after clients finished input some data in the first field, they can press down arrow key to ...

12. Problem with Action Listeners on JComboBox    forums.oracle.com

I have a JComboBox with an ActionListener on it. The action listener is an instance of my class that is added in the same class's main method. I populate the JCB with a File array. When user select the File in the JCB, it reads the contents and displays them. But I want to be able to sort these same items ...

13. action on item selection JComboBox    forums.oracle.com

if there are only languages like in this case, I think no. now I have a problem again, but this is a bug! the JComboBox overwrites ComboPopup and ComboBoxEditor and JButton in a MyUI class that is extended by BasicComboBoxUI also besides the ItemEvent I have some ActionEvents. the bug is now, that if I make a selection with the combobox, ...