Possible to get JComboBox before and after chaged value?

Hi,
I have a JComboBox... whenever the JComboBox value change is it possible to get the before and after changed value? For example:
Let says the JComboBox is showing "One" and the user change it to "Three" after the user chged... I want to System.out.println before chged value ("One") and aft chged value ("Three")
I tried:
put in some code in the itemStateChanged() method... but no success...
Can someone pls provide some pointer or sample code...
Thank you for your time...

Ok, I lost half a day on this (novice problem), but I arranjed a solution that resolve the problem totally. There is the code:
YourComboBox.addFocusListener(new java.awt.event.FocusAdapter()
        int aux_selected;
        // if YourComboBox gains Focus
       public void focusGained(java.awt.event.FocusEvent fe)
            // get index value of selected element
           aux_selected= YourComboBox.getSelectedIndex();
           // create a variable for storing de ItemListener
          ComboBListener = new java.awt.event.ItemListener() {
               public void itemStateChanged(java.awt.event.ItemEvent e)
                   if(e.getStateChange()==java.awt.event.ItemEvent.SELECTED)
                       // compares the selected value with the old one
                       if (aux_selected!=YourComboBox.getSelectedIndex())
                       System.out.println("ComboBox Changed !");
           // add the variable Listener to your Combo
           YourComboBox.addItemListener(ComboBListener);
       // if focus is lost
       public void focusLost(java.awt.event.FocusEvent fe)
          // remove the itemListener from the combobox
         YourComboBox.removeItemListener(ComboBListener);
//Put the Listener variable outside
private java.awt.event.ItemListener ComboBListener; //----------------------------------------------------------------------------------------------------
You only have to change YourComboBox by the name of the combobox.
To all people that help this forum (specially from PORTUGAL) and all java people: YOU ARE DOING A GREAT JOB

Similar Messages

  • Oracle Alert: Access before and after update values of a table column

    We have a requirement where a notification needs to be sent when 'END_DATE' attribute (column in a table X) is set, in an Oracle Applications form.
    I have defined an Event based Oracle Alert which fires 'On Update' of the table X.
    Could anyone please let me know as how to access the value of 'END_DATE' before and after update (i.e :new.END_DATE and :old.END_DATE) in the sql query of the alert.
    The need to use the before update and after update values of the attribute 'END_DATE' is that if we add the condition END_DATE is not null, the alert is sent even if any other attrbutes are updated in the Oracle form which is not the intended behavior.
    Appreciate any help.
    Thanks

    Hi
    use selectionlistener for your first table then add clientlistener and serverlistener so that you will get the rows on click in back bean.
    then get second table vo and and create and add row for that view object. add partial target to refresh your second table from back bean.
    on click of save call commit operation.

  • Elements 9 - Before and After Picture View?

    I like working on photos when I can see the original picture on the left and the picture I'm editing on the right so I can 'see where I'm going' with my changes.
    I'm currently trying out Elements 9.
    When I work with the 'Guided' or 'Quick' Editing sections (right side) I have a drop down box that gives me the following options after the word View on the left side: 'Before Only', 'After Only', 'Before and After Horizonal', and 'Before and After Vertical'.
    But when I go to the 'Full Edit' mode that drop down box disappears.
    How do I get a Before and After Photo to show on the screen when I'm in 'Full Edit Mode'?
    Thank you for your help.
    TripleB

    Simply use a duplicate layer or adjustment layer before starting your edits and then you can click the eye icon in the layers pallet.
    You can click on and off to see before and after as you do more editing.
     

  • I'm unable to update my apps or download new apps to my Iphone. When I try I get a message "An unknown error has occurred".  It was happening before and after the last OS upgrade.  I've done a hard reboot with no effect.  Any suggestions???

    I'm unable to update my apps or download new apps to my Iphone. When I try I get a message "An unknown error has occurred".  It was happening before and after the last OS upgrade.  I've done a hard reboot with no effect.  Any suggestions???

    Have either of you had any luck with this issue.  It began happening to me today when I was trying to purchase music on iTunes.  I have purchased music and games in the past and have had no problem.  Any help would be appreciated.

  • How to get the query result of improvement (Before and After ) using sql de

    how to get the query result of improvement (Before and After ) using sql developer.

    Check
    http://www.oracle.com/technetwork/articles/sql/exploring-sql-developer-1637307.html

  • Do we have a way to get the differences between xtext model before and after partial parse?

    Do we have a way to get the differences between xtext model before and after partial parse?
    As an example i have file contains 4 lines, xtext parsed this file and generated its model, then i made small modification in line number 3, so xtext partially parsed the file and generated another model.
    The question is could we get the nodes that has been deleted from the model?
    could we get the new nodes added to the model?
    could we get the differences between the two models?

    Workflow {
    bean = StandaloneSetup {
    scanClassPath = true
    platformUri = "${runtimeProject}/.."
    // The following two lines can be removed, if Xbase is not used.
    registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
    registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
    component = ParseXextModel{
    //Load the xtext model and keep the reference of the inmem model
    component = DirectoryCleaner {
    directory = "${runtimeProject}/src-gen"
    component = DirectoryCleaner {
    directory = "${runtimeProject}/model/generated"
    component = DirectoryCleaner {
    directory = "${runtimeProject}.ui/src-gen"
    component = DirectoryCleaner {
    directory = "${runtimeProject}.tests/src-gen"
    component = Generator {
    pathRtProject = runtimeProject
    pathUiProject = "${runtimeProject}.ui"
    pathTestProject = "${runtimeProject}.tests"
    projectNameRt = projectName
    projectNameUi = "${projectName}.ui"
    encoding = encoding
    language = auto-inject {
    uri = grammarURI
    // Java API to access grammar elements (required by several other fragments)
    fragment = grammarAccess.GrammarAccessFragment auto-inject {}
    // provides a compare view
    fragment = compare.CompareFragment auto-inject {}
    component = ParseXextModel{
    //Load the xtext model again and keep the reference of the inmem model
    component = CompareModel {
    //Implement this using EMF Comapre to see the differnces between 2 models
    }

  • When exporting XML files, I get forced line breaks before and after my xmltag

    hi everybody,
    as I said, i do a javascritp that exports xml files. First I clean up my text by removing every invisible characters with app.findpreferences. Nevertheless, my xml files is almost well formed beacause i got before and after each xmltag a forced line break. Somebody could explain to me why ?
    I don't use prettyIndent and prettyPrinting .
    Best regards
    Américo Pinto

    hi everybody,
    as I said, i do a javascritp that exports xml files. First I clean up my text by removing every invisible characters with app.findpreferences. Nevertheless, my xml files is almost well formed beacause i got before and after each xmltag a forced line break. Somebody could explain to me why ?
    I don't use prettyIndent and prettyPrinting .
    Best regards
    Américo Pinto

  • Can I print before and after on the same page?

    Hi everyone.
    I'm really proud of my editing on a particular image.  I want to print the before and after on the same page, just like I can see the before and after side-by-side in the Develop mode.
    Is this possible?
    Thanks for your help.

    Yes but you will need to make a virtual copy by going to the menu:
    Photo >> Create Virtual Copy
    Then open copy 2 in the Develop module and from the history panel change the setting to the time of import (usually the bottom of the list) or use the re-set button to get back to the original file from camera.
    You can then select copy 1 & 2 and go to the Print module to set up your page with both images.

  • Split view for before and after changes?

    One feature I used to use a lot on Lightroom as where it would show a split view showing the image before and after changes (adjustments). I cannot find how to do this in Aperture - is it possible, what is this feature called?
    (and before any smart person tells me to look in help, I'm tired of responses like that. I've looked and didn't find, and that's why I'm asking here. I've tried Compare, and Before and After Changes etc.)

    Unfortunately, no, there is no ability to do the split view like Lightroom has. It's a nice feature.
    The closest you can do is to flip back and forth between two versions. Because when you view the master in aperture it shows the original file without crops and straightening, I suggest that once you crop and straighten, you then create a new version and work on that (this is as close as you can get to LR's "snapshot" functionality). You can then flip back and forth between the two versions to see the changes... but you can't see them side by side with a split.

  • Bug: Before and After Margins Layout with section starting in right page

    Hi,
    I am using the Spanish version of Pages 09. I have observed that when I start a new section, I have no problems setting the layout margins (right, left, before, after) of this section.
    But if a set that the new section must start in a right page, then the "before" and "after" margins of the layout doesn't work.
    Is this the same in English versions of Pages?
    Regards,

    I see what you are saying.
    The problem is Pages seems to have a memory of how you arrived at that layout.
    When I construct the pages, it is correct.
    I am trying to find out what is interacting in your layout to cause this to happen. It is like there is a hidden inaccessible layout break on the blank inserted page.
    I have been tearing my hair out trying to work out what triggers it off. As I experimented with the combinations of settings in Facing pages, Section layouts and which page it starts on, it erratically switches back and forth.
    This is why I gave up on Pages years ago as a serious layout tool. It has too many of these raw, poorly thought out interactions. I use a lot of different applications and none of them, that I can think of, have so many of these mind twisting raw oddities. Odd for a supposed user friendly application.
    All the rest are pretty literal, you apply the settings and end up with a logical result of those settings. If the result is not what you wanted it is a matter of tracking what is interacting with what and straightening it out. Pages has the annoying "design" of inexplicably greying out functions for no stated reason, that prevents correction. Or hiding the access to the tools to those settings. You can only get to some of them if you have explicitly done something to make them possible. The rules as to what that "something" is, are not apparent nor in most cases explained in the User Guide or the User Interface.
    There may be a "reason" why the function is greyed out but it is not revealed to the user without an enormous amount of detective work and as in this case my sleuthing abilities are failing me completely. I might try it again tomorrow after a rest (it is very late here). Either way it is a huge time waster.
    This is fundamentally bad User Interface design and what I have railed against since Apple changed shifts, bringing in the OSX programmers who never really got the polished UI of the original Mac OS and have been cooking with Fanta* ever since.
    Peter
    * This is an anecdote originally told by Peter Russell-Clarke, a well known and creative Australian chef back in the 70's. He was berated in the street by a woman who told him that his recipe for +Duck à l'orange+ was "disgusting". When he cross examined her, he found she didn't eat fresh fruit so had made the orange sauce with Fanta.
    I use this to try and get the message over to clients when they insist on "substituting" material because "what's the difference". The trouble with people who can't tell the difference is that they rarely ever do, no matter how carefully it is demonstrated to them.

  • OIM11g: Notification Event, before and after data elements

    Hello
    I have several notification events currently working correctly. I would like to, however, create a new notification event that contains the before and after value of a changed attribute.
    For example: if user email address changes, notification should be similar to:
    This is a notification that your email address has been successfully updated in the system. Old value: [email protected] New value: [email protected]
    Notifications seem to only be fired as post process event handlers, process tasks, and scheduled tasks, is it possible to have both the before and after datasets available to the notification in any of these tasks?
    Thank you.

    If it's on a user object field, you can check for if the attribute you are watching is contained in the orchestration.getParameters(). If it is found, you can pull the old value out of the following:
    HashMap eventDataHashMap = orchestration.getInterEventData();
    Identity currentUserState = (Identity) eventDataHashMap.get("CURRENT_USER");
    Then you can generate the email/notification however you'd like.
    -Kevin

  • Hi, Just switched from CS6 to PS CC. I am used to using ACR in CS6 with it's preview checkbox in the upper  right-hand corner. I do not see that checkbox in PS CC. I see that they have added side-by-side, right and left and top and bottom before and after

    Hi,
    Just switched from CS6 to PS CC. I am very comfortable using ACR in previous versions. I liked to use the preview checkbox located in the upper right-hand corner to see before and afters. That checkbox is no longer in my version of PS CC. I see that they have side-by-side, top and bottom and right and left before and after options in the lower right-hand corner in this version. Is there anyway to get that legacy preview checkbox back so that I can use it?

    Hi Warunicorn,
    Thank you very much. I just could not find it on my own. I will have more questions as I get into it.
    Jim

  • How do I create a form that will give a report that summarises before and after data on the same graph?

    I have a number questions that I want to know the average of all the before and after data to compare them, how do I set this up in a form in FormsCentral?  Here is an example of what I want to do - the green bar is "before" and blue is "after"

    This isn't something that you can set up in FormsCentral. It's possible to something similar with a form you create in Acrobat and use with FormsCentral, but there is no sort of built-in graphing control. The bar graph could be implemented with some JavaScript that controls annotations or fields (buttons) and perhaps some text fields.

  • Count before and after to certain occurance.

    I am trying to count the amount of units  studied before and after a certain Course was taken.
    So ID 1 did PREP in 2013 in the first period and has and also had done a unit in 2009 so reult be before prerp count 1
    ID 2 did PREP in 2012 first period and also an OTHER course in the same period as well as a OTHER in period 2. So when a PREP course appear in the same period and year as an OTHER course I would like it to count it as AFTER Prep.(see below(so when equal count as after PREP))
    ID 3 has done one unit before before PREP which is in 2011 and 2 Units after the first PREP course.
    I attepted this with not in and in statments basic I know but to no luck.
    Any help is greatly appreciated.
    Thanks
    CREATE TABLE DAN_DIRK_2
    (ID     VARCHAR2(8),
    YEAR    VARCHAR2(8),
    PERIOD VARCHAR2(8),
    COURSE VARCHAR2(12),
    UNIT VARCHAR2(12));
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (1,'2013','SP1','PREP','PLI');
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (1,'2009','SP4','OTHER','DRI');
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (2,'2012','SP1','OTHER','FER');
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (2,'2012','SP2','OTHER','AQW');
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (2,'2012','SP1','PREP','FGV');
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (3,'2011','SP1','OTHER','GVW');
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (3,'2012','SP2','PREP','FER');
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (3,'2013','SP1','OTHER','FSW');
    INSERT INTO DAN_DIRK_2 (ID, YEAR,PERIOD,COURSE,UNIT) VALUES (3,'2013','SP1','PREP','FGH');
    GIVES:
    ID
    YEAR
    PERIOD
    COURSE
    UNIT
    1
    2013
    SP1
    PREP
    PLI
    1
    2009
    SP4
    OTHER
    DRI
    2
    2012
    SP1
    OTHER
    FER
    2
    2012
    SP2
    OTHER
    AQW
    2
    2012
    SP1
    PREP
    FGV
    3
    2011
    SP1
    OTHER
    GVW
    3
    2012
    SP2
    PREP
    FFR
    3
    2013
    SP1
    OTHER
    FSW
    3
    2013
    SP1
    PREP
    FGH
    WANT:
    ID
    BEFORE
    AFTER
    1
    1
    0
    2
    0
    2
    3
    1
    2

    Chloe_19 wrote:
    Get an Error
    ORA-32033: unsupported column aliasing
    32033. 00000 -  "unsupported column aliasing"
    *Cause:    column aliasing in WITH clause is not supported yet
    *Action:   specify aliasing in defintion subquery and retry
    Error at Line: 1 Column: 8
    Am using version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    because you use 10g, try this :
    WITH tt AS (
    select 1 ID,  2013 YR,  'SP1' PERIOD,  'PREP' COURSE,  'PLI' UNIT from dual union all
    select 1,  2009,  'SP4',  'OTHER',  'DRI' from dual union all
    select 2,  2012,  'SP1',  'OTHER',  'FER' from dual union all
    select 2,  2012,  'SP2',  'OTHER',  'AQW' from dual union all
    select 2,  2012,  'SP1',  'PREP',  'FGV' from dual union all
    select 3,  2011,  'SP1',  'OTHER',  'GVW' from dual union all
    select 3,  2012,  'SP2',  'PREP',  'FFR' from dual union all
    select 3,  2013,  'SP1',  'OTHER',  'FSW' from dual union all
    select 3,  2013,  'SP1',  'PREP',  'FGH' from dual ),
    tt2 AS (
    SELECT t.ID,
           min(t.YR) minyr, 
           min(replace(t.PERIOD,'SP','')) KEEP(DENSE_RANK FIRST ORDER BY T.YR) minpr
    FROM  tt t
    WHERE t.COURSE = 'PREP'
    GROUP BY t.ID)
        SELECT ID,
               NVL(COUNT(BEF),0) BEFORE,
               NVL(COUNT(AFT),0) AFTER
               FROM(          
                        SELECT t1.ID,
                               (CASE WHEN t1.YR = t2.minyr AND replace(t1.PERIOD,'SP','')= t2.minpr AND t1.course='PREP' THEN NULL
                                     WHEN t1.YR = t2.minyr AND replace(t1.PERIOD,'SP','')= t2.minpr AND t1.course!='PREP' THEN NULL
                                     WHEN t1.YR < t2.minyr THEN -1
                                     WHEN t1.YR = t2.minyr AND replace(t1.PERIOD,'SP','')<= t2.minpr THEN -1
                                 END) BEF,
                               (CASE WHEN t1.YR = t2.minyr AND replace(t1.PERIOD,'SP','')= t2.minpr AND t1.course='PREP' THEN NULL
                                     WHEN t1.YR = t2.minyr AND replace(t1.PERIOD,'SP','')= t2.minpr AND t1.course!='PREP' THEN 1
                                     WHEN t1.YR > t2.minyr THEN 1
                                     WHEN t1.YR = t2.minyr AND replace(t1.PERIOD,'SP','')>= t2.minpr THEN 1
                                 END) AFT        
                         FROM tt t1
                        LEFT JOIN tt2 t2
                               ON t2.id = t1.id
        GROUP BY ID
        ORDER BY 1

  • How to use Time Machine before and after installing a new hard drive

    So basically I'm buying a new hard drive for my Macbook pro and I have a lot of files on my computer that I would like to save. I have never used Time Machine before so I need help on how to set it up before AND after installing the harddrive so my files get transferred onto the new hard drive. Thanks in advance

    wjosten wrote:
    Me, I would never use Time Machine to do this. What I'd suggest you do is get an exterior enclosure for your new drive. Then use either Carbon Copy Cloner or SuperDuper to clone your existing drive to your new drive. Once done, verify your clone is bootable & all of your data present. Then swap drives & use your old drive for Time Machine backups(after erasing it). Then get another drive & exterior enclosure to regularly clone your new drive to.
    Unless he was swapping for a lower capacity HDD or to a lower capacity SSD, then the old drive would make a lousy Time Machine disk.  However, whenever I swap out a disk I do exactly what you do.  CCC to get the ol drive onto a new one.  Test by starting up to the new (but still external drive).  Then replace the internal drive.
    I usually just sell the old drive on eBay.  My Time Machine backup is always 2X the size of the internal drive, which I believe is a bit above recommendations, but works for me.  The price of large external drives is almost the same as smaller internal ones.

Maybe you are looking for

  • About sync multiple calendar to outlook

    I would like to ask the result of sync multiple calendar from iPhone IOS 6.x to outlook issue. Our users are using Outlook 2010 and had a primary mailbox for their own mailbox, and a shared mailbox for the Shared Calendar issue. The iPhone had multip

  • What are we supposed to do when the magic mouse stops working?

    Everything was fine last night, until my mouse again lost it's connection. The light was blinking fine, but no connection, I changed batteries (even tho the ones inside showed nearly a full charge), still wouldn't work. I realized, ok, now what? Shou

  • Oracle 8.1.5 and jdk 1.2.2

    We work on Unix Solaris 2.7, Oracle 8.1.5 and a JDK 1.1.8. We'd like to upgrade to JDK 1.2.2 . Is it enough to change the only drivers , using the 8.1.6.0.1 release (jdbc816jdk12-sol_01.zip+ nls_charset12_01.zip ) ?? Or should I apply other upgrades

  • How to Handle TDS deduction by Customer

    Dear Experts, Can you please help me that how should I handle the case in which customer deducts our TDS. Actually, at one of my client site they can not predict that their customer is going to deduct TDS or not. So please tell me how should I handle

  • Poor sound quality, Airport Express

    Hi, I have this 2 yrs old airport express but it has all of the sudden a really poor sound quality. When I connect it to my home stereo and play through airplay and if I connect headphones the sound is very poor and scratchy I've used 3 diffferent ca