Is it possible to show icons on a JList?

I wanted to know if its possible to make a list, on each selection, bigger, with more text. I would also like to show an image.
Well what i want to do, for my swing-based text-tile graphic rpg, is that when you are on a certain tile, I want it so that a list shows the creatures/players/buildings you may enter on a list. Well, I want to know the best way to show an image, name, and a quick couple of facts like level, class, in a nice way. The list seems to be only text, and it doesnt seem to support multiple lines of text per selection.

this shows a couple of things you've mentioned
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
class Testing
  Icon[] icons = {new ImageIcon("test.gif"),new ImageIcon("test1.gif"),
                  new ImageIcon("test2.gif"),new ImageIcon("test3.gif"),
                  new ImageIcon("test4.gif"),new ImageIcon("test5.gif"),
                  new ImageIcon("test6.gif"),new ImageIcon("test7.gif")};
  public void buildGUI()
    DefaultListModel dlm = new DefaultListModel();
    JList list = new JList(dlm);
    for(int x = 0,y = icons.length; x < y; x++) dlm.addElement("<html>"+x+"<br>"+x+"</html");
    JFrame f = new JFrame();
    f.getContentPane().add(new JScrollPane(list));
    f.pack();
    f.setLocationRelativeTo(null);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    list.setCellRenderer(new MyRenderer());
    f.setVisible(true);
  class MyRenderer extends DefaultListCellRenderer
    public Component getListCellRendererComponent(JList list,Object value,
                        int index,boolean isSelected,boolean cellHasFocus)
      JLabel lbl = (JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
      lbl.setIcon(icons[index]);
      return lbl;
  public static void main(String[] args)
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        new Testing().buildGUI();
}if you want the selected item to have a different height
http://forum.java.sun.com/thread.jspa?threadID=649772

Similar Messages

  • Possible to show bottom of scrolling text first when icon is displayed?

    Hi,
    Does anyone know if it is possible to show the bottom of
    scrolling text when the display comes up? For instance, let's say
    you have 20 lines of text in a scrolling display, but it only has
    room for 10. By default, Authorware shows the top 10 lines in the
    scrolled display, not the bottom 10. I want to show the bottom
    10--is this possible?
    Thanks,
    Edwin

    Hi,
    Well, I decided to have the most current information at the
    top of the display. For instance, if it were a chat, the most
    current chat info would be on top instead of on bottom. That fixed
    the problem adequately.
    Edwin

  • Apple TV 3: TV Shows icon missing

    Hello, as I was looking at the home screen of my Apple TV 3 (with latest software, 5.1.1 (5433)) the TV Shows icon disappeared.  This happened just a few moments ago.
    I now only have Movies, Music, Computers and Settings on the top row of icons.
    I live in the UK and I am using an iTunes UK account.
    I have tried restarting the Apple TV, and signing out and back in to my iTunes account but neither action has fixed the problem.
    Any suggestions?

    Is it possible any of you rented a movie within the last 48 hours?
    I rented a movie for the first time ever yesterday then an hour or 2 ago when I went into movies it only showed that rental.
    I rebooted then it showed the rest of my movies but still no TV shows.
    Wonder if the rental I did has anything to do with the issue at the moment.

  • Is it possible to show a 'My Activity' web part on a SharePoint site if 'My Sites' is not available?

    Is it possible to show a 'My Activity' web part on a SharePoint site if 'My Sites' is not available?
    For example, say there's a SharePoint installation dedicated to particular (custom) SharePoint site. The users go to the site to carry out their tasks. There's no 'My Site' set up in this installation (and for other reasons I'm told it's not an option).
    Is it possible to show a web part here that shows the user's recent activity? The built-in web part for this fails with the error 'Invalid URI: The URI is empty', and the details of it appear to say it's looking for the user's My Site to find out what to show:
    SPMicrofeedContext.SetMySiteHostForContext failed System.UriFormatException: Invalid URI: The URI is empty.     at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)     at Microsoft.Office.Server.Microfeed.SPMicrofeedContext.SetMySiteHostForContext()
    So, while I'd be happy to write a web part (or app part) to display the information instead of using the default part, I'm not sure SharePoint is even storing the activity in a way I can access.
    Some pages like the following: http://sharepointmystery.com/2012/07/22/activity-feeds-in-sharepoint-2013/ make me think it won't be possible - it says: 'The major change from 2010 is that all the [activity] content is stored in the user’s personal site, not
    in a common database.'
    Are activity feeds dependent on 'My Sites' or is there a way to access the information when 'My Sites' is not present in the deployment? I can't find a definitive answer in Microsoft's documentation.

    To clarify, do you have the User Profile Service (including MySite Host) up and running on this environment? That's subtley different to the full MySite experience which is clearly not applicable...
    Interesting question - thanks for that. Until now I didn't realise there was a difference.
    The User Profile Service is up and running, but no MySite Host is set. (I don't believe MySite will be available anywhere here. I guess that means there's no valid MySite Host for me to use.)
    Many thanks,
        Geoff

  • My toshiba external hard drive is not being recognized, except when I eject it. I have the preferences checked to show icon and have checked utilities folder. nothing. Help!

    I have a iMac, Yosemite 10.10 and my toshiba external hard drive is not being recognized, except when I eject it!. I have the preferences checked to show icons and have looked in the utilities folder..nothing. I have also changed ports. ??

    A few things to try:
    1-Repair permissions and restart your computer.
    2-Zap the PRAM
    3-Use Software Update/App Store to update your OS to OS 10.10.3.  Also, update everything SU/AS has to offer for your computer.  When done, repair permissions and restart your computer. 

  • So how do I REALLY get the toolbar buttons to just show icons (and not text)?

    On my Bookmarks toolbar, my bookmarks "buttons" show icon AND text. I just want to show icon, not text. When I go right-click.....customize, the window "customize toolbars" opens. Down in the bottom left corner the "show" option dropdown is already set to "icons" (and only icons). But it's just not so. The toolbar buttons show icons AND text. If I cycle through that dropdown just for kicks, it doesn't change; I can choose "icons (only)" all day long, but the toolbar buttons still show text.

    Either of the following Add-ons allow you to show icons only and/or to have multiple rows on the Bookmarks Toolbar. Set the options on either after installation.
    *Multirow Bookmarks Toolbar Plus - https://addons.mozilla.org/en-US/firefox/addon/multirow-bookmarks-toolbarplus/
    *Roomy Bookmarks Toolbar - https://addons.mozilla.org/en-US/firefox/addon/roomy-bookmarks-toolbar/
    Other - Check your Plugins and update as needed.
    #Check your Plugins - https://www.mozilla.org/en-US/plugincheck/
    #'''''Adobe Shockwave for Director Netscape plug-in, version 11.6.4.634''''' (this old version has security issues)
    #*http://kb.mozillazine.org/Shockwave
    #*Download, save, close all browsers, run the installer you downloaded - http://get.adobe.com/shockwave/thankyou/

  • TS3297 Hi. I can't find the movies and tv shows icons on my iTunes store. I use a 4th generation iPad with ios8.1.2. I haven't used the store in a long time but I'm pretty sure they used to be there. Now all I can download is music. Please help

    I Can't find the movies and tv shows icons in my iPad itunes store. All I see are music, genius, purchased and top charts.

    they are in the "videos".app Store

  • Is it possible to show a presentation from the original iPad via wireless on an older projector with no HDMI input?

    is it possible to show a presentation from the original iPad via wireless on an older projector with no HDMI input? If so, what equipment is needed?

    The ipad not support wireless projector yet.
    The workaround is you are using computer that connected wirelessly [needs 2 wireless adapter] / via cable to projector and connected also to the wireless router.
    You are controlling the computer via wireless connected to the router using remote desktop app like splashtop, teamviewer, logmein, vnc, etc. You must set the remote desktop port and app at the computer too as ipad app support.

  • Is it possible to show data from two different sql tables?

    Is it possible to show data from two different sql tables? Either to show combined data by using a join on a foreign key or showing a typical master detail view?
    I have one table With data about a house, and another table With URL's to images in the blob. Could these two be combined in the same Gallery?
    Best regards Terje F - Norway

    Hi Terje,
    If you have a unique key, you could use one of the following functions for your scenarios:
    If you only have one image per house, you can use LookUp:
    http://siena.blob.core.windows.net/beta/ProjectSienaBetaFunctionReference.html#_Toc373745501
    If you have multiple images per house, you can use Filter:
    http://siena.blob.core.windows.net/beta/ProjectSienaBetaFunctionReference.html#_Toc373745487
    Thanks
    Robin

  • How can I show icon Services for Object in PA30 Infotype 0019

    Hi guy.
    How can I show icon Services for Object in PA30 Infotype 0019 ?
    This icon display in some infotype example infotype 0024(Qualifications).But I wanna use in Infotype 0019.
    I don't wanna use menu "Assign facsimile".
    Best regards.
    Chutima.

    Sorry - should have said I'm using JDev 10.1.3.0.4 with JSF & ADF BC.

  • Dvt alert not showing icons on graph

    I am showing icons on the line graph with the help of dvt:alert component. Code snippet:
    Alert map:
    public Map getAlertMap() {
    Alert alert1=new Alert();
    //alert1.setXValue("2011-10-05 10:25:34");
    alert1.setXValue("20");
    alert1.setYValue(48.00);
    alert1.setId("al1");
    Alert alert2=new Alert();
    // alert2.setXValue("2011-10-06 12:56:09");
    alert2.setXValue("25");
    alert2.setYValue(39.00);
    alert2.setId("al2");
    Alert alert3=new Alert();
    alert3.setXValue("2011-10-07 12:5:09");
    alert3.setYValue(39.00);
    alert3.setId("al1");
    alertMap.put(1, alert1);
    alertMap.put(2, alert2);
    alertMap.put(3, alert3);
    return alertMap;
    Graph data:
    public List getLineGraphData() {
    Object [] a = new Object[]{"10","20","30","40"};
    // Object [] b = new Object[]{"USD","","",""};
    Object [] c = new Object[]{32.00,48.00,39.00,47.00};
    for (int i = 0; i < 4; i++) {
    lineGraphData.add(new Object[]{a[i],null,c});
    return lineGraphData;
    Jsff:
    <dvt:lineGraph id="lineGraph1" subType="LINE_VERT_ABS"
    tabularData="#{pageFlowScope.DatapointsChartBean.lineGraphData}">
    <dvt:background>
    <dvt:specialEffects/>
    </dvt:background>
    <dvt:graphPlotArea/>
    <dvt:seriesSet>
    <dvt:series/>
    </dvt:seriesSet>
    <dvt:o1Axis/>
    <dvt:y1Axis/>
    <dvt:legendArea automaticPlacement="AP_NEVER"/>
    <dvt:alertSet alertMap="#{pageFlowScope.DatapointsChartBean.alertMap}"/>
    </dvt:lineGraph>
    The same code is working in different project while its not working on my application. I doubt whether its an issue with adf library or web.xml entry.
    I am able to see graph but not icons. Can someone help me in this, and please tell me what adf libraries are requried for dvt:alert which is different from dvt:lineGraph

    Very strange!
    It should be safe to remove the file. As for the icons being gone, click on Finder in your dock, then go to the "Finder" menu, right next to the  in your menubar. Select "Preferences..." In the window that appears, make sure the boxes are checked that refer to the icons that should show on your desktop.
    If that doesn't fix it, try creating a new user account on your Mac.
    http://docs.info.apple.com/article.html?path=Mac/10.5/en/8235.html
    Log into that account and see if icons show up on your desktop. If so, there might be a problem with the preferences and settings files in your original user account.
    Let us know if that helps!

  • Is it possible to show the campaign name in the opportunity page?

    Hi Everyone,
    I'm wondering if its possible to show the campaign name in the opportunity page as a referrence as to which campaign the opportunity as associated with.
    Thanks,
    Wayne

    there is a Source Campaign field on oppty.

  • Is there any possibility to show English interface in Chinese windows-xp?

    I'm using English Windows-XP, but "Language for non-Unicode program" setting has to be set as "Chinese(PRC)" to show Chinese word correctly in my laptop.
    ODI interface in this environment always show in Chinese, but all the manual is in English, so it's difficult for me to make clear which word in ODI interface is the meaning in manual.
    My question is, Is there any possibility to show ODI English interface even "Language for non-Unicode program" setting in my Windows-XP is "Chinese(PRC)"?

    OK, I got the answer.
    set lines below in odiparams.bat in windows and odiparams.sh in unix:
    set ODI_ADDITIONAL_JAVA_OPTIONS="-Duser.language=en" "-Duser.region=US"

  • Is it possible to show Nikons raw files (.nef) in the organizer as thumbnails?

    Hello
    Is it possible to show Nikons raw files (.nef) in the organizer as thumbnails?
    Best regards Dieter

    Yes it is possible, depending on your camera and version of PSE

  • My mac book pro load system and not show icons only show pointer

    my mac book pro load system but not shows icons only show pointer

    Can you open Applications by navigating to the Applications folder via the Finder? When you write that your computer doesn't show icons, do you mean your Dock icons? Can you see the Dock as all?
    Need just a little more information...
    Clinton

Maybe you are looking for

  • Problem with syncing with Outlook

    Hi, I have a  3G curve 9300. no BIS. OS 6.bundle 2949 I use Outlook 2010 on Windows 7 when I try and Sync my Calendar I only get appointments going from outlook to BB, any appts I have created on BB does not get on PC! I have 2 email a/cs and Faceboo

  • CP1025nw firmware upgrade for eprint and/or airprint?

    I bought one of these which is supposed to be eprint capable by late 2010.  I can't find the firmware for this update.  Otherwise, I believe it's misleading of HP to advertise the availability.  If I had known, I would have returned the printer withi

  • RB_Split option not found for message split

    Hi all, We're configuring to split a single XML with multiple records into multiple single record XML files. We have referenced the blog: /people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible but, during interface determinat

  • Is it possible to display a dynpro in a container?

    Hey guys, in the SAP Case Management environment SAP offers the possiblity to define customer specifc "subcomponents". A subcomponent is basically a certain part on the screen. For the implementation you get a reference to a GUI container (im_contain

  • Qosmio X770-107 - 3D emitter needs to be installed to get 3D

    I have a Toshiba x770-107 and 3D nvidia Vision 2 glasses. I had this laptop before and all I had to do was to turn on the glasses and they worked. Now with this new laptop I had to install and plug in this emitter via usb port to get the 3d to work.