jcombobox

Combo Box pop up and select using keyboard shortcuts

给你一囗甜甜゛ 提交于 2019-12-11 09:19:26
问题 public static void comboBoxActionPerform(JComboBox comboBox) { String ACTION_KEY = "myAction"; Action actionListener = new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { JComboBox source = (JComboBox) actionEvent.getSource(); source.showPopup(); source.setFocusable(true); } }; KeyStroke ctrlT = KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_MASK); InputMap inputMap = comboBox.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(ctrlT, ACTION

JComboBox modify index using DefaultComboBoxModel

。_饼干妹妹 提交于 2019-12-11 06:53:57
问题 I have created a JComboBox and populated its content from database using DefaultComboBoxModel . Here is the code: DefaultComboBoxModel model = new DefaultComboBoxModel(); PreparedStatement statement = con.prepareStatement("SELECT _fid, fruit_name FROM fruits;"); ResultSet result = statement.executeQuery(); while (result.next()) { model.addElement(result.getString(2)); } comboBox = new JComboBox(model); How can I also set the index of the JComboBox with the value of _fid ? I'm fairly new to

Updating a specific cell in a JTable using a ComboBox

佐手、 提交于 2019-12-11 06:09:58
问题 I am reading in data using DOM Parser to update a JTable . I have a Column (ValidValues) that may not necessarily be located in the XML. However, if this tag is located when reading in from the XML, I take the value and use this to from an SQL query to return a vector of the records available. I then wish to populate the JTable with a specific combo box of the values returned on the correct row that the tag was read. E.G I may not read a tag until the 17th row has been read in from the XML

Refresh a JComboBox

做~自己de王妃 提交于 2019-12-11 05:58:47
问题 I have a combo box as you can see in the code that takes the values from a table. So after I click ok the values of the table change. How can I see these new values to the compobox without to close and open the jframe ? I made a lot of study today about java.awt.EventQueue.invokeLater and othe staff but I can not make it work, I am new to java and to programing general. So here is the code: public class Compo extends JFrame implements ActionListener {//start of class Compo //start of

Design: 2 jcomboboxes, box 2 list depends on selection from box 1, data from XML

拟墨画扇 提交于 2019-12-11 05:56:41
问题 I'm overwhelmed with attempting to design a solution for this problem - it's a by-product of inexperience. My goal is to read an XML input file, store the information from the XML and populate two combo boxes with data from the XML. The content of the second combo box will change based on the selection in the first. Given this XML structure: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Category xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Node> <ID>Unique string</ID>

Increase performance of JCombobox with many entries

给你一囗甜甜゛ 提交于 2019-12-11 04:38:22
问题 I hope this question is SO worthy, but I'll give it a try... I have a rather complex GUI and am looking to increase the overall performance a bit. I stumbled upon some comboboxes that are populated with a lot of entries (up to 10000 lines). The creation of all swing elements is already optimized, so they are normally initialized only once. But it seems kinda memory intensive to have, let's say, 10 combobox models with 10k entries always in the background. I have implemented a search feature,

jcombobox popup menue

北城余情 提交于 2019-12-11 03:18:19
问题 What I am hoping is, when typing in editable JCombobox , the Popup Menu of the JCombobox to appear autumaticaly , i did this and it worked . But, when i changed the Icon of the Arrow Button in the JCombobox it didnt worked any more as shown in the picture before changing Arrow Button Icon After changing Arrow Button Icon (the Popup never appears, when one writes in the JCombobox ) this is what i did : JTextComponent editor; /** Creates new form combo */ public combo() { initComponents();

Java Swing dynamic JComboBox

廉价感情. 提交于 2019-12-11 02:53:00
问题 I have populated a combobox B1 from database. When itemStateChanged event raises it should populate another combobox B2 , but its not working. ArrayList1 = //call method in database connection class() for (int j = 0; j < ArrayList1.size(); j++) { if (j == 0) { combobox1.addItem("Select Any"); } combobox1.addItem(ArrayList1.get(j)); } combobox1.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent ie) { String catName = (String)combobox1.getSelectedItem(); if (

JComboBox inside JTable delay on start start cell editing

让人想犯罪 __ 提交于 2019-12-11 02:47:51
问题 I am using a JXComboBox as cell editor in a modified JXTable / RXTable with custom models. I am noticing a delay when starting to type inside the cell. Edit : also, if you type more keys faster in the box, the first one you typed will not appear first in the editor. The table: import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.table.*; import javax.swing.text.*; import org.jdesktop.swingx.JXTable; /** * This is a modified version of

How do you remove the JComboBox 'click and see dropdown' functionality?

纵饮孤独 提交于 2019-12-11 02:38:38
问题 I have a JComboBox which uses GlazedLists to add type-ahead functionality. I want the user to type in a string and see type-ahead (this is working thanks to Glazedlists). However, I don't want users to be able to click the down arrow of the combobox and inspect the dropdown list. I've made the down arrow invisible and made the combobox editable so that it resembles a JTextField. However, you are still able to hover the mouse over the area where the down arrow used to be and click it. This