Load items in JComboBox

Hi all,
May i know how to load the files from a folder into a JComboBox.
How can i refresh the items everytime the comboBox is clicked?

When you instanciate your combo model, create an instance of File with the path to the folder as the constructor's parameter.
With this File instance, use the method listFiles() to get the list of files contained in the folder. Populate your model with the items.
For your second question, all of the above can be put in a seperate method, then you only have to call it when the combo is clicked.
Of course, after your model has been modified, don't forget to fire an appropriate event to the combo.

Similar Messages

  • Using API  to run Catalog Bulk Load - Items & Price Lists concurrent prog

    Hi everyone. I want to be able to run the concurrent program "Catalog Bulk Load - Items & Price Lists" for iProcurement. I have been able to run concurrent programs in the past using the fnd_request.submit_request API. But I seem to be having problems with the item loading concurrent program. for one thing, the program is stuck on phase code P (pending) status.
    When I run the same concurrent program using the iProcurement Administration page it runs ok.
    Has anyone been able to run this program through the backend? If so, any help is appreciated.
    Thanks

    Hello S.P,
    Basically this is what I am trying to achieve.
    1. Create a staging table. The columns available for it are category_name, item_number, item_description, supplier, supplier_site, price, uom and currency.
    So basically the user can load item details into the database from an excel sheet.
    2. use the utl_file api, create an xml file called item_load.xml using the data in the staging table. this will create the xml file used to load items in iprocurement and save it in the database directory /var/tmp/iprocurement This part works great.
    3. use the api fnd_request.submit_request to submit the concurrent program 'Catalog Bulk Load - Items & Price Lists'. This is where I am stuck. The process simply says pending or comes up with an error saying:
    oracle.apps.fnd.cp.request.FileAccessException: File /var/tmp/iprocurement is not accessable from node/machine moon1.oando-plc.com.
    I'm wondering if anyone has used my approach to load items before and if so, have they been successful?
    Thank you

  • Error loading item GR4Broadcaster.

    Hi,
    I am getting the following error "Error loading item GR4Broadcaster." when im trying to send a BI Report to the mail.
    I am using Durairaj Athavan Raja's  Function Module to do so.
    Regards,
    Virat

    On you production BI J2EE Server Execute this below URL as J2EE_ADMIN and paste the result in reply.
    <http|https>://<j2ee_server>:<j2ee_port>/irj/servlet/prt/portal/prtroot/com.sap.ip.bi.supportdesk.default
    Thanks
    SM

  • Why should we load header data first and then we load item level data?

    Hi BW guru`s,
    I have small confusion about the data loading.
    Why should we load header data first and then we load item level data?
    Is there any particular reason?
    Scenario: 1st I have uploaded 2LIS_11_VAHDR sales document header data from R/3 to BW by using LO-Cockpit extraction. Then I loaded 2LIS_11_VAITM.This is the norma procedure which we use to follow.
    I have a question. If I load 2LIS_11_VAITM data 1st from R/3 to BW and then I will load 2LIS_11_VAHDR by using LO-Cockpit extraction. what will happen?
    Regards,
    Venkat
    Edited by: VENKAT BOORUGADDA on Aug 12, 2008 11:51 AM

    There is no difference in doing it the other way.
    The load sequence will come into play only during activation where if you map the same fields from the two datasources, you might want to have the previous value overwritten by data from the next datasource.
    That is when you should care about loading one datasource before the other.
    To your question it is not arule that header data should come first.

  • Error loading item from WAD

    Hello,
    I have problems with loading template from WAD to Browser.
    I created the template and then pushed the button Execute in the browser. I can see only message: Error Loading item*
    Can you help me pleas.
    Thanks
    Petr

    Hello,
    I created the template with one table, saved and executed in browser and I have again problem with loading item.
    My problem has longer history, because I worked on BWT system normally(I created many templates and I had no problems with loading items) a one day I started to work and I saw this error message. Now I can´t execute any templates (inclusive of all that worked correctly before)
    It´s possible that I made some change in WAD settings but I don´t know where....
    Thanks
    Petr

  • DATALOAD FILES TO LOAD ITEMS

    Hello,
    Can somebody send to me, by mail attachment, a sample file used by DATALOAD to load items into Oracle Applications 10.7 NCA?
    An Excel Macro would be good too.
    Pascal

    You can download from DATALOAD's website the latest version of the application plus the sample data.

  • Error loading item WEBITEM_1

    Hi all,
    I am getting an error in the EP which says "Error loading item WEBITEM_1."
    What exactly is this error and how do we resolve it?
    Any help would be greatly appreciated.
    Thanks,

    Hi,
          I think you'll get the name of the web template or report from the Iview properties. You'll be providing the Query string or Web Template name while creating the Iviews. I don't know where exactly is this option. Just check whether you can find the name of the web template. Then open this web template in Web application designer and execute it. See if this error occurs while executing from WAD.
    Regards
    Hari
    Message was edited by: Hari Krishnan K

  • Create a PopupMenu when right click onto an item of JComboBox

    How do I make so that, a popupmenu appear only when I right click onto a item of JComboBox. What I have right now is showing a PopupMenu whenever I right click on the frame.
    I got another question to ask if you guys dont mind. How do I set the ComboBox to scroll horizontally. Right now I set the preferredSize of the ComboBox so if the item's names are too long, it will be cut off. Can I set it so that I can scroll horizontally to see the rest of the item's name?

    My English is very poor, so it's hard to explain...
    3.
    // This is just an example code and has not been tested.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.plaf.basic.*;
    public class ComboRightClickTest{
      public JComponent makeUI(final JFrame frame) {
        frame.setGlassPane(new LockingGlassPane());
        String[] items = {"test1", "test2", "test3"};
        JComboBox combo = new JComboBox(items);
        combo.setUI(new BasicComboBoxUI() {
          protected ComboPopup createPopup() {
            return new BasicComboPopup( comboBox ) {
              protected JList createList() {
                return new JList( comboBox.getModel() ) {
                  public void processMouseEvent(MouseEvent e)  {
                    if(e.isPopupTrigger()) {
                      String s = getSelectedValue().toString();
                      frame.getGlassPane().setVisible(true);
                      final JPopupMenu m = new JPopupMenu();
                      final JMenuItem i = new JMenuItem(
                          new AbstractAction("del:"+s) {
                        public void actionPerformed(ActionEvent ae) {
                          comboBox.removeItemAt(getSelectedIndex());
                          frame.getGlassPane().setVisible(false);
                          m.setVisible(false);
                      i.addMouseListener(new MouseAdapter() {
                        public void mouseEntered(MouseEvent me) {
                          i.setBackground(getSelectionBackground());
                        public void mouseExited(MouseEvent me) {
                          i.setBackground(getBackground());
                      m.add(i);
                      Point p = e.getPoint();
                      SwingUtilities.convertPointToScreen(p, this);
                      m.show(null, p.x, p.y);
                      return;
                    super.processMouseEvent(e);
        JPanel p = new JPanel(new BorderLayout());
        p.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
        p.add(combo, BorderLayout.NORTH);
        p.setPreferredSize(new Dimension(320, 100));
        return p;
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() { createAndShowGUI(); }
      public static void createAndShowGUI() {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.getContentPane().add(new ComboRightClickTest().makeUI(f));
        f.setResizable(false); //XXX
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    class LockingGlassPane extends JComponent {
      public LockingGlassPane() {
        setOpaque(false);
      @Override public void setVisible(boolean isVisible) {
        boolean oldVisible = isVisible();
        super.setVisible(isVisible);
        JRootPane rootPane = SwingUtilities.getRootPane(this);
        if(rootPane!=null && isVisible()!=oldVisible) {
          rootPane.getLayeredPane().setVisible(!isVisible);
      @Override public void paintComponent(Graphics g) {
        JRootPane rootPane = SwingUtilities.getRootPane(this);
        if(rootPane!=null) {
          http://weblogs.java.net/blog/alexfromsun/archive/2008/01/
          rootPane.getLayeredPane().print(g);
        super.paintComponent(g);
    }

  • Loading Item Categories

    Hi,
    I'm a newbie to Oracle Inventory. Actually I want to import item categories into Oracle base tables. I want to know what are all the api shoud i use.
    It would be very useful for me if you can provide me complete steps involved in loading item categories along with sample PLSQL code for loading item categories.
    Thanks in advance.
    Edited by: user13552077 on Jun 15, 2011 3:00 PM

    Hi,
    Please find the requested information below:
    1. Identify Public APIs For Importing Items, Categories, and Catalogs [ID 295475.1]
    2. A List Of Public API's for Item Master [ID 395493.1]
    Regards,
    Yuvaraj.C
    Edited by: user12945136 on Jun 15, 2011 3:58 PM

  • Load Items when Clicking on JComboBox

    I only want to load data when the user click on the down arrow sign on the JComboBox. Which listener should I use for it?
    Thanks,

    Camickr helped me out with a solution a few years back:
    Re: JComboBox - delaying the dropdown list
    Here's a working demo:
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class DelayedComboBoxDemo implements Runnable
      private JCheckBox chkA = new JCheckBox("A");
      private JCheckBox chkB = new JCheckBox("B");
      private JCheckBox chkC = new JCheckBox("C");
      private JComboBox cboItems = new JComboBox();
      JFrame frame;
      public static void main(String[] args)
        SwingUtilities.invokeLater(new DelayedComboBoxDemo());
      public void run()
        JPanel p = new JPanel();
        p.add(chkA);
        p.add(chkB);
        p.add(chkC);
        p.add(cboItems);
        frame = new JFrame("Delayed ComboBox Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(p);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
        cboItems.addPopupMenuListener(new PopupMenuListener()
          public void popupMenuCanceled(PopupMenuEvent e) {}
          public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
          public void popupMenuWillBecomeVisible(PopupMenuEvent e)
            int items = cboItems.getItemCount();
            rebuildList();
            if (items != cboItems.getItemCount())
              cboItems.hidePopup();
              cboItems.showPopup();
      private void rebuildList()
        frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        Vector<String> items = new Vector<String>();
        if (chkA.isSelected()) { items.add("A"); }
        if (chkB.isSelected()) { items.add("B"); }
        if (chkC.isSelected()) { items.add("C"); }
        cboItems.setModel(new DefaultComboBoxModel(items));
        try
          Thread.sleep(1500); // simulate a long transaction
        catch (InterruptedException ex) {}
        frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }

  • How to select multiple items in JComboBox

    Is it possible to select multiple items in a JComboBox
    if yes, then how to do?
    If no , then is there any other way to acheieve this ?

    Hi
    ComboBoxModel extends ListModel and not ListSelectionModel, so i think JComboBox does not provide multiple selection. But u can try customizing ur combo box.. may be its possible.. not very sure
    Shailesh

  • How to detect if an item of JComboBox is highlighted?

    Good day.
    How to detect if the selected item of a JComboBox is highlighted or not?
    Thanks for your response.

    the above code can only detect a highlight if an item is selected from the combo box.
    But when the focus is transfered to other Combo box it can no longer keep track if the item was highlighted or not.
    for example:
    combo box 1 combo box 2
    item item2
    Highlight should be detected wheneverr the focus is transfered from combo box 1 to combo box 2 or vice versa.
    case:
    Combo box 1 item is highlighted before transfering the focus to combo box 2 item. by the time the focus is transfered , highlight in combox 1 item should be detected.
    The main problem here is how to detect if the previously focused item is highlighted or not.
    thank you for your time.

  • How to load item level and location level member in demantra

    This is in context where we are not using any integration of demantra with either Ebiz or E1 system.
    Data is present in flat file.
    As per i know, integration interface can only export the data for item level and location level but can not import data for these level.
    the second thing i know is that when we create data model then load_data.bat file should have been created in Demand Planner/Desktop directory. But this didn't got created. So i am not able to use load_data.bat file for uploading data.
    The third place ,i think is from worksheet thru edit method ( i am not sure about this).
    But i want to upload the data in bulk for item level and location level. Can it be done without any customization i.e without creating any sql loader file etc ??

    Hi Abhishek,
    The standard practice to load data for items/ locations and sales is through the DATA MODEL definition only. One should use LOAD_DATA.BAT file in normal scenario for loading data into Demantra staging tables from tEXT files.
    In case you are having trouble with loading data using LOAD_DATA.BAT file, then do the following:
    - modify your DM definition to Data tables instead of flat files
    - use SQL loader to upload data in correct format into Demantra's staging tables "T_SRC_XXX"
    - Run EBS Full Download workflow to download data into demantra's main tables.
    Integration interfaces should not be used to load basic sales data into Demantra.
    Hope this helps.
    Thanks
    Raj
    (http://oracledemantra.blogspot.com)

  • Eliminate Items in JComboBox???

    Hi @all,
    does anybody know how I can eliminate the items of a JComboBox?
    I am reading the items of the JComboBox out of a file and then I add them. When I am adding one item to the file and read the items again, I habe all the items two times in my JComboBox. The new one of course not.
    How can I delete them first.
    Chao
    Juergen

    Thank you.
    Juergen

  • Changing background of selected item in JComboBox when Uneditable

    I need to change the color of the items in a JComboBox list based on the values that change at runtime. I have accomplished this by creating and using a class extended from DefaultListCellRenderer.
    The combobox is enabled and uneditable. The problem is that in 1.5 the behavior changed and now the selected item gets a white background that is set by the UI or DefaultJComboBox. I can no longer set the background for the selected item.
    I have tried using the ComBox Editor. Also, the universal option of UIManager.put("ComboBox.background", Color.xxx) will not work since I have multiple boxes with different backgrounds.
    Does anyone no a work around?

    Unless I misread your problem you may find that your use of DefaultListCellRenderer is incorrect. The following snippet of code (using Java 1.5.0_07) will make the combo box red. The unselected items in the dropdown will be magenta and the selected item orange.
    combo.setBackground(Color.red);
    combo.setRenderer(new DefaultListCellRenderer()     {
         public Component getListCellRendererComponent(JList list,
                    Object value,
                    int index,
                    boolean isSelected,
                    boolean cellHasFocus)
                   Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                   if(isSelected)
                        c.setBackground(Color.ORANGE);
                   else
                        c.setBackground(Color.MAGENTA);
                   return c;
         });

Maybe you are looking for

  • Can RAM lock on a new iMac?

    Hi all Just a quickie. My mum has recently purchased a brand new iMac. Specs below: 21.5-inch: 2.7GHz 2.7GHz Quad-Core Intel Core i5 1920 x 1080 resolution 4GB (two 2GB) memory 1TB hard drive AMD Radeon HD 6770M with 512MB OS 10.7.3 My question is th

  • Function Module - Transport request

    Hi Friends, I have changed one z function module and created on transport request.In transport organizor, Under the task number, my function module is displayed. No other object is included in the task list. Should i add any other object before relea

  • DivX Web Player is no longer working.

    DivX Plus Web Player HTML 5 [video] is incompatible with Firefox 4.0b8. <=(disable reason) So i can no longer stream my fav movies. Also, when i click play, sometimes my trafic bar goes crazy like it's downloading from the source, but i have no image

  • CTI OS desktop client freezes after release of transferred call

    Using CTI OS desktop v7.5(9), UCCE 7.5(9), Endpoint is CIPC 8.6.3 on CUCM 7.1.3 ACD call received by Agent 1 on ext 1111 Agent 1 transfers to 1112 Agent 2 answers transferred call on 1112 using answer call button. Agent 2 disconnects using Release Ca

  • Is there any way to hide album cover art in ipods, ipads, iphones?

    I have downloaded a number of songs that my kids like to listen to, but the cover art for those songs is inapropriate for my kids to view.  Is there a way that they can have the music on their ipod without the cover art poping up all the time? Thanks