What type of event handling does the JList has?

hello
I know how to use handling using " anonymous inner class " when handling a JList, I don't like this way it is so confusing I would like to use the same way of handling JButton like this:
class Class1 extends JFrame implements ActionListener
//and the method is this one
public void actionPerformed( ActionEvent event )it is much better than the anonymous class. What is the handler of selecting in JList? is it this one?
ListSelectionListener
and the method is this?
public void valueChanged(ListSelectionEvent e)
I'm new in GUI Components so that's why I want to get used to the same old way of handling that I learned earlier :)
Could you provide me with an example please?
thank you

Have a look at [Selecting Items in a List|http://java.sun.com/docs/books/tutorial/uiswing/components/list.html#selection] in Sun's Tutorial. The ListDemo class implements ListSelectionListener.

Similar Messages

  • What types of NFC tags does the Lumia 920 support?

    I bought some Mifare Classic 1k tags online hoping I could write and read some custom tags with the few apps on the marketplace but it doesn't seem the Nokia interacts with them well.
    I found this on wikipedia.
    "At the moment BlackBerry phones and the Nokia Lumia 610 can't read/write Tectile stickers ". (which are apparently based on Mifare Classic.)
    I have found no other mention of what types of tags are supported, so that is my question. What types of tags are guaranteed to work with the 920?

    I've run some NFC tests with the 920 because I run an NFC marketing platform. 
    I wrote a review about the Lumia 920 NFC implementation http://www.tagonic.com/latest/easyblog/entry/nokia-lumia-920 
    Although this doesn't cover specific NFC tags I can confirm that it works well with MiFare UL tags. The use case of receiving a contact directly, and directing to web destinations works well.
    Interestingly we haven't managed to successfully initiate a pairing with other NFC accessories (BH505 headphones or the 360 Speaker) at all. We'd be interested to know if anyone else has this issue.
    But from a tag perspective we are confident that the Lumia 920 works with the MiFare UL tags.
    Feel free to contact us at [email protected] if you are looking for some tags that you want to program to go to a web destination. We'd supply them pre-programmed and you can virtually re-program them using the platform as opposed to having to physically re-write the tags.

  • What type of video file does the iPod 5 take with it's camera?

    I'm takeing a video course in school and need to know what type of video file it records. I'm using the iPod because of it's amazinf 1080p video. Thanks.

    The 5G takes 1080 P in MOV format

  • What is the best converter for video files in mpeg, avi, wmv, mps, etc for imovie and what type of video files does the iMovie use? I recently purchased a MacBook Pro -version 10.10.1. I make movies, but the iMovie does not support my video files.

    What is the converter for video files, to use in the iMovie? My files are mpeg, wmv, mts, avi, etc.  I recently purchased a MacBook Pro - version 10.10.1.

    AppGeeker will do the job.

  • Button Event Handler in a JList, Please help.

    Hi everyone,
    I have created a small Java application which has a JList. The JList uses a custom cell renderer I named SmartCellRenderer. The SmartCellRenderer extends JPanel and implements the ListCellRenderer. I have added two buttons on the right side inside the JPanel of the SmartCellRenderer, since I want to buttons for each list item, and I have added mouse/action listeners for both buttons. However, they don't respond. It seems that the JList property overcomes the buttons underneath it. So the buttons never really get clicked because before that happens the JList item is being selected beforehand. I've tried everything. I've put listeners in the Main class, called Editor, which has the JList and also have listeners in the SmartCellRenderer itself and none of them get invoked.
    I also tried a manual solution. Every time the event handler for the JList was invoked (this is the handler for the JList itself and not the buttons), I sent the mouse event object to the SmartCellRenderer to manually check if the point the click happened was on one of the buttons in order to handle it.
    I used:
    // Inside SmartCellRenderer.java
    // e is the mouse event object being passed from the Editor whenever
    // a JList item is selected or clicked on
    Component comp = this.getComponent (e.getX(), e.getY())
    if(!(comp instanceof JButton)) {
              System.out.println("Recoqnized Event, but not a button click...");
              //return;
    } else {
              System.out.println("Recognized Event, IT IS A MOUSE CLICK, PROCESSING...");
              System.out.println("VALUE: "+comp.toString());
    What I realized is that not only this still doesn't work (it never realizes the component as a JButton) it also throws an exception for the last line saying comp is null. Meaning with the passed x,y position the getComponent() returns a null which happens when the coordinates passed to it are outside the range of the Panel. Which is a whole other problem?
    I have yet to find an example on the web, using Google, that demonstrated using buttons inside a JList.
    Can anyone help me with this. Thanks.

    A renderer is not a component, so you can't click on it. A renderer is just used to paint a representation of a component at a certain position in your JList.
    I have yet to find an example on the web, using Google, that demonstrated using buttons inside a JList.Thats probably because this is not a common design. The following two designs are more common:
    a) Create a separate panel for your JButtons. Then when you click on the button it would act on each selected row in the JList
    b) Or maybe like windows explorer. Select the items in the list and then use a JPopupMenu to perform the desired functionality.
    I've never tried to add a clickable button to a panel, but this [url http://forum.java.sun.com/thread.jspa?threadID=573721]posting shows one way to add a clickable JButton as a column in a JTable. You might be able to use some of the concepts to add 2 button to the JPanel or maybe you could use a JTable with 3 columns, one for your data and the last two for your buttons.

  • Wwhat type of daq cards does the software accepts?

    What type of daq card does the measure software accepts?
    thanks

    Did you look at the datasheet? You might also want to consider VI Logger where you use the newer, cheaper, higher performing M series.

  • What is an event handler..?

    I'm trying to learn how to make responsiveness UI. I've read that I can not use SwingUtilities.invokeLater() method if I am in a event handler. The question can seems stupid but I'm only a beginner: what is a event handler? From what I know it might be the actionPerformed method..is it right? Could somebody give me an example? thanks!

    Basically an event handler is a class that performs code.
    It can be any class (even the same that fires the event), but it has to implement the proper interface for the event you want to catch. If you want to perform special code when someone clicks on a button you want to catch an Action, therefor you need an ActionListener, a class that either implements the ActionListener interface (and therefor the method actionPerformed) or your class has to extend AbstractAction (and therefor has an actionPerformed, too).
    It you want to perform special code when someone chooses an element from a list, you want to be informed about a ListSelectionEvent and therefor need a class that implements the ListSelectionListener Interface (and provides the method selectionChanged).
    The class that should react on the event has to be declared as being a listener to the object that fires the events. So an actionListener on a Button would be added by
    button.addActionListener(listener);or
    button.setAction(action);(Note that all variables used are just for clarifiing the type you need and have to be exchanged by the names of your declared objects)
    There are many more events ... really, read the tutorial!

  • Event Handler on the selectedItem of a ComboBox?

    Can you run actionscript as an event handler using the "selectedItem" of a ComboBox?  I prefer to do this using the XML file, but at this point I'll entertain any ideas.
    Thanks.

    Here is what I did to get the ComboBox to act like a menu:
    <s:ComboBox 
    id="msDropDown"dataProvider="
    {dropDownListXML.lastResult.milestones.milestone}"x="
    10" y="10" width="240" chromeColor="
    #CCCCCC" color="#000000"labelField="
    name"change="msDropDown_changeHandler(event)"
    />
    /////////script section////////////
    <![CDATA[
     import spark.events.IndexChangeEvent; 
    protected function msDropDown_changeHandler(event:IndexChangeEvent):void{
    var dropDownSelection:int = msDropDown.selectedIndex; 
    if (dropDownSelection == 0){
    dropDownLoader.load(
    "lessons/EBS_new_Milestone1.swf");}
    ]]>
    I'll use the different index values to run various command - I'll probably convert to a SWITCH to handle 20 to 40 different index choices.

  • What type of word processing does Macbook Pro offer?

    I want to switch to Mac and was wondering what type of word processing does Apple have on their MBPs'.

    Hi!
    This exact question was asked earlier in the week. If you do a search you can find it. The MBP comes with a trial version of iWorks Pages), and TextEdit.
    http://discussions.apple.com/thread.jspa?messageID=2743826&#2743826
    http://discussions.apple.com/thread.jspa?messageID=2158511&#2158511

  • My Itunes library is messed up. Wong titles. Wrong albums. Wrong everything. EX. I play a song by avenged sevenfold but then it plays a song by eminem. Song titles dont match what they play and neither does the artists name

    My Itunes library is messed up. Wong titles. Wrong albums. Wrong everything. EX. I play a song by avenged sevenfold but then it plays a song by eminem. Song titles dont match what they play and neither does the artists name. Can I restart everything from itunes? I know this sounds cunfunsing, (and it is) but yeah.
    Once again to try and clarify, The song(which itunes says is by artist,band,person, etc) is mixed up with another song out of my libary.
    If there's something you dont get ask me!!! thanks

    I'm experiencing the same issue. Not only do I get a messed up library, but since I've let iTunes handle my music files, they too have been shuffled around - placed in different album folders and sometimes given names of other songs... With quite a large library, the cleanup makes me feel a bit like Sisyfos pushing the rock uphill - it's a never ending story. Only positive side of this is that I get to play a lot of music quizzes while guessing who plays the song that is disguised as eg. Buddy from De La Soul, and then afterwards try to track down the real 'Buddy' as this has also found another folder to hide in...
    Shazam has come to the rescue a few times so far...
    @Apple: this is just not good enough!

  • What type of wireless router is the 1st generation time capsule? Is it B, G or N. I'm trying to understand why our wifi signal is a bit erratic. Paul

    what type of wireless router is the 1st generation time capsule? Is it B, G or N? I'm trying to establish whether its causing signal degradation as a result of conflicts with my BT Home Hub router.

    The 1st generation Time Capsule is an 802.11"n" wireless router, but in default settings it produces a signal that is also compatible with "g" and "b" wireless devices.
    If your HomeHub is in close proximity to the Time Capsule and it is also producing a wireless network, either the wireless on the HomeHub or the TIme Capsule should be be disabled to minimize the chances of wireless interference.
    Interference may also be coming from any cordless phones you may have, or another nearby wireless network as well.

  • HT4175 what type of encrytion is on the iphone?

    what type of encryption is on the iphone?

    Every iOS device has a dedicated AES 256-bit crypto engine built in that is used to encrypt all data on the device at all times. In addition, the iOS Cryptographic Modules have been granted FIPS 140-2 compliance by the U.S. federal government on devices running iOS 6.

  • What kind of resource demand does the standalone listener create?

    Hi all -
    I'm wondering what kind of resource load is consumed by the separating the listener off of the database. I guess I was under the impression the listener doesn't really do much at all other than handle the connections and calls to the database. Is it correct in assuming the majority of the resource consumption is still actually on the database or does the listener have a more impacting role?
    The question goes into determining what kind of processing power would be needed for a server that is only hosting the listener. Seeing as there really isn't anything that changes within the environment I'm wondering if it's really necessary to have multiple VM's setup for the sole purpose of hosting the listener. On that same note, is separating the listener onto a separate machine really removing any processing demand from the database?
    Thanks :)

    Hi,
    it seems you mixed up the database listener with APEX Listener. The APEX Listener is not an alternative for the database listener (you'll still need it when using the APEX Listener), but can be an alternative web server for the Embedded PL/SQL Gateway (EPG, using the database's internal XDB HTTP Server) or Oracle HTTP Server (OHS) to host your APEX instance.
    So as ALEX points out, it'll need about as much resources as one of the other web servers would. How much it will be depends on your usage scenario. Again, there is no immediate relation to the database listener.
    -Udo

  • Event handling to the drop down list in the WEB DYNPRO ALV.

    Hi Experts,
    I posted same thing in the UI programing in the morning
    For better Visiblity(as i didnt get any replies) of my issue i am posting the same thing in the ABAP General as well.
    In my dynpro ALV i have 5 fields. in that 2ed field has the drop down list.
    if i select any of from the list, based on the particular selected value, some value should be reflect in the 3rd field of the ALV.
    Ex:
    dropdown list of  2ed fields inclued like below
    AUXILIARY CONTROLLER
    AXLE ASSEMBLY, NON-OSCILLATING
    ACTUATOR, LINEAR
    AIR CONDITIONER
    BLADE, EARTHMOVING
    if i select ACTUATOR, LINEAR the value ( ACT - first three letters ) should automaticaly reflects in the 3rd field of the ALV like below
    Filed 2                Field 3
    ACTUATOR, LINEAR       ACT
    I thnk we have to do the some Event handling for that dropdown.
    I checkd in the SCN but i didnt find any solution to my issue.
    Any solutions/sample code is appriciated.
    Regards!

    Make sure that the Location Bar is not set to "Nothing": Tools > Options > Privacy > Location Bar: When using the location bar, suggest: History, Bookmarks, History and Bookmarks
    See [[Smart Location Bar]]

  • Event handling to the drop down list in the web dypro ALV.

    Hi Experts,
    In my dynpro ALV i have 5 fields. in that 2ed field has the drop down list.
    if i select any of from the list, based on the particular selected value, some value should be reflect in the 3rd field of the ALV.
    Ex:
    dropdown list of  2ed fields inclued like below
    AUXILIARY CONTROLLER
    AXLE ASSEMBLY, NON-OSCILLATING
    ACTUATOR, LINEAR
    AIR CONDITIONER
    BLADE, EARTHMOVING
    if i select ACTUATOR, LINEAR the value ( ACT - first three letters ) should automaticaly reflects in the 3rd field of the ALV like below
    Filed 2                Field 3
    ACTUATOR, LINEAR       ACT
    I thnk we have to do the some Event handling for that dropdown.
    I checkd in the SCN but i didnt find any solution to my issue.
    Any solutions/sample code is appriciated.
    For better visiblity( as i didn't get any replies ) I posted same thing in the ABAP Programing
    Regards!
    Edited by: Prasanth M on Feb 20, 2009 2:54 PM

    Make sure that the Location Bar is not set to "Nothing": Tools > Options > Privacy > Location Bar: When using the location bar, suggest: History, Bookmarks, History and Bookmarks
    See [[Smart Location Bar]]

Maybe you are looking for

  • The fixes dont work, can anybody help????

    I would be really grateful for someone's help. I have a Sony Vaio Media Center PC (XL301) and it came installed with Vista as the operating system. I am unable to play anything from sites that require the most up todate flash player; i.e. bbc iplayer

  • MacBook became slow after upgrading to Mavericks

    Since upgrading to Mavericks my MacBook Pro has become very slow. I did several things so far: Repairing permissions and Disk with Disk Utility and running OnyX. Both helped temporarily, but after a while everything becomes very slow again. Do I have

  • QuickTime 7 not in Control Panel after installing QuickTime 7.6.6

    Hi, I need some assistance please I don't have QuickTime 7 in my Control Panel after installing QuickTime 7.6.6. I only see QuickTime in control Panel but not QuickTime 7. How can i fix this?

  • Composite key in Time dimension

    Hi All, I would like to know Time dimension with Composite key. I have a requirement where I want to store 2 Calendars in Time dimension table. for e.g : for one calendar Weekstarts from SUN-SAT and for another it is from MON-TUE DateKey   Type WeekS

  • WAAS Speed from local cache

    I have a WAAS demo setup in a test lab and have a simulated T1 span connecting two networks. When I transfer a file using CIFS or web initially, I see the traffic flow through the WAN. When I do the transfer a second time, I know it is getting the da