jcombobox

Editing how file name is displayed in JComboBox while maintaining access to file

情到浓时终转凉″ 提交于 2019-12-13 15:16:14
问题 I am very new to Java and brand new to stack overflow. I am attempting to create a simple media player coded in Java utilizing the JMF API. Thus far I have been able to set up a simple queue/playlist to hold song files using a JComboBox called playListHolder . When the user selects open from the menu bar, they select a song they want to add from a JFileChooser . The song file is then added to playListHolder using the addItem() method. When an item is selected in playListHolder and the user

Using all (jComboBox, JTextField, jFileChooser) as table editor overrides the refrences

落花浮王杯 提交于 2019-12-13 11:34:57
问题 In the code below, for various rows of same table, I am trying to set an Editable comboBox as editor for first row ( so that the user can select from the available choices or type its own), a filechooser for second row and the default textFiled for the rest of rows. The Problem: and steps to reproduce it: 1- Run the code, 2- click on second row and choose a folder (the row turns yellow) 3- now click on first row to select the type of movie (just click , no need to type anything or to choose)

add selected Item from Jcombobox to Jlist

百般思念 提交于 2019-12-13 10:53:29
问题 i have created a Jcombobox and i have populated it from data base, i have a JList and i want every item i select in the combobox to be added on the JList. i'm new to java and i tried to solve the problem with this code but it's not working : private void addelementActionPerformed(java.awt.event.ActionEvent evt) { DefaultListModel liss = new DefaultListModel(); Object s = empcombo_s.getSelectedItem().toString(); for(int i =0; i<=1;i++) { liss.add(i, s); } stagelist.setModel(liss); } 回答1: now

how to call combobox selected item from another class in java?

会有一股神秘感。 提交于 2019-12-13 09:18:11
问题 final JComboBox departure = new JComboBox(); departure.setModel(new DefaultComboBoxModel(new String[] {"city1", "city2", "city3"})); departure.setBounds(413, 11, 147, 20); int selectedIndex1=departure.getSelectedIndex(); contentPane.add(departure); I am coding a bus reservation system for my homework, I use JComboBox to choose destination and departure city. I want to call selected item from another class. In this class the user will choose his seat. How can I call selected item from another

Database locked while trying to open multiple jframes

早过忘川 提交于 2019-12-13 08:58:48
问题 My problem is , while opening a jframe which is including different informations than my main jframe , when i tried to work on this jframe, for example inserting data to SQLite manager's database . But it's giving me Database locked error.I can insert data from my main jframe which i'm opening new jframes with jcombobox. I hink i know source but i dont know how to fix this. I think i need to close my main jframe which i open other frames. So sqlite database can storage this frames datas. Here

JTable not rendering JCheckBox or JComboBox in the table in Java Applet

丶灬走出姿态 提交于 2019-12-13 08:20:43
问题 Im having trouble getting my JTable that im using to display either check boxes or combo boxes in my applet. Here is the code that is not working correctly String[] options = {"download", "ignore"}; Object[] obj = {new JComboBox(options), ((MetadataList)array.get(1)).getMetadata("Filename").getValue()}; defaultTableModel2.addRow(obj); The defaultTableModel2 is simply a DefaultTableModel defaultTabelModel2 = new DefaultTableModel() so nothing too dramatic there. The code above is using a

Jlist is not getting updated when an action performed by selecting an item in Combobox

房东的猫 提交于 2019-12-13 05:25:15
问题 I am trying to perform action by selecting a value in Combobox and after selection, based of the value selected Jlist should be updated. But list is taking value only first time but its not getting updated while changing the values. However Values are coming and action is performed as I can see values are coming in consol.My code is as follows: ArrayList< String> ModuleNames = GetModuleNames(); String[] ModuleNames1 = ModuleNames.toArray(new String[ModuleNames.size()]); comboModuleName = new

ResultSet in JCombobox

坚强是说给别人听的谎言 提交于 2019-12-13 05:10:55
问题 I want to populate a Jcombobox with sql results but why am I getting an ArrayIndexOufOfBounds here? The JCombobox is like that: countrybox = new JComboBox(countries); int x = 0; String query = "SELECT UNIQUE country FROM criminals ORDER BY country ASC"; System.out.println(query); Statement stmt = connection.createStatement(); ResultSet rset = stmt.executeQuery(query); while (rset.next()) { countries[x] = rset.getString(1); x++; } 回答1: No need for temporary storage. You can load the items

Text Field With Autosuggest

荒凉一梦 提交于 2019-12-13 04:55:29
问题 What i want is an editable jcombobox. As the user types into it, it should search the database and display the names in the database that starts with the text that was typed in by the user. eg. : If the user types in 'a' . Then jcombobox should display all the names in the database that starts with 'a' . If database contains the names aaron,aidan,kim . When user types 'a' then the combobox should suggest names aaron and aidan /* * To change this template, choose Tools | Templates * and open

Change the size of a scrollbar in JComboBox

橙三吉。 提交于 2019-12-12 21:30:37
问题 Does anybody know how to change the scrollbar size in jComboBox manually? I've tried a whole bunch of stuff and nothing works. 回答1: Ok, I figured this out. You can implement PopUpMenuListener and use this: public void popupMenuWillBecomeVisible(PopupMenuEvent e) { JComboBox comboBox = (JComboBox) e.getSource(); Object popup = comboBox.getUI().getAccessibleChild(comboBox, 0); Component c = ((Container) popup).getComponent(0); if (c instanceof JScrollPane) { JScrollPane scrollpane =