Is it possible to format the appearance of JList components?

Hi!
I've looked through the tutorial and browsed through previous messages, but I can't seem to find an answer to my question. Any help would be GREATLY appreciated.
The situation: I have a JList in which I want to display a list of objects. I use a DefaultListModel, create a JList and then add objects to the DefaultListModel as I please, everything works great.
The problem: The objects that I'm adding are not strings. They are objects that contain a number of instance variables and are instances of class 'MessageObject.' Thus, when the program is run, the objects in the list have names like: "MessageObject@53c375" or "MessageObject@453807", which is undesirable.
The question: Is there a way to make the list contain OBJECTS but display STRINGS (like, a string contained within the object or whatever) ?
Any help is greatly appreciated! Sorry if the answer is trivial, it's just getting a bit late... Thank you in advance.
Vlad

Lists, like most Swing components, have a Model (containing the data) and a View (the graphical representation of the model).
The view requires instruction on how to display the objects contained within the model. The default method of displaying objects is invoking the toString() method which exists for every object. In most cases, this will display 'nonsensical' internal information, as you are currently getting. However, you can implement the toString() method in your objects, to return a custom String, thereby displaying the object any way you like.
For a more advanced display technique, you can look into ListCellRenderer, custom implementations of which can display objects in any graphical sense as you like.
The bottom line is, in you MessageObject class definition, supply a method:public String toString() { ... }

Similar Messages

  • IS it possible to Format the data to CXML format in Java ?

    Hi all,
    I am new to Java programming. I am an SAP ABAP Developer and in my SAP CRM E-Commerce Web Shop coding, I have to do coding in Java.
    My current requirement is that I have some set of data and I have to format this data to CXML format in Java. IS this possible?
    Can I format the data to CXML format in Java? Are there standard API's to do this? Please let me know how should I procced with the coding?
    Apart from formatting the output to CXML format, I have to also post this data to an external market place...How can I do this?
    Please help me with relevant information. your help will be highly appreciated.
    Regards,
    Jessica Sam

    It should be possible to format the data, yes. If there's a "standard API" it should be one that comes out of that SAP CRM thing, so look there.
    As for "posting to an external marketplace", that's far too vague a concept to be able to answer. You should start by getting the specs about "how to post" from that marketplace.

  • Is it possible to format the excel from OAF ?

    Hi,
    I have a requirement that :
    We have a page from where we are exporting data to an excel sheet, which is working fine.
    But the data in the excel sheet is not formatted: now the problem is, we have to give a proper formatted data in excel form and it should be available when export button is clicked.
    Is it possible to handle the excel format through code from OAF ?
    Thanks,
    Ranita

    Ranita,
    Why dont you try with XML report.
    Call the XML(RTF) report in XLS format when button is clicked.
    Regards
    Srdihar

  • Is it possible to format the entire macbook and saving apps like microsoft word on a harddisc and then just reinstalling them without having to buy an other licence?

    Hye
    I want to format my macbook but i want to save my apps like word, excel, powerpoint.. Is it possible to save them on a hard disc because i tried to save them and open them on an other mac to check if it works but it didnt..
    Thanks

    I think you would have to reinstall the keys seeing that if you format the computer all the data is gone. Even though you backed up that data you never know what can happen when you try to reinstall certain apps. Not sure what method you can go by, you should run a diagnostics test to see how you computer is doing internally.
    Goodluck

  • Please is possible to create the most common adf components dinamically?

    Or you have some comment or advise?
    I need to create dynamically forms from a definition on tables.
    I don't need but anyway I didn't find a way to create entities dinamically, only views.
    Thank you :)

    I told what are the limitations, I even bought the book oracle jdeveloepr 10g for forms and pl/sql developers to search for similar functionality as there is in Oracle forms.
    in example
    Improvement of help in JDeveloper
    I really have problems understanding adf api
    The first problem is there are no equivalent for oracle forms functionality and jdeveloper api needs more examples, some years ago I saw how some programmers talk about some uses of api as if it were magic or a big discovery, but a good documentation and examples of APi will help every one, now, after more than one years I had seen there are more examples and demos, and people know more than then.
    I'm not talking about new functionality I was talking about the functionality there were in Oracle Forms, not necessary all, but at least some.
    One of many many examples could be how can I get the functionality of COUNT_QUERY built-in when using ADF views.
    In an On-Count trigger, performs the default Form Builder processing for identifying the number of rows that a query will retrieve for the current block, and clears the current block. If there are changes to commit in the block, Form Builder prompts the end user to commit them during COUNT_QUERY processing. Form Builder returns the following message as a result of a valid call to COUNT_QUERY:
    FRM-40355: Query will retrieve <number> records.
    If you could answer this question I really will appreciate it.
    That's the reason then we didn't choose adf to develop web applications, and choose PHP, currently we are thinking in zend framework and php; but we decided to give a check to ADF again.
    Thank you :)

  • Is it possible to set the tab order of components on a form?

    I'm trying to set the tab order of text boxes on a form, that uses GridBag layout. It seems that the tab order is automatically set according to the order that components are added to the form in. Is there a way to change it manually? I really don't want to redo the entire form...

    I have no idea what you're talking about. It might be worth to look for the right forum which suits your actual problem. Are you talking about Swing? Then post it in the Swing forum. Are you talking about JSP? Then post it in the JSP forum.
    Go to the forum index to see what forums are all available: http://forum.java.sun.com/index.jspa?tab=java

  • Is it possible to format an external hard drive on my mac?

    I purchased a portable external hard drive to back up my former pc in the hopes of using it on my mac. Obviously, I did not research this seeing now that I can integrate my files and photos from my pc to my mac. It appears possible to format the external hard drive to my mac os, which should be done prior to downloading files from my pc to the hard drive. Has anyone dealt with this or am I the only idiot that purchased the external hard drive thinking that was the thing to do before my pc dies completely?

    A HD formatted in EXFAT will transfer data between both PC and Mac.
    However dont make the titanic error most do in having merely a single external HD backup of your data, thats a tragedy waiting to happen.
    HD are cheap as dirt.
    Ideal situation is 3 HD ,   1 for Mac backups, 1 for data archives stored away safely and updated as needed / often.
    and a 3rd HD in Exfat for data transfers  (or a thumb drive for the same thing to save $$)

  • Format the header of ALV

    I used the function 'REUSE_ALV_COMMENTARY_WRITE'. However, the header line always 'left-justified'.
    Is it possible to format the header with diff. alignment?
    I want to have the header 'centered'.
    Thanks!

    HI
    GOOD
    CHECK WITH THIS EXAMPLE AND USE IT ACCORDINGLY
    REPORT  Z_TEST_ALV_EVENTS                       .
    type-pools: slis.
    data: x_fieldcat type slis_fieldcat_Alv,
          it_fieldcat type slis_t_fieldcat_alv,
          x_events type slis_alv_event,
          it_events type SLIS_T_EVENT.
    data: v_lines type i.
    data: begin of itab occurs 0,
           vbeln like vbak-vbeln,
           posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 100 rows
           into table itab.
    x_events-name =  'END_OF_LIST'.
    x_events-form =  'END_OF_LIST'.
    append x_events to it_events.
    clear x_events.
      x_events-name =  'TOP_OF_PAGE'.
    x_events-form =  'TOP_OF_PAGE'.
    append x_events to it_events.
    clear x_events.
    "if you use FM..
    call function 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = IT_EVENTS
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    read table it_events into x_events with key name = 'TOP_OF_PAGE'.
         if sy-subrc = 0.
         x_events-form = 'TOP_OF_PAGE'.
         modify it_events from x_events index sy-tabix transporting form .
         endif.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'ITAB'
       I_INCLNAME                   = sy-repid
      changing
        ct_fieldcat                  = IT_FIELDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    describe table itab lines v_lines.
    call function 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM                = sy-repid
        I_CALLBACK_PF_STATUS_SET          = 'STATUS'
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
        IT_FIELDCAT                       = IT_FIELDCAT
        IT_EVENTS                         = IT_EVENTS
        tables
         t_outtab                         = ITAB[]
      EXCEPTIONS
        PROGRAM_ERROR                     = 1
        OTHERS                            = 2
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    FORM TOP_OF_PAGE.
        DATA: LS_LINE TYPE SLIS_LISTHEADER,
              E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
      Listenüberschrift: Typ H
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'H'.
      LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = 'Summary'.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
      Kopfinfo: Typ S
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'S'.
        LS_LINE-KEY  = 'Test'.
        LS_LINE-INFO = ''.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
        LS_LINE-KEY  = 'ASIA'.
        LS_LINE-INFO = 'test'.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
      Aktionsinfo: Typ A
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'A'.
      LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = TEXT-105.
        APPEND LS_LINE TO  E04_LT_TOP_OF_PAGE.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE
            I_LOGO             = 'ENJOYSAP_LOGO'.
    ENDFORM.
    FORM END_OF_LIST.
    write :/ 'No of Records ', v_lines.
    ENDFORM.
    THANKS
    MRUTYUN

  • Formating the mail body

    Hi to all
    Is it possible to format the mail body that we create using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' like a rich user interface?
    Kindly suggest.
    Thanks & Regards
    Vipin

    Its possible to give html tags in the body internal table thereby make it a rich user interface. For html you may need to use document type as HTM.
    I 've given an example in this link. Please have a look.
    Re: Bold, Colors in mail - Urgent
    Rgds,
    TM.

  • How to save SOME time machine Mac backups from the TM disk to other disk WITHOUT formatting the destination disk?

    Hi,
    How to save SOME time machine Mac backups from the TM disk to other disk WITHOUT formatting the destination disk?
    I have a Time Machine disk (A) including the backups of several different Macs (B, C, D & E) generated with an old Mac OS X 10.5.8 (iMac PowerPC) over the years.
    I have transferred the old Mac contents to a new Mac with OS X 10.8.3 using Migration Assitant. All OK.
    Now, I want to erase such TM disk A to use if for other purposes, but first, I would like to RECOVER the backups of some Macs inside it (D and E). Is that possible WITHOUT formatting the destination disk and selecting only some Macs from the TM disk and not the fulll TM disk? How?
    Thanks.

    Thanks for the reply. I do not think that is messy, anway. I simply used the same external disk as Time Machine disk for different Macs. And that worked OK all the time for years.
    The ExternalTimeMachineDisk contains the folder Backups.backupdb
    which contains the following folders (each one corresponding to the Time Machine backup made from each Mac):
    Mac1
    Mac2
    MacBook1
    MacBook2
    In relation to my message above, is it possible to select specific files, folders or full Mac backups from such Time Machine disk and save them to other disk? How?
    Thanks.

  • I deleted the photos via Finder and empty trash long time ago. The thing is, that I want to recover one event or album.  The event appears in the iphoto but when open, it shows "!". Is it possible to recover the photos?

    I deleted the photos via Finder and empty trash long time ago. The thing is, that I want to recover one event or album.  The event appears in the iphoto but when open, it shows "!". Is it possible to recover the photos?

    No.  When you removed the photos via the finder you damage the library.  Photos should always be removed from the library using iPhoto, never with the Finder.
    If you have a Time Machine backup of the library from before you deleted the photos you can restore the library to the Desktop and export that album from it to import into your current library.
    It's been too long to be able to try one of the file recovery applications.  You sure to have overwritten those files with new files since them.
    OT

  • Is it possible to use the Study Cards feature in iBooks without the special new .iBooks format?

    The all new iBooks 2 has been released today, with quite a compelling array of features for students. I've watched a few videos, among those the introducory video from Apple, and one of the features that appealed to me most is the Study Cards feature, which uses notes you've created to generate study cards you can practise with.
    Now, I have a bunch of .ePub books, most of which are annotated and have notes. To my surprise (and a tiny bit of frustration) however, I wasn't able to find the button to activate Study Cards.
    I've tried to make a book myself using the also newly released iBooks Author application, and found that with the new book it indeed is possible to use the notes.
    Is there any way to make Study Cards available for .ePub books as well?

    I was thinking, perhaps there's a way to import ePub files into the iBook Author software, and thus create an iBooks format that enables the use of Study Cards.
    I haven't found an easy way to do so yet, though. Perhaps some authors with more experience could share their methods of converting their published books to this new format, so we can try to do it with our own (DRM free) ebooks?

  • Is it possible to override the built-in PDF format handler with a custom IFilter for PDF?

    Hi,
    SharePoint 2013 comes with a built-in "format handler" for PDF now, so it can index PDF files out of the box. This is great for most users, as it now no longer is necessary to install a third-party IFilter for crawling PDF documents.
    My question is, is it possible to override the built-in format handler for PDF with a custom IFilter for PDF? I played with the Set-SPEnterpriseSearchFileFormatState and Remove-SPEnterpriseSearchFileFormat cmdlets. While it is possible to deactivate
    the built-in format handler, I was not able to remove it and to create a new one that activates a custom IFilter for PDF files.
    Background of the question: While the new built-in format handler for PDF will probably be sufficient for many SharePoint users, some need additional capabilities regarding indexing if PDF documents, e.g. extraction of custom metadata from PDF's document
    information dictionary and embedded XMP metadata. PDFlib GmbH, the company I work form, sells an IFilter for PDF, and of course we would like to continue to offer this for SharePoint 2013.
    Thanks
    Stephan

    You should be able to replace it with any ifilter you want, this is the procedure for installing it:
    Install PDF iFilter 9.0 (64 bit) from
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025 (http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025)
    Download PDF icon picture from Adobe web site
    http://www.adobe.com/misc/linking.html (http://www.adobe.com/misc/linking.html)  and copy to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\IMAGES\
    Add the following entry in docIcon.xml file, which can be found at: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\XML
    <Mapping Key="pdf" Value="pdficon_small.png" />
    Add pdf file type on the File Type page under Search Service Application
    Open regedit
    Navigate to the following location:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\15.0\Search\Setup\ContentIndexCommon\Filters\Extension
    Right-click > Click New > Key to create a new key for .pdf
    Add the following GUID in the default value
    {E8978DA6-047F-4E3D-9C78-CDBE46041603}
    •Restart the SharePoint Server Search 15
    •Reboot the SharePoint servers in Farm
    •Create a Test site (with any out-of-box site template) and create a document library upload any sample PDF document(s).
    •Perform FULL Crawl to get search result.
    Once the crawl is completed we will get search results.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • Is it possible to get the image from the i pad when mirroring via Apple TV to fill the screen instead of appearing as a screen within a screen?

    When mirroring, is it possible to get the image from the ipad to fill the screen on the TV instead of appearing as a screen within a screen?

    Welcome to the Apple Community.
    No, the iPad has an aspect ratio of 4:3, a TV has an aspect ratio of 16:9, to fit one into the other is impossible without distorting the picture. If your TV has a zoom feature, you may be able to use this to fill the screen a little more to your liking, but this will result in cropping top and bottom.

  • Is it possible to change the formatting of Excel in place

    Hi,
    is it possible to change the standard formatting of columns and texts when using Excel inplace (Excel on the web for the BPS )?
    Many thanks,
    Simon Cohen

    Simon,
    I am afraid you can't modify styles using excel in place.
    Note 632333 says the following :
    List of the features the Excel OWC can use from the template:
    Text format - font, size, colour
    Cell format - background colour, border, alignment
    Number format
    "Simple" formulas
    Panes Split and Freeze (only for Office versions 2002(XP) or higher)
    Nevertheless this applies only for cells which are not filled by BPS runtime. All texts and values written by BPS runtime into the template use standard styles. The styles cannot be changed, see below.
    List of features that are not available in the Excel OWC:
    Styles. Consequently no changes to the SAP standard styles are taken over to the OWC. Therefore the features mentioned above are available only for the cells not containing a transaction specific data
    VB Macros. When needed, the designer can use a script language (VBScript, JavaScript) to access the DOM of the OWC. You can include HTML into a text component in the Web Interface customizing (tn BPS_WB) and place your script code there.
    Cell and text formats not mentioned above (e.g. text orientation,...)
    Line brakes within a cell
    Panes Split and Freeze (only for Office version 2000)
    Embeded elements (like form objects, pictures, background picture,...)
    Having more than one worksheet in the Excel OWC
    In comparison to HTML based planning layouts the Excel layouts do not identify the position of the documents.
    Hope it helps,
    Alberto

Maybe you are looking for

  • I dropped iPod nano (4g and 5g) in water...what do I do ?

    I dropped iPod nano (4g and 5g) in water...what do I do ?

  • Checkbox and 2 functions

    I have a form that lists all games for a college football week. I am allowing users to select up to 7 teams. I am using checkboxes b/c it is easier to unselect a game. One thing that is important is if a user has select Team 1 for Game 1 and then for

  • Currency signs

    This may be a stupid question, but does anyone know how to make a currency sign visible in forms and documents rather than the type. e.g. I would like to display £ not GBP Many thanks Dom

  • Nvidia with support for xorg 7.1 is out!

    http://www.nvidia.com/object/linux_disp - -8774.html AIGLXAIGLXAIGLXAIGLXAIGLX! :-D :-D

  • Is it possible to Edit Mpegs from DVDs?

    Hi there. I am just strating a project, a museum installation, that requires footage to be edited together from a variey of sources. Some of these are DVDs. How can I get footage from the DVDs and into FCP for editing. I can convert into Mpeg4 using