Select same item (AGAIN) in JComboBox

I don't know, if it's feature or bug :) But JCombobox do not "fire action" when I select same item again (value, which is already selected). But i need to call action ALWAYS when user select some item, even if he select already selected item. Anyone knows how to do it? Thanx

Bug,... well, try this...
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class jComboBoxAction extends JPanel  {
JComboBox jc;
    public  jComboBoxAction() {
      jc = new JComboBox();
      jc.addItem("France");
      jc.addItem("Germany");
      jc.addItem("Italy");
      jc.addItem("Japan");
      add(jc);
      jc.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
        System.out.println(""+jc.getSelectedItem());
  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new  jComboBoxAction());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 200);
    frame.setVisible(true);
}

Similar Messages

  • 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

  • Selecting the item when mouse wheel scrolled in JComboBox

    Hi All,
    I have 2 issues wrt JComboBox which are:
    1.Selecting the item when my mouse scroll wheel is rolled.
    2.Collapsing the expanded combobox ie. to initial state when i press ALT+Tab and revist the same window.It is like this..
    expand the combobox to with item selected and expanded.Now press alt+tab to see the same window then the combobx is still exapanded.Actulaly it is to be collapsed showing the seleted item only.
    Could any one pls help me out.
    cheers,
    sharath

    As regards problem 2 - do you want the combo to stay open, or to close when you Alt Tab, I can't quite tell from your question.
    If you want it to close, then I would say that is standard behaviour and I have never seen a Java (or any other) application that doesn't work like that, so if it doesn't work that way for you, then you must have coded it very oddly.
    Regards,
    Tim

  • Last summer I bought a music album from iTunes. I've already transferred all my orders from my units, but somehow iTunes wants me to pay for the same album again. When I try to add it to my wish list it simply tells me that I've already bought that item.

    Last summer I bought a music album from iTunes. I've already transferred all my purchases from my units, but somehow iTunes wants me to pay for the same album again. When I try to add it to my wish list it simply tells me that I've already bought that item.
    And I've already tried to search for downloadable purchases.
    So fact is established, I've purchased this album before but iTunes does not recognize it.
    What to do?

    Hey sorry for the late response but I've been out of town.  I can copy and paste the email responses if necessary or desired, and if it's fixed already this is a moot point anyway, but basically they kept asking me for the order numbers for the two songs I already bought from the specific album I was trying to complete, which I eventually gave them - along with telling them multiple times that the Complete My Album feature wasn't working for ANY album.  They gave me two free song codes to compensate me for the two songs I bought, and then told me to go and buy the album at full price, but the ENTIRE TIME they COMPLETELY ignored that I was telling them that this wasn't an issue with one album but was a larger, seemingly systematic issue that other people were experiencing.  Even after I got the song codes I emailed them back and said AGAIN that this wasn't an isolated feature, and they just sent me the link to the apple Feedback page (http://www.apple.com/feedback/itunesapp.html) and told me to submit my complaint there.  So, technically, my issue was never really "resolved," in that they never fixed the Complete My Album feature that I am aware of - or even acknowledged that anything needed fixing, but I haven't tested it since Sunday.
    If it's working for you, then hopefully they fixed it!  I've noticed they've updated to 10.4.1, but the notes don't indicate they're fixing anything about the Complete My Album feature, so I don't know.

  • Ajax Select Value + Ajax Autocomplete - using both on same item

    I am really loving this ApEx demo application as it is teaching me TONS of new things.
    It is by far the most helpful apex lesson site I have found:
    http://htmldb.oracle.com/pls/otn/f?p=31517:80
    I have a question regarding two of these lessons:
    Ajax Select Value
    Ajax Autocomplete
    I want to use these two for the same item.
    I have got both to work correctly individually.
    Here is my scenario:
    I have a <name> field that auto completes.
    It will set the <credit_limit> page item, according to what this <name> field has.
    The problem:
    Typing in the name without using the auto complete feature works as it displays the <credit_limit>.
    But, when I choose the name from the generated select list, it returns null.
    If I then remove a letter from the <name>, retype it (without selecting it from the list), tab; it will display the <credit_limit>.
    Any idea how to fix this?
    I want to be able to select the <name> from the auto complete select list and have it fill out the <credit_limit>.
    I found a post that might be related to this problem:
    Application Process is not fired when selecting from popup lov

    More information:
    P20_NAME_TX
    HTML Form Element Attributes: onKeyPress="checkEnter(event)" autocomplete="off" onChange="f_getPurchaseOrderCreditLimit()";
    I have also tried without the onKeyPress:
    autocomplete="off" onChange="f_getPurchaseOrderCreditLimit()";
    (It still functions the same without this except the enter key does not do anything; what does onKeyPress="checkEnter(event)" do?):
    HTML Header
    <script type="text/javascript" src="#WORKSPACE_IMAGES#textfield_autofilter.js"></script>
    <script language="javascript">
    NS4 = (document.layers ) ? true : false;
    function checkEnter(event)
    var code = 0;
    if (NS4)
    code = event.which;
    else
    code = event.keyCode;
    if (code==13)
    doSubmit('SEARCH');
    </script>
    <script language="JavaScript" type="text/javascript">
    function f_getPurchaseOrderCreditLimit ()
    var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getPurchaseOrderCreditLimit',0);
    get.add('P20_NAME_TX',html_GetElement('P20_NAME_TX').value)
    gReturn = get.get();
    if(gReturn)
    {  html_GetElement('P20_CREDIT_LIMIT_CY').value = gReturn  }
    else
    {  html_GetElement('P20_CREDIT_LIMIT_CY').value = 'null'  }
    get = null;
    </script>

  • JComboBox: Trapping selection of items

    I want to select items in a non-editable JComboBox by:
    a) scrolling through and selecting with the mouse;
    b) scrolling through with mouse or arrow keys and hitting [return];
    c) using a KeySelectionManager to find an item be entering search characters then hit [return] or click with the mouse.
    (a) seems to be the default behaviour, which is fine;
    (b) arrows initially caused actionEvents to be fired, until I saw the tip on this site to use putClientProperty("JComboBox.lightweightKeyboardNavigation","Lightweight") - this now seems to work OK;
    (c) is the problem.
    I get an event every time I enter a character to search on, but I only want to know when the user selects an item with [return] or mouse-click. How and where should I trap these events to make this happen?
    Sorry if this seems like a dumb question, but I'm new to Swing and I'm having trouble figuring out where and when to do all this event-handling stuff!
    Thanks,
    Chris

    check out http://www.globalleafs.com 's download section. There are many programmes out there in java.

  • Keeping cursor in same item where Select List with Submit is ued

    Hi,
    I am using Select List with Submit and when I do this and redirect to same page, cursor focus goes to first item in region or page.
    How to keep the cursor in same item?
    Pl Help as I am not very sure to it in Java Script and i am having such items more than 50 per page.

    APEXDeveloper,
    Try this:
    Suppose ur select list with submit is "P1_SELECT" and the item to set focus on is "P1_MAIN".
    In ur page HTML Footer, use something like:
    <script language="javascript">
    if($x('P1_SELECT').value!="")   ---> when a value is selected in the select list (assuming that the select list can also display a null value)
    {$x('P1_MAIN').focus();}
    </script>Hope this at least gets u started.

  • How to invoke an event when i select one of the items in my JComboBox

    Can any one help me for doing this,i have a combobox in a panel,when i select one item in the combobox some text fields below the combobox need to be disabled,that disabled components vary with the item selected,i try to do this by using event listener but some how i could not get invoke the event,pl some one help me for this,any help would be appreciated.
    Regards.

    The block:
    ivjJComboBox1.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    ivjJComboBox1_mouseClicked(e);
    usually should be included in your constructor or init method.
    The method:
    void ivjJComboBox1_mouseClicked(MouseEvent e){
    String s = (String)ivjJComboBox1.getSelectedItem();
    System.out.println(s);
    should be outside your constructor or init method.
    So it should be:
    public class yourClassName extends xxxxx implements xxxxx
    public yourClassName (...) {
    ivjJComboBox1.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    ivjJComboBox1_mouseClicked(e);
    void ivjJComboBox1_mouseClicked(MouseEvent e){
    String s = (String)ivjJComboBox1.getSelectedItem();
    System.out.println(s);

  • Under Options , Applications There are multiple entries for the same item (Acrobat Document). how can I delete the duplicates?

    Under Options, Applications there are multiple entries for the same item. (Adobe Acrobat) . Three show Adobe Acrobat Reader 9.3 and the other shows (ask) or (save file) with no ability to select Acrobat Reader . Is there a way to edit this list to remove the duplicates and
    the incorrect entry? Adobe installed a very quick update today.

    They are all different. Hover your mouse pointer over each of the "Content Type" descriptions and you should see a "tooltip" to see that each has a different description.
    You need to update your plugins. It is important to keep them updated due to continuing security fixes and improvements in those plug-ins:
    * Adobe Shockwave for Director Netscape plug-in, version 11.5 (you '''<u>may</u>''' need to update)
    * Shockwave Flash 10.1 r53
    * Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers
    #Check your plugin versions: http://www.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    #'''Update Shockwave for Director'''
    #*NOTE: this is not the same as Shockwave Flash; this installs the Shockwave Player.
    #*Use Firefox to download and SAVE the installer to your hard drive from the link in the article below (Desktop is a good place so you can find it).
    #*When the download is complete, exit Firefox (File > Exit)
    #*locate and double-click in the installer you just downloaded, let the install complete.
    #*Restart Firefox and check your plugins again.
    #*'''<u>Download link and more information</u>''': http://support.mozilla.com/en-US/kb/Using+the+Shockwave+plugin+with+Firefox
    #'''Update Shockwave Flash'''
    #*Use Firefox to Download and SAVE to your hard drive from the link in article below
    #*SAVE to your Desktop so you can find it
    #*After download completes, close Firefox
    #*Click on the file you just downloaded and install
    #**Note: Vista and Win7 users may need to right-click the installer downloaded and choose "Run as Administrator"
    #**Note: Most browsers other than IE will also get updated with this one download
    #**Note: To update IE, same procedure '''<u>but use IE</u>''' to go: http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_ax.exe
    #*After installation, restart Firefox and check your version again.
    #*'''<u>Download link and other information</u>''': https://support.mozilla.com/en-US/kb/Managing+the+Flash+plugin#Updating_Flash
    #* Also see: http://support.mozilla.com/en-US/kb/Installing+the+Flash+plugin
    #* Also see (if needed): http://kb2.adobe.com/cps/191/tn_19166.html#main_Uninstall
    #'''Update Java:'''
    #* Download and update instructions: https://support.mozilla.com/en-US/kb/Using+the+Java+plugin+with+Firefox

  • How do i select multiple items in spark list without pressing the control ?

    Hi all,
    I need to change the list behavioral to enable multiple selections with a click on each item
    In list, instead of using the control
    10x
    elazar r

    In your itemClick handler, check the selectedItems property, and add to it. You might need to maintain a separate collection object and bind the selectedItems property to it.
    The question becomes how to unselect an item. If it is already selected, clicking it again can unselect it, and clicking a submit button or comparable action could do the same.
    If this post answers your question or helps, please mark it as such. Thanks!
    http://www.stardustsystems.com
    Adobe Flex Development and Support Services

  • F-32 modify selected open items in the Process Open Items sheet

    Hi all,
    I have to design a solution in order to modify the selected open items showed in the Process Open Items sheet. I mean, I want to clear 2 concert items (I know every feature for each one) but the selection criterion match some items else, so I need to deselect the extra open items. This change is in order to create a BI to automate the clearing process.
    I know you are thinking, ok man you just need to use the Automatic Clearing transaction (F.13) but it doesnu2019t solve the prerequisites given (the same problem with the selection criterion).
    Could you help me?
    Thanks in advance.

    Hello Rob,
    In fact the transaction provide me the correct criterions, but the internal logic use them like OR's in a select but I need  AND's. Let me explain it better with an example:
    The standard program does something like this:
    Select *
    From ...
    into ...
    where criterion1 OR
                criterion2 OR
                ...             OR
                criterionN.
    But I need to modify this selection like follows:
    Select *
    From ...
    into ...
    where criterion1 AND
                criterion2 AND
                ...             AND
                criterionN.
    I don't how to attack this problem by User Exit, BADI... I have tried with every resouce i know but  nothing. The last resort is a Z program whith the propper BAPI but this option is not wellcome at the moment.
    Thanks again.

  • Problem in displaying selected page items in the title in Graph

    Hi There;
    I have a problem in displaying selected value of named page item in the graphs.
    Eg. I have in my worksheet a page item named "Location"; when I use "&WorksheetName &Location" in the title of worksheet it is displaying both the worksheet title and value of selected page item "Location" in my example.
    But when I use the same (&WorksheetName &Location) in the title of graph or Axis of the graph, it would show up only the name of the worksheet but not the value of page item "Location", instead it would print "&Location"
    Any idea why it is not able to reference the select page item in Discoverer graph? I am using Oracle BI Discoverer 10.1.2.1.
    Thanks in Advance,
    Regards,
    Nidhi Jethoo

    Hi Michael;
    Thanks a lot. It might not have been considered necessary but you do require, e.g in my case I am plotting Average value of a Parameter and it does make sense in including the name/value of Parameter(surface water temp/bottom watter temp) as an Axis instead of just a constant Parameter or say Average Parameter. So that user can plot the variation of different parameters by changing the page items and when user changes the value of parameter and export the graph he/she has the parameter name(actual value) in the graph.
    But I can include all the parameters (&Parameters) or all the page items(using &PageItems) in graph then why not individual page-item and individual parameter.
    I would log a SR and see what they say.
    Thanks again,
    Nidhi

  • Same item used in different pages & for different tables

    Hi,
    i created some items, which work like a filter for my tables. I've got a lot of tables and the items have always the same function. They filter the same column but they're used for different tables! If i want to copy 1 item to another page, it's forbidden to use the same name again and that's the reason why I've got to customize every item for every page. I can copy the items but i have to change the name and thats why i have to update the item name in my SQL Query & the Tablename. All which is marked i have to change for every page(new table)!
    where upper(TABLENAME) like '%' || upper(:P158_FILTER_TABLENAME) || '%'
    AND upper(KEYVALUE) like '%' || upper(:P158_FILTER_KEYVALUE) || '%'
    AND DATE_INSERTED_PDW >= to_date(:P158_FILTER_DATE_INSERTED_PDW,'DD.MM.YYYY')
    P158_FILTER_TABLENAME:
    select distinct TABLENAME d, TABLENAME r
    from ERR_MAPL //it's the tablename I have to update it on every new page/table
    order by 1
    By a Process I created i have the same Problem it's the same Process, it's only used in differnet tables:
    BEGIN
    FOR ii IN 1 .. WWV_Flow.g_f01.COUNT -- the row selector
    LOOP
    UPDATE ERR_MAPL SET RELOAD_FLAG = 1
    WHERE ERR_ID = WWV_Flow.g_f02(WWV_Flow.g_f01(ii));
    END LOOP;
    END;
    THX Mat
    Message was edited by:
    user552848

    Hi Carl Rutter,
    You have to creat 2 special production order for this item. when issue the component make sure you issue the stock as per the cosumption becaue one have 10mmx10mm and the another item have 50x50 in this case you issue component by square inch wise. for example 10*10 = 100 squre inch.
    50*50 = 2500 square inch so the cost will be approtionate. you can Use multiple uom method to obtain this, other wise you have covert into stock then you issue the component. If you want traxk size wise ,you can use batch option for Finishe goods.
    Regards
    Sridharan

  • Select Unused Items Selects Too Much

    I am attempting to use Select Unused Items to delete unused
    items in my library. I am using Flash Basic 8.0.
    I have objects in my library which are Exported for run time
    sharing. These objects contain textures. Despite the fact that
    these are exported when I do Select Unused Items, it selects many
    of these "Used" textures and deletes them. If I expand the related
    movie clips and then do it again, sometimes it will stop selecting
    those items.
    I have tried "Keep Use Counts Updated". I have also tried
    "Update Use Counts Now". The same results in either case. Why would
    it be unable to maintain my Use Counts accurately?

    Well, it is definitely not working. It seems to not be able
    to tell if an item that is Exported for Runtime Sharing is used or
    not. I know for sure that it is deleting things that it shouldn't
    because:
    a) The swf size changes
    b) On some files it deletes all of the textures just leaving
    behind empty movie clips. Those movie clips are all marked as
    Export for Runtime Sharing.
    c) Some of the items that it selects actually have a Use
    Count greater than zero.
    Though the size of the flash file doesn't matter, the
    complexity does. I have inherited these files and I am trying to
    clean them up so that they will be easier to work with in the long
    run. If I have to clean them up manually it is going to be a lot
    more time consuming.

  • Help with select list item and dynamics action

    G'Day Apex Gurus,
    I having problems trying to achieve to trigger the help window of a select item automatically. A help window is triggered when the select item label is clicked but my client would like to be triguered automatically as soon as the user click to see the options in the select list.
    I think that I should be able to do it with dynamic actions but I can not get it to work.
    I know when someone click on the label of the select list item trigger this JavaScript
    javascript:popupFieldHelp('277938589795252851','1545903379570909')
    So I want to trigger the javascript also when the user click of the select list item and pull down the options and for that I think that Dynamic actions is the way to go but I can't get it right.
    This is what I a doing:
    I created a Dynamic option as follow:
    Name : test
    Sequence: 30
    Even: Click
    Selection type: Item(s)
    Item(s): P1_RATING <- a selection list item
    Condtion: - No Condition -
    True Actions
    Sequence: 10
    Action : Execute JavaScript Code
    Fire when event result is :True
    Fire on page load: ticked
    Code: javascript:popupFieldHelp('277938589795252851','1545903379570909')
    I appreciate any one who can tell me what i am doing wrong here or provide a solution to my problem of achieving to trigger the help window of a select item automatically.
    Kind regards
    Carlos

    Hi Carlos,
    I set up a test case in exactly the same way and it worked fine for me. I created a page item called P1_DA_DEMO and added some static select list values then added some help text. The settings I used are below, I suggest you try again but also make sure you have no other Javascript errors on the page. Use a tool like firebug to check.
    Name : Dynamic Action Demo
    Sequence: 10
    Even: Click
    Selection type: Item(s)
    Item(s): P1_DA_DEMO <- a selection list item
    Condtion: - No Condition -
    True Actions
    Sequence: 10
    Action : Execute JavaScript Code
    Fire when event result is :True
    Fire on page load: Not Ticked
    Code: javascript:popupFieldHelp('277938589795252851','1545903379570909')
    Event Scope set a s Bind.
    Thanks
    Paul

Maybe you are looking for