Combo question

Hello
How can i GET the elements from a combo box, and then sorting them? i have a combobox, and when i press a button, i wanna sort the values from that combobox, and after that display the sorted values.
to sort, is not a problem,
Arrays.sort(...,Collator.getInstance())but how can i get into a string those elements?
i tried with
if(e.getActionCommand()=="menuSort"){
               try {
                    Component s3Combo[]=combo.getComponents();
                    //System.out.println(s3Combo.toString()+"\n");
                    Arrays.sort(s3Combo,Collator.getInstance());
                    combo.repaint();
               } catch (Exception ex) {
          }this isn't sorting the values. Why?
Thanks

It's too bad DefaultComboBoxModel does not implement java.util.Collection, as this would be really easy then...
Roll your own (untested code):
DefaultComboBoxModel model = createYourModel();
JComboBox combo = new JComboBox(model);
public void sortComboChoices() {
   int count = model.getSize();
   ArrayList list = new ArrayList(count);
   for (int i=0; i<count; i++) {
      list.add(model.getElementAt(i));
   Collections.sort(list);
   model.removeAllElements();
   for (int i=0; i<count; i++) {
      model.addElement(list.get(i));
}Edited by: BoBear2681 on Nov 10, 2008 8:24 PM

Similar Messages

  • DDR combo question ??

    i have a Neo2-PFS platinum edtion mobo and i want to overclock my comp. i also have 2x256 ddr500 a-data vietese and 2x256 samsun ddr400 rams..........my question is should i put all of my ram togather making it 1gb......or should i use a special combo or arrangement to my max overclock.......is it good mixing ddr500 with ddr400 ?? any ideas

    cool.....i'll try it soon...........by the way my bios in my mobo is 3.5......should i ungrade to 3.A the latest one..........i heard that the 3.A one lowers the ddr max voltage......the bios for 3.5 is able to set the max ddr volt at 3V but i heard that the 3.A has the highest volt of 2.8.......? any ideas

  • 915G Combo Question

    I recently had the 915g combo MB, as I am a newbie, I would like to find out whether it is normal that my optical mouse is still powered on after I shutdown my OS. This include the pci ethernet card which is still got the green light on.
    Is this normal? I have checked that all the fans were off.
    TIA!

    Quote from: Assaf on 02-April-05, 00:01:42
    It is.
    These are powered by the 5V stand by output of the PSU to allow devices to wake up the computer.
    Thanks for the info.

  • IWeb and GoDaddy combo question:

    I built a web site (with pictures and videos) on iWeb '09.  I'm using GoDaddy for ftp hosting.  All the Login info is correct according to GoDaddy ie; login name, password, server address, user name.  iWeb won't accept the password as valid.  I've changed it on GoDaddy a couple times to reset and try again on iWeb.  No luck.  Any answers?

    Try the following:
    1 - delete the iWeb preference file, com.apple.iWeb.plist, that resides in your
         User/Home/Library/ Preferences folder.
    2 - delete iWeb's cache file, Cache.db, that is located in your
    User/Home/Library/Caches/com.apple.iWeb folder (Snow Leopard and Earlier).
    3 - launch iWeb and try again.
    NOTE:  In Lion and Mountain Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.
    Another option is to publish your site to a folder on your hard drive and use a 3rd party FTP client like Cyberduck, Transmit or YummyLite to upload the files to the server.  You might try one of those clients to see if it will take your user name and password.  With them you'll get a Finder like window of your account folder on the server. 
    OT

  • DVD Studio Pro - Button Combo question

    For DVD Studio Pro, can someone give me a walkthrough on how to make a directional button combination unveil an Easter Egg?  I'd like to use the combination UP UP DOWN DOWN

    Make four buttons any size
    Name them so you can keep track of what is what in authoring
    Set movement options by clicking on the the button/advanced tab/navigation
    If a direction(left, right, up, down) is set to not set nothing will happen when the user pushes it.
    When the user pushes up for the first time you set the navigation to the second up button.
    When the user pushes up for the 2nd time you set the navigation to the first down button.
    This is why it is useful to have them named something besides button 1.
    Make sure you check all of the navigation for each button to ensure the user can't go somewhere you don't want them to. DSP will auto set directions when you create the buttons.
    As far as the unveiling part this depends on what it is unveiling. The second down button will go somewhere when the down arrow is pushed. Whether that is a menu, a track, or a chapter marker is up to you.
    Also be aware that you can set a button to have an auto action so that it activates immediately when it is navigated to. You may or may not want this on the 2nd down button.

  • PNGs from Premiere to PhotoShop

    First, I apologize upfront for not knowing the proper nomenclature. I'm hoping this is a basic question for those that know the answer.
    Ok, this is a combo question that involves both Premiere and PhotoShop (cs5). While in Premiere, I'll take a PNG pic of a frame so that I can then rotoscope it. When I open it in PhotoShop, the image is no longer in the 16/9. It is the same height, but the width has been compressed. When I am finished with the file and reimport it to Premiere, it has the wrong look. I can monkey with the image by  unlinking the scale (something like 94% to 140%). That tricks it to be acceptable for my uses, but it would never work for real life images.
    My question is... is there a better setting to choose when taking a frame capture to avoid this? I must be making an elementary mistake that I am unaware of.
    Thanks for your time... hope my description made sense.

    Yes, the pixels can now actually be displayed as non-square, via the advanced functions of OpenGL.  Note the specific item on this page:
    http://kb2.adobe.com/cps/405/kb405745.html
    View nonsquare pixel images. See Adjust pixel aspect ratio in Photoshop CS5 Help
    To wit, note this image, in which a perfect circle and text are rendered.  I duplicated it and set the duplicate to 1.33:1 PAR.  Note the pixel dimensions listed in the status boxes at the bottom.
    -Noel

  • How does RDBMS know who the Jdeveloper user is?

    This is a combo question between the JDEVLOPER and Ineternet Groups. In the
    portal world, we knew who was logged in portal by calling the following
    function in the pl/sql:portal30.wwctx_api.get_user(). I have a table called TEST with some columns. I
    have a database trigger which will detect all changes to any fields and insert
    a record in a log table and reports WHO touched the table. How can I do the similar thing in JDEVLOPER? How does the same database trigger
    know who has touched the table?

    This is a combo question between the JDEVLOPER and Ineternet Groups. In the
    portal world, we knew who was logged in portal by calling the following
    function in the pl/sql:portal30.wwctx_api.get_user(). I have a table called TEST with some columns. I
    have a database trigger which will detect all changes to any fields and insert
    a record in a log table and reports WHO touched the table. How can I do the similar thing in JDEVLOPER? How does the same database trigger
    know who has touched the table? It depends on who knows the login information, if the login = the database user, you can do a select user from dual; and get the name of the connected database user.
    If you are using something else for authentication, then you'll need to access that API to get the username.
    Rob

  • Urgent CFGrid-Combo-DataProvider Question

    Dear all,
    I have this code to create combos in cfgrid. My question now
    is .. how to replace the hardcoded countries with query? The code
    is saved in AS file (.as). The full codes can be found at
    http://cfpim.blogspot.com/2005_08_01_cfpim_archive.html
    See
    Grid cellRenderer in Flash forms topic.
    function createChildren(Void) : Void{
    combo = createClassObject( ComboBox, "combo", 1,
    {owner:this});
    combo.dataProvider = [{data:'SGP',label:'Singapore'},
    {data:'JPN',label:'Japan'}, {data:'USA',label:'United States of
    America'}, {data:'AUS',label:'Australia'},
    {data:'IND',label:'India'}];
    combo.addEventListener("change", this);
    Thanks in advance
    Keiko

    Dan,
    I wanted to try your method, but I got another error (if I
    take the content of .AS file and put it inside cfsavecontent).
    Below is my code ...
    Seems that I cannot place import or createChild inside
    CFSaveContent. Any help will be very much appreciated.
    Keiko
    <cfform format="Flash" skin="haloSilver">
    <cfsaveContent variable="onLoad">
    import mx.controls.ComboBox;
    class GridRenderer extends mx.core.UIComponent {
    var combo;
    var listOwner : MovieClip;
    var getCellIndex : Function;
    var getDataLabel : Function;
    function createChildren(Void) : Void{
    combo = createClassObject( ComboBox, "combo", 1,
    {owner:this});
    combo.dataProvider = [{data:'SGP',label:'Singapore'},
    {data:'JPN',label:'Japan'}, {data:'USA',label:'United States of
    America'}, {data:'AUS',label:'Australia'},
    {data:'IND',label:'India'}];
    combo.addEventListener("change", this);
    function getPreferredHeight(Void) : Number{
    return combo != undefined ? 25:0;
    function setValue(str:String, item:Object){
    var val = item.country;
    for(var i = 0; i < combo.dataProvider.length; i++){
    combo.dataProvider
    .data == val ? combo.selectedIndex = i : '';
    function change() {
    listOwner.editField(getCellIndex().itemIndex,
    getDataLabel(), combo.selectedItem.data);
    function(){
    _level0.myGrid.rowHeight=25;
    _level0.myGrid.getColumnAt(2).cellRenderer = GridRenderer;
    }.call()
    </cfsavecontent>
    <!--- grid with 3 columns name, firstName, department
    --->
    <cfgrid name="myGrid" width="400">
    <cfgridColumn name="Name">
    <cfgridColumn name="Country">
    <cfgridrow data="Name 1, SGP">
    <cfgridrow data="Name 2, USA">
    </cfgrid>
    <cfinput type="submit" name="cmdSubmit" value="Submit to
    see the form dump">
    <!--- onLoad trigger --->
    <cfinput type="text" visible="No" width="0" height="0"
    name="trigger2" bind="{1==2?'':#onLoad#}">
    </cfform>

  • Chart Formatting Question: Line Bar Combo

    Hello -
    I have a quick question regarding the order of labels displayed in the legend on a line bar combo chart. I have figured out how to rearrange the order of bars in the chart (the order is determined by the order of fields in the criteria section), however, OBIEE seems to always put the "line" field before the "bar" fields in the legend.
    I was wondering if there is a way to set the chart to display the "line" field following the "bar" fields in the legend?
    Thanks for the help!
    Jason

    Hi Jason,
    Go for Pivot Chart rather than Chart... and
    Apply Order by s as you want inside pivot....
    Previously even i got the order by problem in chart.. but trying the pivot chart, i resolved my issue...
    So give a try..
    Hope you know about pivot chart. Select Chart Only option from drop-down available for chart position
    Thanks & Regards
    Kishore Guggilla

  • 915G combo HDD CD-DVD question

    Hi I have a new 915G combo MB with latest bios etc.
    Here is the question, i have Boot Hdd on the blue IDE1 as c/s the 2 CD-DVD CD/R-RW on IDE 2 as c/s,
    in bios it reports
    Pri master       not detected
    pri secondary   not detected
    sec master      not detected
    sec secondary not detected
    thi master       detected maxtor 160gb
    thi secondary   not detected
    the 2 CD rom detected in raid.
    Ok it works but why isnt the maxtor detected as primary master as normal when in IDE1 slot?
    also why the bios does not detect the 2 CD roms.
    Also if i disable the on board raid, and use IDE bus mastering in bios the HDD light is lit all the time.
    Thanks for any help on this
    All the best Thomas

    IDE bus mastering is not for the RAID controller. Check in the Integrated Peripherals, look for the RAID controller settings, either it's disabled, RAID, or IDE. If you only seen Disabled and RAID, then you'll need to go into the RAID controller setup instead of BIOS setup to change to IDE. If still can't do this, then you have to follow my suggestion in the first place.
    I guess you've already have the perception on MSI board and I don't think anyone can convince you further. Good luck to you on whatever board you use in the future. You're welcome back here if you have any MSI related questions.

  • A simple question about combo box

    Dear All,
    Just got a simple question about combo box: I have one of these selectors with labels based on filtered rows from a table.
    Is it possible to have one more label that would select all options?
    Like:
    Product A
    Product B
    Product C
    All Product
    Many thanks for your help!
    Gilles

    Hi Gilles,
    The purpose of ComboBox itself to select single option out of many.
    For your purpose, you may have to use "List Builder" which can accomodate 1 or more  to select.
    Please revert for more clarification if you need.
    With best wishes
    BaaRaa.

  • MS-6738 (KM2M Combo-L) RAM Upgrade Question

    Hi
    I have the MS-6738 (KM2M Combo-L) Motherboard.  At the moment it is running 512mb of RAM and I would like to upgrade to 1gig.
    I do not know the make of the RAM in place at the moment because it was there when I bought the PC, but Aida tells me this:
    FSB - Real Clock 133mhz
          - Effective Clock 267mhz
    Same goes for the RAM, 133 and 267.
    I have read into the gambles involved in mixing RAM makes, etc, but I am prepared to take this gamble (first and maybe only time!) but according to http://www.crucial.com/uk/store/listparts.asp?Mfr%2BProductline=MSI+%28Micro+Star%29%2B+Motherboards&mfr=MSI+%28Micro+Star%29&cat=&model=MS-6738+%28KM2M+Combo-L%29&submit=Go the board is compatible with DDR PC2100 and DDR PC2700, yet it reccomends (actually GUARANTEES) that the Ballistix DDR PC400 will work.  Is this correct?
    What do you consider the best option to be for an upgrade.  I can either get another 512 of the same speed (DDR PC2100??), or if it will effectively run DDR PC3200/400 then I will go for 1gig of that instead (Athalon XP 2000+).  Please let me know what you think.
    Thanks in advance for any useful posts!

    Thanks for your replies so far.
    I have read that this board suffers from problems when running more than one stick of RAM, as such I am tempted to just take out the old 512 stick and replace it with a single 1gig stick.
    The bigger question I have is whether going for a higher speed of RAM (like available and guaranteed to work on Crucial), say DDR PC3200 would have any significant effect on system performance (World of Warcraft is a major RAM hog). 
    The RAM prices are as follows:
    1GB — CT12864Z335 DDR PC2700 CL=2.5 NON-ECC UNBUFFERED £117.99 ex. VAT (ea.)  £138.64 inc. VAT* (ea.)         
    1GB — CT12864Z265 DDR PC2100 NON-ECC UNBUFFERED £125.99 ex. VAT (ea.)  £148.04 inc. VAT* (ea.)         
    1GB — CT12864Z40B DDR PC3200 CL=3 NON-ECC UNBUFFERED £133.99 ex. VAT (ea.)  £157.44 inc. VAT* (ea.) 
    As you can see the PC2700 is cheapest, but the original mobo spec states DDR PC2100 as the highest (although the official site just says 184 pin no max speed was quoted).
    Therein lies my question, would there be any point in spending the extra £20 on PC3200 when the system FSB is only 133mhz?

  • Combo drive question

    Hi guys just one question again regarding getting Snow Leopard onto my iMac. My model is the early 06 one with the combo drive and it doesn't seem to read DVD-DL's. Is there anyway I can use an external HD to boot into it?
    The only reason I bought this Mac was to get the newest OS onto it and act as a backup drive. Any suggestions are greatly appreciated!

    Hello iMuffinMan
    That iMac will upgrade to Snow Leopard no problem, if you have a retail Snow Leopard upgrade disk.
    http://store.apple.com/us/product/MC573Z/A?mco=MTY3ODQ5OTY
    Dennis

  • 915P-Combo drive setup question

    Great forum – I’m glad that I found it (just wish I found it before putting my system together).  I just constructed my first pc based on a 915P-Combo motherboard and everything has gone well.  I only made one mistake – I ordered two SATA 160G drives thinking I could do a SATA RAID 0.  Oops...
    There are two reasons why I thought that I could – one is on the motherboard box it says “SATA and IDE RAID compatible”.  Ok, that can be read two ways – I know.  Well, then I actually downloaded the user manual and it describes how to set up a SATA RAID array (in Chapter 5).  So I was a little surprised that it can’t do SATA RAID.  So now I’ve got my two SATA drives set as two separate drives.  No big deal, and for the price the motherboard is a great value anyway.
    So my question is that I need to build a second machine that will basically be a clone of the first and I wanted opinions about the hard drive options.  Since I will be playing games and doing some home theatre stuff (watching and recording movies) I would like at least 300G with good read/write specs.  I also want the simplicity of a single drive so it looks like my options are:
    1)   A single large SATA drive (300G or so)
    2)   Two IDE (150G or so) drives in a RAID 0 array
    And I just wanted to know what the opinions of the forum are.  Will the performance of the IDE RAID 0 be that much better than the 150Mbps (that I understand SATA can do) to justify it?
    Also to do the IDE RAID 0 my understanding is that I would hook one drive to IDE2 and one to IDE3 (with them both set to master) – is that correct?  I would have my DVD-R/W on IDE1 as it is now.
    I appreciate any opinions you have on this.  Thanks for your help.

    I recommend 2 x 160GB IDE HDDs, RAID 0 + 1 x 250GB/300GB SATA HDD + Dual Channel 512MB DDR 533MHz RAMs + Enermax 475watts / Antec 480watts PSU + P540 - 3.4GHz CPU.
    The 150MBps on SATA is just the theory only, the actual transfer rates is still dependent on the system overall performance so don't rely on it too much as you'll never get to even hit 100MBps on any system in the real world enviroment. This applies to IDE as well.
    IDE Setup Guide

  • Combo Update Question

    I would like to update from 10.4.8 to the latest version of OS X. Is it safe to use the *10.4.10 Combo Update v 1.1* as a one shot procedure or should the update be done in increments starting with 10.4.9?
    Thanks in advance for your help.

    warren:
    It should be at least as safe as using Software Update in the Apple menu. A few precautions will be in order, though:
    1. Make sure that you install on a disk that does not have issues. Boot from your install disk and Repair Permissions.
    2. Download Mac OS X 10.4.10 Combo Update v1.1 (Intel)
    3. Repair Disk Permissions in Applications > Utilities > Disk Utility
    4. Install downloaded update.
    5. During installation, particularly optimization process, refrain from using computer, especially launching applications.
    6. Repair Disk Permissions as in 3 above.
    Please do not hesitate to post back should you have further questions.
    Good luck.
    cornelius

Maybe you are looking for

  • XML Publisher Report Issue

    HY I want Header In Only First Page Not in other pages. Its just Like Oracle Report which Header display in only first page not in other pages. Plz reply me.

  • Can any tell me how can i study all these?

    Good in Business Process/Functional Areas Requirements, GAP Analysis, Design, Configuration, Development, Testing, Deployment, Planning & Executing Data Conversion & User Training. Exposure to ASAP methodology, rollouts & upgrades. Does all these com

  • Strange error when installing iTunes 10.5, please help (need to update to iOS 5)

    I am running Windows Vista Home Basic (32-Bit) I have used iTunes for years, while owning various iPods and an iPhone 3g. Today I bought an iPhone 4 and came home looking to immediately update to iOS 5, while installing I got this error: After search

  • Keithley 2400 Real Time Resistance Values in LabView 2010

    Hi, I keep getting Error 803 and Error -230 on my Keithley 2400 SourceMeter (connected NI-GPIB-USB-HS; everything is talking correctly) when I use the attached LabView program. I'm using the most updated drivers for VISA, 488.2, and the KE24XX. I've

  • State Machine Programming books

    I just finished the LabVIEW basics I & II.Are there any third party books available that can help explain and expand on building State machines and event driven programming. Or at least cover this material in detail. Thanks in advance. SS