How to have a JComboBox display an item different from the one selected

Hello,
I have a JTable (single column). I have set this column cell editor to be a JComboBox...
JComboBox stdComboBox = new JComboBox();
TableColumn column_zero = stdTablewCombo.getColumnModel().getColumn(0);
        column_zero.setCellEditor( new DefaultCellEditor(stdComboBox) );I have added a lovString array say {"A", "B", "C") to this stdComboBox. However, when the user selects a value from this list, I need to display a value from another lovString array say {"1", "2", "3"}. So if the user selects A then 1 needs to be displayed.
I have a TableModelListener on this table that is getting me the correct selected index for any of the JComboBoxes on any of the rows. But I am little lost on how to display the value from the 2nd list.
Thanks.

Yes...but do I do that in the TableModelListener ?
This is what I've tried in the TableModelListener:
public void tableChanged(TableModelEvent e)
         System.out.println(e.getSource());
           if(e.getType() == TableModelEvent.UPDATE)
                TableModel model = stdTablewCombo.getModel();
                int row = e.getFirstRow();
                this.cellValue = ((String)model.getValueAt(row, 0));
                if (cellValue != null)
                     this.selectedIndex = this.stdComboBox.getSelectedIndex();
                      System.out.println("Selected Index:" + this.selectedIndex);
                      if (this.selectedIndex >= 0)
                         String valueToSet = this.lovStringB[this.selectedIndex];
                         model.setValueAt(valueToSet, row, 0);
                      else
                           System.out.println("Value in cell is not from List");
                      }It returns the selectedIndex value allright.
It sets the value of valueToSet string allright.
it also does the model.setValueAt allright....but this triggers a tableChanged event and it goes back up - this is also fine. However, when it now comes back to the this.selectedIndex = , this again returns the index of the original selection and not a -1 (for values not in the ComboBox list). This makes it go into an infinite loop and gives me a StackOverflowError.
Edited by: 799076 on Oct 10, 2010 9:41 AM
Edited by: 799076 on Oct 10, 2010 9:49 AM

Similar Messages

  • In the info bar at the bottom of the iphoto window, why is the number of items different from the total

    In the info bar at the bottom of the iphoto screen, why is the number of items different from the total?

    What version of iPhoto and system are you running? What mode are you in, i.e. Events, Photos?
    If it's the Photos mode the number at the bottom will represent the number of photos displayed in that mode or the number of photos selected in that mode. The number will match the number next to the photos mode only when there are no photos in that mode that are selected. 
    If you click on the Events icon and then back on the photos icon the numbers should match.
    OT

  • Why is the library on my phone different from the one on my computer (I have iTunes Match)

    Why is the library on my phone different from the one on my computer? (I have iTunes Match) I just want the song off my computer to be the songs I have on my phone.

    Hey there Sparkly3gs,
    It sounds like your camera is not rotating as expected in the camera app. I want to recommend starting by quitting the running apps on the phone.
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    Double-click the Home button.
    Swipe left or right until you have located the app you wish to close.
    Swipe the app up to close it.
    When you have done that restart the phone:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    If the issue persists, I would next backup your device to iTunes, and restore it:
    iOS: How to back up and restore your content
    http://support.apple.com/kb/HT1766
    I would suggest before restoring from your backup setup the device as new and make sure the camera functions as expected. Then restore from your backup and verify it still works.
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling

  • How I download a MP4 series of videolectures (that the seller has stored in Amazon S3 and has sent to my iPad email address--which is different from the one I use from the MacBookPro) from my iPad to my MacBookPro-.

    How I download a MP4 series of videolectures (that the seller has stored in Amazon S3 and has sent to my iPad email address--which is different from the one I use from the MacBookPro) from my iPad to my MacBookPro (so that I can the save them in iTunes and then synchronize some of the videolectures to the iPad?)

    To set it up as POP you need to delete the account, reboot the phone by holding the HOME and SLEEP buttons at the same time until an Apple logo appears (about 10 seconds), then add it back following these instructions: Forcing creation of a POP or IMAP email account
    I understand that you have used the same account for many years, but the technology is also changing constantly. Years ago the standard was POP (Post Office Protocol), which was designed at a time when it was inconceivable that anyone would access their email from more than one device. When people started using multiple devices, for the most part they wanted to see changes on one device mirrored on another. A new standard, IMAP (Internet Mail Access Protocol) was developed. With iMAP the master copy of all messages resides on a server, and multiple devices are kept in sync with the server. So if you delete a message from one device it is removed from the server, and then removed from all other devices when they next sync. This is the same way Microsoft Exchange works. Other benefits of IMAP include the ability to have multiple mail folders that are kept in sync across devices. In your case you could use this to create a separate folder for each family member, so they could move messages to their own folder and not clutter up the shared Inbox. Most computer mail readers can even automatically sort incoming mail into folders based on the contents of the message.
    IMAP is considered a "higher level" standard than POP. When you create a mail account iOS devices query the server and ask what it supports; if it says it supports IMAP then the account is automatically configured for IMAP. So if you really want POP you must fool it, as described in the link above. In my experience Android devices default to the highest level protocol also, and I suspect newer Blackberries do (although it has been 15 years since I used a BB).

  • When I insert a photo from iPhoto into my iMovie, the photo that appears in the movie is different from the one that I inserted - why is this and how can I make it work properly?

    When I insert a photo from iphoto into imovie, the photo that appears is different from the one that I inserted.  Why is this and how can I make it work properly?

    WHat version of iMovie, and iPhoto?
    THIs forum is for iMovie iOS (iPads, iPhones).
    Are you talking about iMovie for Mac?

  • Display only data different from the previous row

    Hello,
    I will use a simple example to explain what I would like to do with a query.
    I have a table 'test' with 4 columns (col1, col2, col3, col4).
    The table 'test' contains the following data:
    A  B  C  D
    A  E  C  D
    A  F  G  D
    K  F  G  HI would like to create a query ordered on the first column with the following result:
    A  B  C  D
       E
       F  G
    K        HOnly data that are different from the previous row have to be displayed.
    Do you have ideas on how to do this.
    Thanks for your help

    SQL> l
      1  select
      2  decode(a,lag(a) over (order by a),null,a) a,
      3  decode(b,lag(b) over (order by a),null,b) b,
      4  decode(c,lag(c) over (order by a),null,c) c,
      5  decode(d,lag(d) over (order by a),null,d) d
      6  from
      7  (
      8  select 'A' a,'B' b,'C' c , 'D' d from dual
      9  union
    10  select 'A' a,'E' b,'C' c , 'D' d from dual
    11  union
    12  select 'A' a,'F' b,'G' c , 'D' d from dual
    13  union
    14  select 'K' a,'F' b,'G' c , 'H' d from dual
    15* )
    SQL> /
    A B C D
    A B C D
      E
      F G
    K     H

  • HT5622 The apple ID on my phone is different from the one on ICloud.  How can I change my ICloud ID??  I don't remember the password and it keeps asking for it!!!!!

    The apple ID on my phone is differnt from the one on ICloud.  I have gotten married and changed my ID for Apple.  My ICloud ID is correct in my PC but my phone is incorrect.  I don't remember the password for the ID for ICloud.  How do I change the ID???

    Welcome to the Apple Community.
    Did you create a totally new ID or just change your old one.

  • How to create multiple rows in a child table from the multi select Lov

    Hi
    We have Departments and EmployDept and Persons tables and each employee can associate multiple departments and vice versa.While creating a Department page there should be a Multi Select LOV(values from Persons table) with search option for the Persons.From the search panel we can select multiple persons for that department.Suppose we have selected 5 persons and click on submit, then it should create 5 rows in the EmployDept table for 5 persons with that department id.
    Any inputs on how to implement this scenario please..

    Maybe you can get some ideas from here -
    http://adfdeveloper.blogspot.com/2011/07/simple-implementation-of-af.html

  • My spotcolors aren't displaying correctly. (Different from the swatch)

    I am having an issue that has just randomly happened where when I want to make a colour a certain spot colour from my swatch library fill a certain shape it DOESNT CHANGE the colour yet it SAYS IT IS ANOTHER COLOUR when I do a separations preview. I'll try to explain.
    The thing is is that it works to be changed to any other colour in my swatch library than the one I want it to be changed to. And this issue is only happening to ONE swatch in particular that I have not made any alterations to, and that has always worked perfectly. If I create a new document it will display correctly, but when I paste the shape into another document that has the same exact settings and spot colours it pasts as a different colour. (like the same as Top Black 2)
    I AM HAVING DIFFICULTY WITH TOP BLACK 1 (these spot colours have not changed and I've always used them.)
    My shapes are wayyyyy too much to remake in the new document- so I have to copy and paste many layers.
    I'm sorry if this seems confusing I made up some pictures.  I am just using circles to show you my problem.
    Below is when I have made a new document from the same template I use and have always used. The spot colours from my library are seen here in their proper colours. (by the way I am not working in greyscale I still use actual colours. My document is CMYK)
    SO this happens vice versa if I paste  shape TOP BLACK 1 from an old document into a new or from a new document to an older one.
    Below You now see what I have copied from my brand new document (above) and have pasted it into my previous document and as you can see, my TOP BLACK 1 has now darkened now displaying as my Top Black 2.(or at least close to it) I CAN change the TOP BLACK 1 shape into any other colour, for example my working pink colour. But when I click it to be Top Black 1 it still stays the way it is shown here. I think you can notice that what TOP BLACK 1 is now is way darker than the Grey it's supposed to be in my library on the right. Circle 3 and 4 have correctly copied and pasted in the correct colour.
    Heres the other strange thing too. If I click and hold my TOP BLACK 1 swatch in my library (as seen above) and drag it to my main illustrator swatch library, it displays darker. The pink arrow shows the swatch that it has turned into. I am so confused of what it is doing.
    When I turn on my separations preview and turn off top black 1 all that i have that is TOP BLACK 1 disappears... so it is SEPARATING correctly its just not displaying on my screen as the correct colour.
    Let me know if there is anything else to explain. I have restarted my computer, reset launch settings etc. I only found one forum where a person has the same problem and it had a few suggestions of the appearance panel settings but none of that has worked. I have the most updated Illustrator CC
    Thankyou.

    1 appears to be the one that is off the most.
    2 is slightly off
    You may have an extra fill assigned at the group level that is overiding the fill at the Path level. Doubleclick on the word Contents in your appearance palette to get to the path level. To fix you can delete the fill at the group level, or simply ungroup  to break that attribute.
    As Larry mentioned, posting the file is the best way to get an answer to this one.
    If you cannot post the file, we will need to know what color document color mode, and the color type and values.
    You can also check this setting.

  • Balance of line item different from the figure of open item

    Hi
    User has posted the document by  USD currency(f-02). The balance of line item display in FBL3n it is showing 1985202 while the figure in open item(f-06) it is showing 1990323.60.
    What will be cause of error?
    Regards

    Please check whether the exchange rates are different for the clearing date and the invoice posting date.
    Regards,
    Naveen

  • FAQ: How is Photoshop Express iOS version 3.0 different from the previous one?

    In our latest 3.0 version, we revamped the rendering engine in order to deliver great new effects, improved editing controls and a streamlined user experience. That means some things you were familiar with may not be available in this version.  If you go to the settings (gear icon), you can select 'restore purchases' to restore your previous in-app purchases. Some of the effects and borders in the previous versions have changed in 3.0.
    Restoring in-app purchases:
    If you've previously purchased either of the packs above, they are still available to you by restoring your purchase, which is accessed in Settings. You do not need to repurchase them.
    In-app purchases have been renamed.
    -The “Effects Pack” that you previously purchased has been renamed "Premium Looks Pack". You still have access to this Pack.
    -The “Camera Pack”, which provided Noise Reduction, is now called "Noise" and can be found in the Corrections slider menu. (if you purchased the camer pack previously and you restore your purchases in 3.0, this will be inclulded free of charge.)
    Other changes
    Previous Effects and Borders have been replaced with Looks, Premium Looks, and Borders. Some of the new looks replicate many of the most popular effects. We will be adding new borders, looks and sharpen controls in future releases.
    The icons across the bottom of the screen are:
    Cverlapping circles icon- Looks/Premium looks
    Crop icon-  Crop (also straighten, rotate, flip)
    Correction Sliders icon-  Contrast, noise, clarity, exposure, highlights, shadows, temperature, tint, vibrance
    Eye icon-  Red eye Fix
    Border icon-  Borders
    Image Corrections:
    Instead of selecting the sun icon as you did before for exposure, brightness, contrast, hue/saturation, and tint/temperature, you can now use the corrections sliders for contrast, noise, clarity, exposure, highlights, shadows, temperature, tint, and vibrance. The corrections sliders are the third icon on the bottom. You can also get photos from and save photos to Adobe Revel, our sharing and storage service.
    Here is an explanation as to how most of the previous adjustment options can be accomplished with options in version 3.0:
    White balance can be accomplished by a combination of tint and temperature changes.
    Brightness, is accomplished using contrast, exposure, shadows and highlights.
    Noise reduction is now in the corrections slider area
    Contrast is a choice in the corrections slider area.
    Hue can be modified by changing tint and temperature, choices in the corrections slider area.
    Saturation -similar results can be accomplished by vibrance, except vibrance will preserve the skin tones and saturated colors.
    Sharpen- Sharpen is not currently available in  version 3.0. You can try clarity for now, which is somewhat similar.

    Yes...but do I do that in the TableModelListener ?
    This is what I've tried in the TableModelListener:
    public void tableChanged(TableModelEvent e)
             System.out.println(e.getSource());
               if(e.getType() == TableModelEvent.UPDATE)
                    TableModel model = stdTablewCombo.getModel();
                    int row = e.getFirstRow();
                    this.cellValue = ((String)model.getValueAt(row, 0));
                    if (cellValue != null)
                         this.selectedIndex = this.stdComboBox.getSelectedIndex();
                          System.out.println("Selected Index:" + this.selectedIndex);
                          if (this.selectedIndex >= 0)
                             String valueToSet = this.lovStringB[this.selectedIndex];
                             model.setValueAt(valueToSet, row, 0);
                          else
                               System.out.println("Value in cell is not from List");
                          }It returns the selectedIndex value allright.
    It sets the value of valueToSet string allright.
    it also does the model.setValueAt allright....but this triggers a tableChanged event and it goes back up - this is also fine. However, when it now comes back to the this.selectedIndex = , this again returns the index of the original selection and not a -1 (for values not in the ComboBox list). This makes it go into an infinite loop and gives me a StackOverflowError.
    Edited by: 799076 on Oct 10, 2010 9:41 AM
    Edited by: 799076 on Oct 10, 2010 9:49 AM

  • I cant' control the font - size displayed during edition is different from the ones (1 or more - never know) sent.

    1) When I edit my e-mail, the font is always the same - arial 10 pts. But once the e-mail is sent, what I can see in my 'sent' box and what the receiver gets is all messed up, especially when I have pasted some text. There are parts with huge font and there are with such a small one that it's difficult to read it. Or the whole text is extremely large or tiny.
    I need to write in HTML for I often must highlight some parts. I searched many forums but nowhere found any answer.
    2) When i get an e-mail the problem is similar: it can be written with the letters you can distinguish from the other side of the room or on a contrary - you would use binoculars to read it comfortably. The least font is set to 10 pts.
    Thunderbird 31.3.0, Win 7 (64).

    From John Waller: “If you're using IE8, hit F12 to launch Developer Tools which give you a point and click method of locating the relevant CSS rule on screen.”
    I have Internet Explorer 8 (IE8) so tried this method.
    This sounded like another promising possibility; however, I have not been able to change the font size in my post using this method.
    I have gone to Dashboard > Posts > Edit > then moused-over my post > clicked on "edit" and then hit F12. An enormous amount (20 pages or more) of CSS appears. I tried picking out the font size that I thought pertains to the post (under Text Area), and I have changed the font size from 13px to 24px; however, I have not been able to “save” the new setting. When I go back to it, it is back to 13px.
    As a result, I have not been able to use a trial-and-error method to establish which font size I must change in order to change the font size of my post.

  • How to have both Classic Report and Interactive Report from the same page?

    Hello APEX developers,
    I want to copy a page consisting of master-detail form together with its data, as in data stored in the tables.
    I've generated a master-detail form(which by default having its detail report as a classic report). I want to copy this page and then migrate this classic report to Interactive Report. This way, I have both the classic master-detail form with report AND the master-detail Interactive Report.
    I've tried doing this but ended up getting a new master-detail Interactive Report page without its data.
    Any feedback is appreciated.
    Best regards,
    Daniel

    Hi everyone,
    Solved already. What a relief! Kindly ignore this post.
    Rgds,
    Daniel

  • While editing C4 will display a slide other than the one selected

    While using C4 4.0.1/1658 in edit mode, I select slide 3 (for example) but C4 displays 4.

    Hello again
    I'm stumped. I know you said there were no animations, but I thought that was exactly what the article I pointed you to was talking about. During the process of recording, even though you don't actually *SEE* any animation occurring, Captivate sometimes mixes two different background images on a single slide. And what you are reporting with the branching view showing these phantom extra slides seems to somewhat support that theory. At least in my mind.
    About the only thing I can suggest here is to create a blank slide, configure the slide background for what you are expecting, then delete the slide in question. Aside from that, I'm stumped and hopefully someone else can offer a better suggestion.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • HT202297 I just bought an ipad3 and I was wondering if anyone knows how to have my reminders displayed in my calendar? If it not possible on the iPad , is it possible on the iphone4s? if not, than does anyone know of any apps that make it convenient to do

    I just bought an ipad3 and I was wondering if anyone knows how to have my reminders displayed in my calendar? If it not possible on the iPad , is it possible on the iphone4s? if not, than does anyone know of any apps that make it convenient to do so?

    That's only for the iPhone 5. On the 4 and 4S, they can repair the back glass in store for $30. They will not replace the display on a 4 or 4S. They must replace the entire phone. Replacing the display on them requires disassembling the entire phone, which they will not do in store.

Maybe you are looking for

  • Unable to install breqn and cadabra on Arch Linux

    Hi, I am running Arch Linux (64-bit) on my Dell XPS 15 laptop. I use LaTeX for all my scientific typesetting. When I was running Fedora on this system earlier, I used Cadabra, an open source symbolic manipulation program suited to calculations in qua

  • Is SAP Jam free for SAP customers or are there costs associated with it?

    Hiya, We run SAP ERP EHP 6 on Netweaver 7.31. I've only just come across SAP Jam and Streamworks and they looks really neat. I like the way SAP Jam can be integrated into NWBC side panels... Something that I'd like to demo to the business. I think to

  • Thunderbolt- Changing Font Size?

    How do you change the font size for the Thunderbolt?

  • How to add css styles in html file generated from Report builder?

    Hi, I schedule report in web browser,but the generated report html file looks very simple and doesn't correspond with the other html files which have css styles.So I want to add css styles to the generated html file from *.rdf in report builder.That

  • A question with Corba

    I hava a question that I want to know. I use the JDK1.4.0beta 3 and J2ee1.2.1 to test the HelloWorld program. In my Program I use the POAHelper.narrow() to get a POA,because some ones tells me that I can't use the POA() to get the correct type.But th