Jtable sorting question - string works, but numbers don't

Hi,
I have a Jtable which is populated from an Object two-dimensional array (myData). The object itself already containes string types and int types as appropriate (after a cumbersome type conversion).
I can sort by the string column, but the number column does not get sorted correctly..i.e it shows 1, 11, 2, 3, 33, 50..etc..
below is the code I am using:
JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
JTable jTable1 = new JTable(myData,columNames);
jTable1.setAutoCreateRowSorter(true);
add(new JScrollPane(jTable1));
jScrollPane1.setViewportView(jTable1);
Can anyone help?
thanks

so, could you show me how to do what he suggests, override the getColumnClass thingy
I can't figure it out.
package tableclass;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class EditorTest extends JFrame
    JTable table = new JTable(10, 5);
    public EditorTest()
        table.setPreferredScrollableViewportSize(table.getPreferredSize());
        JScrollPane scrollPane = new JScrollPane( table );
        getContentPane().add( scrollPane, BorderLayout.SOUTH);
    @Override;
    public class getColumnClass(int columnIndex){
        //idk wtf i'm doing.
    public static void main(String[] args)
        EditorTest frame = new EditorTest();
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.pack();
        frame.setLocationRelativeTo( null );
        frame.setVisible(true);
}

Similar Messages

  • I want to save passwords in firefox (that's ok, I know how it works), BUT i don't want to fill automaticly when I type my username on a site.

    I want to save passwords in firefox (that's ok, I know how it works), BUT i don't want to fill automaticly when I type my username on a site.

    Dear Icom
    plese try to update your Firefox Client the latest version.

  • Ipod works but buttons don't :(

    Hello.
    Last night I was listening to a long audio book and fell a sleep. The ipod kept playing the book the whole night and was still ongoing when I woke up.
    The sound and everything was going fine but they buttons don't work! The hold button works fine and the ipod turns the backlight on each time I switch it on and off and I can see the little lock icon in the corner, so I can safely say that the ipod works fine except the buttons don't respond to anything.
    I've tried the 5 steps, tried plugging it to my computer or just electricity, but nothing works and I can't let it run out of juice since it just automatically switches off because of no activity. And obviously I can't restart it since the buttons don't work.
    Any ideas of how to fix it?

    bump

  • Wireless network connection works, but browsers don't

    Wireless connection worked before. Now it shows the wireless connection is strong, but when I open a browser (explorer or firefox) it gives me the error that server can't be located. When I do a test of an application to run on a browser (where the connection shouldn't matter) I still get error message. When running Os X, the connection/browsers are fine. Have Service pack 2.
    any ideas? thanks!

    this is the same problem i am having with my xp side i am not getting the correct ip address and looking for a way to obtain the correct ip address not the one it is creating.

  • Flash buttons with action script working but I don't understand them enough to use

    My addy is www.abdezines.com firstly otherwise i will forget.
    Can anyone explain to me how my buttons work as I have pulled
    them apart many a time and can not get my ead around them to be
    able to re create in a similar idea. Someone built them for me
    previously but will no longer help when all I want to do is
    understand them so I can do them myself. I can change the wording
    when they are in my current website, the speed it moves and the
    same with the arrows but I cant see how to start it elsewhere
    despite all my digginh around in it.
    If someone can perhaps talk me through it, I have the files
    for it if wanted.
    Many thanks

    My msn addy is [email protected] if anyone can help
    me

  • Safari works but Apps don't?

    WiFi has full connection. Safari will connect and operate correctly, but apps (facebook, pandora, netflix) will not recieve internet connection. Help?

    Hmm... Well try restarting your wireless router. Usually there will be an option in the settings (refer to the manual). If not just unplug it for a few seconds.

  • Evrything seem to be working,BUT CAN'T MAKE DEEZER WORK,

    im trying to use Deezer but does not work,everything else seem to be working,i have downloaded Opera Deezer works but i don't like opera and i would like to make it work with Firefox so it must be a question of seeting
    Thank you
    Gerard

    Expanding on what deggie said, with an iPad 1 the app you're using must support video out. Only the iPad 2 can mirror the screen. The apps included with the iPad that output to external monitors are given here:
    http://support.apple.com/kb/HT4108
    For third-party apps, consult the app's documentation or contact the developer.
    Regards.

  • I just upgraded to lion but I don't have airdrop

    I just upgraded by Macbook Pro to Lion.  I got launchpad and mission control so I know the upgrade worked, but I don't have airdrop.  Airdrop was my favorite thing about the upgrade, but i didn't get it.  Anyone else have the same problem or know what to do about it? thanks

    OS X Lion- Can I use AirDrop with my computer?

  • HT201272 I have recently picked up an Apple TV. When I go to the movies tab, there are less movies available there than there are in my i-Tunes account. I've done some looking around at questions from others, but haven't found an answer that works for me.

    I have recently picked up an Apple TV. When I go to the movies tab, there less movies available there than what is available in my i-Tunes library. I have 38 movies showing in my library but only 23 are showing in the Movies tab on the Apple TV. After researching this a little, there are only 23 movies showing under Purchased in the Quicklinks of my i-Tunes account. The majority of my collection are digital copy downloads that came from DVD purchases. Some of the missing movies were added in the past couple of months, the rest are a year-or-so old. I have done some looking around at questions from others, but I have not found an answer that will fix my situation. How do I update my library to get ALL of my movies to reflect that they were "Purchased"(as it says they were in their Properties)?

    Biggles Lamb wrote:
    Chill out guys, getting personal will never ever change another persons view, right or wrong, they are entitled to them .
    The pros and cons of to CC or not to CC have been done to death
    Its a fact the CC model will work for some, especially newbies and small businesses.
    The risks associated with the CC model have been well documented.
    For long term users of CS perpetuals its generally a large hike up in cost compared to the upgrade system.
    Then there are the....... Adobe can rot it hell...... group who will never subscribe
    To each their own, you do the math to suit your cashflow whatever that is and then make an informed decision
    To those on the CC model, I'd like to offer some practical advice.........do not allow automatic updates.........make regular backups............develop an exit strategy of alternatives for when you can no longer afford the subscription costs............never ever assume that the Adobe update is bug free
    Enjoy your cloud
    Col
    Thank you for that post, and the advice. I just happen to be one of those who it does work for. I've been around long enough to know that CC isn't going to work for everyone(the large publishing/radio/web company I work for isn't upgrading to CC because of the costs involved). But it does for me as I potentially venture out into the full-time freelancing world and away from the more structured big office environment. I can't make decisions based on what is best for anyone else, or what will hurt or help Adobe. Just what affects me, and that's all.
    Brent

  • I upgraded for Firefox 4 and now my simplePass identity protection (biometric scanner) on my laptop will not work. WHY? It still works with IE but I don't use IE.

    I upgraded for Firefox 4 and now my HP SimplePass Identity Protection (biometric scanner) on my laptop will not work. WHY? It still works with IE but I don't use IE. It worked with the previous Firefox version but now when I use the internet, it doesn't even acknowledge I have the scanner. When I run my finger over it, it opens the settings panel but does not allow use of the already saved information or allow new information to be entered. I need this corrected. Any suggestions?

    I asked this same question, and just received a response:
    "Thank you for contacting DigitalPersona. There will be no update releases
    for DigitalPersona Personal in the future. There will be no updates for
    Firefox 4 nor Internet Explorer 9. IF they work they work, if they do
    not work with DPPersonal, then you will have to decide to either keep
    DPPersonal and forgo Firefox 4 or IE 9, or vice versa. DigitalPersona
    is leaving the consumer market and is focusing on business applications.
    In fact, DigitalPersona Personal will not longer be supported after
    Mid-April of this year.
    We apologize for any inconvenience this might cause. Sincerely, Tech Team "
    In other words, there will be NO update.

  • Speakerphone problem - lost voice from speakerphone while playing music or gaming youtube, while call or voice recording playing - all works fine, so speakerphone is working but not on all apps. hard reset done - no changes

    or gaming youtube, while call or voice recording playing - all works fine, so speakerphone is working but not on all apps. hard reset done - no changes.
    iphone 4
    SOLVED plugin to charger solved it - so problem was with contacts -- no idea why - phone is new - no water - no havy dust - usual using  
    hope will never return. Thanks

    We checked it with an iPhone 5 in house multiple times and could not reproduce this Problem. Must be something specific to your device. Maybe your speakerphone volume is turned down completely?
    Follow the latest Skype Community News
    ↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓

  • My external Apple USB Keyboard letters doesn't work, but the numbers do. Why and how can I fix this issue?

    My external Apple USB Keyboard letters doesn't work, but the numbers do. Why and how can I fix this issue? Also, When I open the Keyboard Viewer, the letters will highlight only if I hold the modifier key(s) "Control" or "Control and Option". I really need help with this. I don't have any other computer to try it on, so I will have to test it on a friends computer sometime. But perhaps solutions that I can try right now? Thanks.

    Hello there, IDuncan23.
    The following Knowledge Base article has some great troubleshooting steps you can follow to work on resolving your keyboard issue:
    One or more keys on the keyboard do not respond
    http://support.apple.com/kb/ts1381
    Thanks for reaching Apple Support Communities.
    Cheers,
    Pedro D.

  • I have a smart cover for my iPad which works brilliantly, but I don't know how to clean it ?

    I have a smart cover for my iPad which works brilliantly, but I don't know how to clean it ? I was very naive in choosing the "cream" colored one and now it doesn't look so neat ... Any ideas ?

    Please disregard my question - just found the answer elsewhere on this page :-)

  • Hay. i change the screen LCD in IPAD 2 3G but i don't know what happen. She was working and every thing it's ok. One time i turn off the ipad and turn on more time, i don't see good in LCD the  brightness is to low and i can see any thing

    Hay. i change the screen LCD in IPAD 2 3G but i don't know what happen. She was working and every thing it's ok. One time i turn off the ipad and turn on more time, i don't see good in LCD the  brightness is to low and i can see any thing!! and i want to know why is happen

    Assuming you mean that you performed the repair yourself, it would seem that you either obtained a defective screen or you did some sort of damage when you replaced the screen. You can try asking for assistance on ifixit.com, a site dedicate to those attempting their own repairs, or you can take the iPad to a shop and pay them to try to correct the problem for you. Apple will no longer touch your iPad now that you've attempted your own repairs.
    Regards.

  • My Wife got an iPhone at work. IT set it up the first time on another machine, they finally install iTunes on her machine but I don't know if she can sync without loosing Photos, SMS, and other things. She had six months of stuff on that phone?

    My Wife got an iPhone at work. IT set it up the first time on another machine, they finally install iTunes on her machine but I don't know if she can sync without loosing Photos, SMS, and other things. She had six months of stuff on that phone?
    The problem is she can't update to new software until she connect to iTunes, but she don't want to loose all that info.
    My question is:
    If she register her apple ID on that new computer, and sync the phone, will she loose everything? or iTunes will back up first (because apple id match) and then sync.
    Otherwise, how can I do it? The closest apple store is 3 hours away. thanks!

    Before you connect to a new PC, make sure that autosync is disabled in Edit/Preferences/Devices, otherwise her phone will be wiped during the following sync.
    If she has data on the phone she wants to save, back up manually:
    Disable autosync in iTunes, connect your phone to her new computer and right click on it in the device list and choose backup. iTunes will backup your phone without syncing. Transfer the purchases the same way, choosing "transfer purchases" this time.
    When you connect your phone for the first time, all media content will be erased. But you can restore your settings and app data from your manual backup afterwards.
    Don't forget to set up at least one contact and event on your new computer to be able to merge calendars and contacts when you sync the phone for the first time.
    About backups and what's saved:http://support.apple.com/kb/HT1766
    How to back up and restore:http://support.apple.com/kb/HT1414
    How to download apps for free again:http://support.apple.com/kb/HT2519
    Transferring data is also covered here: http://support.apple.com/kb/HT4137

Maybe you are looking for