Please help about JTable...thanks

HI everyone!
Please tell me how to write a ACTIONLISTENER for a JTABLE?
JTABLE table;
Object[][] myArray = {  {"Mary", new Integer(5)},
{"Alison", new Integer(3)},
{"Angela", new Integer(1)}
String[] columnNames = {"First Name", "Scores"};
table = new JTable(myArray, columnNames);
how do you write a actionlistener for a JTable?
thanks

One of the things I'd recommend is reading the tutorial on "How to use Tables" at the Sun website. Unless you have a button or something like that on the container the JTable is in, I don't think you want an ActionListener. One of the things you can do is set up a ListSelectionListener. It allows you to do something when a value changes in the ListSelectionModel. When you select rows in a JTable, a ListSelectionModel is created. Retrieve the ListSelectionModel from your JTable, and add a listener to it, something like:
JTable runTable = new JTable(yourTableModel);
runTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); // set mode
//or use default
ListSelectionModel rowSM = runTable.getSelectionModel();
rowSM.addListSelectionListener(new TimeSelectionListener());
class TimeSelectionListener implements ListSelectionListener {
public void valueChanged(ListSelectionEvent e) {
//Ignore extra messages.
if (e.getValueIsAdjusting()) return;
ListSelectionModel lsm = (ListSelectionModel)e.getSource();
if (lsm.isSelectionEmpty()) {
// ...//no rows are selected
} else {
... // If some rows are selected, do something here!!!
I hope this helps.

Similar Messages

  • I had to restore my iPod because I forgot the password, like how santa forgot about me. And I didn't set up a Backup. SO I sort of lost everything. But I'm wondering if I can somehow get my pictures back from somewhere. PLEASE HELP ME. Thanks

    I had to restore my iPod because I forgot the password, like how santa forgot about me. And I didn't set up a Backup. SO I sort of lost everything. But I'm wondering if I can somehow get my pictures back from somewhere. PLEASE HELP ME. Thanks

    - If you used PhotoStream then try getting some of them from your PhotoStream. See that topic of:
    iOS: Importing personal photos and videos from iOS devices to your computer
    - Maybe from the restored iPod via
    How to perform iPad recovery for photos, videos
    Wondershare Dr.Fone for iOS: iPhone Data Recovery - Wondershare Official     
    http://www.amacsoft.com/ipod-data-recovery.html

  • Hi, All. Iam using Adobe Document Cloud. After saving a pdf document to this cloud, I am able to see my PC folders . How to disable this? Does my PC folders are also available across other PC's to access them with my Adobe ID? Please help me. Thanks

    Hi, All. Iam using Adobe Document Cloud. After saving a pdf document to this cloud, I am able to see my PC folders as well with a browsing option  . How to disable this? Does my PC folders will  also available across other PC's to access them with my Adobe ID? Please help me. Thanks in advance.

    Hi indi68632954,
    I can understand your concern & you need to worry about this, as your PC folders won't be available on other PC's as this option is just to browse through the files of the specific system on which you are working as shown in the screenshot below.
    Only the files uploaded on the Document cloud will be available over Internet using Adobe Document Cloud service upon the authentication of your Adobe ID & password.
    I hope this will answer your query.
    In case if you have any further query please let us know, we will be happy to assist you.
    Regards,
    Aadesh

  • Trying to veiw videos from a website that requires me to download firefox and silverlight.My imac osx 10.5.8 will now download firefox. firfx tells me my mac is not compatible with ffox Please help me ?  Thank you

    trying to veiw videos from a website that requires me to download firefox and silverlight.My imac osx 10.5.8 will now download firefox. firfx tells me my mac is not compatible with ffox Please help me ?  Thank you

    There is a version of Firefox 4 available for PPC Macs:
    TenFourFox 4.0.1 Firefox 4 For PowerPC Browser Released
    Version 4.0.1 of TenFour Fox, FloodGap's port of Firefox 4 for Power PC
    Macs that supports both Mac oS X 10.4 and 10.5. has been released.
    Mozilla.org dropped support for OS 10.5 after Firefox 3.6 and for Power
    PC with the fourth beta of Firefox 4.
    TenFourFox uses almost all the same code as Firefox 4 and has nearly all
    the same features, including faster JavaScript, WebM video, and HTML 5
    and CSS 3 support, as well as new and emerging Web features, but with
    the code needed to keep your Power Mac functional and fast. Out of beta
    and it's ready for action, versiob 4.0.1 is a performance, security and
    stability update incorporating Mozilla's Firefox 4.0.1 plus AltiVec acceler
    -ation for WebM and browser graphics, and G5 JavaScript acceleration.
    For more information, visit:
    http://www.floodgap.com/software/tenfourfox/
    Source: from http://www.applelinks.com - posted April 25, 2011)
    Now for the intersting bit: TenFourFox, like Firefox, does not support most plug-ins. Unless you are prone to headaches (in which case don't) you can read about that here:
    http://code.google.com/p/tenfourfox/wiki/PluginsNoLongerSupported
    But there is a workaround!
    Open TenFourFox and type in the address bar: about:config (no spaces) and click return. This gives you a warning that it might harm the application. Ignore that and click on 'I'll be careful, I promise' and you get the config file that you can edit - with great care.
    Look/search (scroll down) for: tenfourfox.plugins.enabled
    Set it to true. (Double click it to toggle it)
    Now close TenFourFox, open it again, and Flash will now work, as it now uses the plug-ins that Safari has stored.
    With SilverLight, Microsoft attempted to create their own version of what a replacement for Flash could be - but not to universal acclaim. You can read more about it here:
    http://silverlight.net/
    So, if you go to any sites that have been designed for this new Silverlight stuff, you can download the plug-in from here (but make certain that you are downloading SilverLight v.1.0 for OS X (10.4.8 upwards) if you are using a PPC Mac, but even this will not work with Safari 4. Version 2 only works with Intel Macs and does work with Safari 4/5. The solution is to download and install the latest version of Flip4Mac, which now includes a Silverlight component:
    http://dynamic.telestream.net/downloads/download-flip4macwmv.htm
    But the latest news is that Microsoft will probably abandon Silverlight in favour of HTML5:
    http://www.appleinsider.com/articles/10/10/29/apples_ios_pushes_microsoft_to_dia l_down_silverlight_for_html5.html  and
    http://www.bbc.co.uk/news/technology-11673384

  • TS3992 I got a problem in my ipad2 due to "icloud backup message". I can't open my unit and am worried that I can not use my ipad anymore. What can I do. Please help me.   Thank you & GOD BLESS!

    I got a problem in my ipad2 due to "icloud backup message". I can't open my unit and am worried that I can not use my ipad anymore. What can I do. Please help me.   Thank you & GOD BLESS!

    Try to reset it. just press hold the on/off botton (ignore the red slider) just hold it then the ipad is automatically reset. dont worry about your file, there nothing happen to it. Godbless.

  • Please help about encode password idm !!!!

    Hello All,
    I'm a newbie in IDM and in my work I have to encode password with CBC Algorithm before insert password in database (SQL server 2005).
    So I have already coding CBC Algorithm but I don't know where I put my CBC encoding Algorithm for when users change password on IDM.
    Please help me.
    Thank you for advance.
    waltt

    I'm assuming you're not talking about storing the password that way in the IDM repository but rather a separate database resource.
    I had a similar requirement with a different encryption algorithm and an Oracle database. I made my life a lot easier by having the database resource do the encryption. IDM will insert the password into the resource as plain text and, in my case, a trigger will catch it, call a stored procedure to change it from plain text to encrypted and then insert it. Since IDM never reads passwords from resources anyway the password was fully encrypted as stored in the resource and IDM never knows any better.
    Technically speaking you could have created a rule or custom form to do the password encryption before IDM sends it over the wire but if you've got an encrypted channel to the database then you might take my approach and skip having IDM do it altogether.

  • My microphone is not working on my IPAD 4... It's version is 7.0.4. Please help me coz i cant my sister in HK can't hear me on skype. It's our only way of keeping in touch. Im so helpless. Please help me. Thank u and God bless everyone.

    My microphone is not working on my IPAD 4... I can't figure out if the problem has something to do when i updated the version. It's version is 7.0.4. Please help me coz i cant my sister in HK can't hear me on skype. It's our only way of keeping in touch. Im so helpless. Please help me. Thank u and God bless everyone.

    Have you tried reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • I tried to download an app on the mac app store and it continues to  say: "There was an error in the App Store. Please try again later. (null)" Please help me. Thank you.

    I tried to download an app on the mac app store and it continues to  say: "There was an error in the App Store. Please try again later. (null)" Please help me. Thank you.

    Change your Date & Time settings to reflect automatic. It will fix the problem.

  • How can I open March 2013 in my iPad-calendar? please help me! Thanks

    How can I Open March 2013 in my iPad-calendar?
    Please help me!
    Thanks
    Susanne Schabel

    I get same Issue.
    is iCloud make this issue.
    Try Disable iCloud calender on you iPad and then go to March 2013 on you calender and then it not crash. after that go back and enable iCloud calender again.
    And then it work for me :-)
    best regards
    Lars Rasmussen

  • Hello, I have an iPad Mini WiFi Cellular white 16Gb and I puted my sim inside it but, I cant read the text message that I recieve in the Sim. What can i do? And I can't put the sim in a cellphone coz it doesn't recognize it. Please help me! Thank you.

    Hello, I have an iPad Mini WiFi Cellular white 16Gb and I puted my sim inside it but, I cant read the text message that I recieve in the Sim. What can i do? And I can't put the sim in a cellphone coz it doesn't recognize it. Please help me! Thank you.

    iPads do not do SMS.

  • The map of Republic of Armenia in iOS 6 is not good. Please help us. Thank you in advance. Maps

    The map of Republic of Armenia in iOS 6 is not good. Please help us. Thank you in advance. Maps

    Hi Naren,
    When I double-click on this data type from the ABAP editor, it takes me to the definition screen.I wish I could put screenshots in this message but I don't know how. Anyway, the definition says it is a "table" type. There are four tabs underneath - Attributes, Line Types, Initialization, and Access Key. Under "Line Type," the properties are as follows:
    Predefined Type
      Data Type: STRING
      No. of Characters: 0
      Decimal Places: 0
    Thank you in advance for your help.
    Peter

  • Hi.. i forgot my apple id and password.. i cant activate my ipod touch.. but here's the serial number, *********** please help me.. thanks

    hi.. i forgot my apple id and password.. i cant activate my ipod touch..
    but here's the serial number, *************** please help me.. thanks
    <Edited by Host>

    We are fellow users here on these forums, you're not talking to iTunes Support nor Apple - I've asked the hosts to remove your iPod's serial number address from your post.
    Only you can activate your iPod by typing in your id and password, or you can remove a device from your account via http://icloud.com . If you can't remember your account id then do you have any of its downloads on your computer's iTunes : Recovering a forgotten iTunes Store account name ? If not then you could try http://iforgot.apple.com . You can also reset your password via the 'iforgot' site, or you can contact Support in your country and they should be able to reset your password (as long as you can prove your id and that it's your account) : Apple ID: Contacting Apple for help with Apple ID account security
    iOS 7 and activation lock : iCloud: Find My iPhone Activation Lock in iOS 7
    What if I forget my Apple ID password?
    If you forget your password, you can reset it at My Apple ID (appleid.apple.com) or by contacting Apple Support and verifying your identity. Once your password has been reset, it will work normally with Find My iPhone and Activation Lock.
    If you forget your password and cannot reset it, you will lose access to your Apple ID and may be unable to use or reactivate your device. To help prevent this, visit My Apple ID periodically to review and update your account information.

  • I lost my iPhone 5S battery percentage after I upgrade the system to the newest one. I do turn on the percentage in battery usage, but it doesn't work. I also tried to restart my phone but nothing changed. Could somebody please help me? Thank you!

    I lost my iPhone 5S battery percentage after I upgrade the system to the newest one. I do turn on the percentage in battery usage, but it doesn't work. I also tried to restart my phone but nothing changed. Could somebody please help me? Thank you!

    You did turned in Settings > General > Usage > Battery Percentage: ON?
    Try a
    Reset: Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Note: You will not lose any data

  • Hi I am using Iframe with src="abc.mht" file. i want to view the mht file content in same window.please help.. Thanks in Advance

    Hi I am using Iframe with src="abc.mht" file. i want to view the mht file content in same window.please help..
    Thanks in Advance

    This is not a Java problem, this is a WEBBOT problem.
    I suggest that you research the topic in your FrontPage help files.
    Yes, we do know how to solve this problem using ordinary HTML and JSP. The sample code that you've posted implies that you are looking for an extremely different solution. To put it another way, it looks like you're logging onto the Federal Aviation Administration's forums and asking them how to go from Chicago to New York by train.
    But in any case, if you can't find the information in FrontPage, I'm 100% certain that if you went to www.microsoft.com and searched for FrontPage and downloads, and skipped the results that actually want you to download FrontPage, you'll get some sample code.

  • I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.

    I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.

    Just go back in photoshop and use the Slice Select tool, then just click and select the slice and hit delete - if you're not sure which one is the active slice just right click and find the one that has the Delete Slice option.
    It's possible you either added the slices by accident or if you received it from someone they just had the slices hidden. For the future, you can go to View > Show > Slices to display (or hide) slices.

Maybe you are looking for

  • Cannot connect to ASDM on ASA 5505 over https

    Problem: Cannot connect to ASDM on ASA 5505 when vlan1 network is changed from the factory default. Hi all. I am just getting started on a new ASA 5505, working it in a test lab environment. I ran thru the initial setup wizard. During that time I spe

  • Stepper motor closed loop control using 7344

    I have some question about the closed loop control of stepper motor using 7344. From the NI website I got that closed loop steppers work differently from closed loop servos. Instead of adjusting the output on each PID iteration like a servo system, c

  • Adapter Engine test tool doesnt work

    Hello I try to send a message from runtimeworkbench I chose Component Monitoring -> Integration server -> Adapter Engine And I put the paramets of the message ( message interface,namespace..etc.) then I put user and password and the url is http://ser

  • ThinkPad T530 and latest Intel HD 4000 drivers (15.33.14.64.3412)

    Hello All, I have the latest version of display drivers for the Intel HD 4000 chip, version (9.18.10.3359) from the official T530 driver page, however I see that Intel has updated to their latest version (15.33.14.64.3412). I am unable to install to

  • Problem with IPS-sig-S224

    I'm experiencing an issue updating my IDSM-2's. I'm currently at 5.1(1p1)S223.0V1.0, I tried applying the latest signatures (S224), but failed and got the following message: "Exception during sensor reimaging: Timed out while waiting for sensor to co