How do I add an arrayList into a JList?

Hey
Wondering how you add an ArrayList's data into a JList? If anyone can show me something like:
            JList delList = new JList(/*insert arrayList here*/);Thanks!

Wondering how you add an ArrayList's data into a
JList? I've not tried but the API's suggest that:
JList delList = new
JList(myArrayList.toArray());
/code]
should work.
http://java.sun.com/javase/6/docs/api/javax/swing/JLis
t.html#JList(java.lang.Object[])
http://java.sun.com/javase/6/docs/api/java/util/ArrayL
ist.html#toArray()That will work just fine.
@OP: Keep in mind that if your ArrayList contains objects which do not have an overridden toString() method, you may not get your desired results.

Similar Messages

  • How can I add advertisement code into flash game?

    hi mates,
    just want to ask about loading advertisement code!
    How do you add the advertisement code (adsense) into flash games??
    my site Funny Games have over 5k games but they are getting from others sites thus I have no original files. How can I add more code into the current files?

    Unless the games were pre-made to allow you to specify some variables in the page code or some external file, you won't be having any luck... you cannot add code to the games unless you have the source files, which you apparently don't have.

  • How do I add OIC presense into my web page?

    How do I add OIC presence into my web page? with Oracle Messenger (RTC) we can use the href=rtcmsgr:sendmsg?<login_ID> what is the equivalent for Oracle Instant Chat (OIC)?

    Unfortunately, this functionality was lost in the conversion from RTC to OIC. This feature was available because of a http web presence. Oracle did not license that component in OIC.

  • How can i add Custom fields into the

    Dear Experts
    We have Ecc6.0 system,
    How can i add Custom fields into the Infotype Screen(PA30),i heard that we do it by PM01 Tcode.
    But in PM01 i am unable to find the enhance infotype tab.
    How can i do it ....pls help.....
    Regards
    Sajid

    Hi,
    Do it thru the third tab : Single Screen.
    There write down the infotype number (e.g. 0022) and say generate objects.
    Regards,
    Dilek

  • How can I add  several  JButton into JList?

    I want to add several button into a Jlist. I tried this method, list.add(button,1),nothing shows up.I am not sure whether jList has the function.If it is,please show me how to achieve that.Thanks in advance!

    A JList is used to display text Strings. You should be able to add a JButton to the JList but all you will see is the toString() representation of the JButton. You will not see a button or be able to click on it.
    Try creating a panel using a GridLayout with a single column and add all you JButtons to the panel.

  • How can i add my components into dcomcnfg.exe?

    I have created a component a  out-process Server and  registered but I can't find it in
    dcomcnfg.exe.
    how can i add my components into dcomcnfg.exe?

    chenkuan,
    Sorry but you have posted to a forum that deals exclusively with questions/issues about customizing and programming Microsoft Project, a planning and scheduling application. I suggest you delete this post and find a forum appropriate for your issue.
    John

  • HT204655 How can I add gps information into my pictures?

    How can I add gps information into my pictures?
    I understand Photos doens't have this feature.
    Só how could I do it with an external application. Is it possible? Can I even use iPhoto with the same library (since they share stuff) to do it?

    Photos does not support to add location information yet.
    Add the GPS before you import the photos to Photos. I hope this will change with the next release.
    You could ,for example, first import to iPhoto, add the locations, batch change the titles and captions, do all the things that are not yet supported in the new Photos, then export the photos from iPhoto and import them to Photos.
    Or use the free exiftool, if you like the Terminal.
    See:  http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html#geotagging_exampl es
    To install exiftool: http://www.sno.phy.queensu.ca/%7Ephil/exiftool/install.html
    Other convenient apps are Jetphoto Studio, Geotagalog, there are many more ..
    I use Jetphoto Studio, but it is not free.

  • How to change elements in ArrayList into String

    Greetings,
    i like to change elements in arrayList into string.
    This is how i declare an ArrayList in a Java file
    ArrayList listing = new ArrayList();below is just a simple example of how i insert the string into the arraylist
    String concat = "';
    concat = concat + "apple";
    //Transfer the concat string into arraylist
    listing.add(concat);
    return listing;
    {code}
    On my Jsp page, it will receive the ArrayList from the java file. Lets say the Arrayist is pass into my JSP arraylist
    This is my JSP arraylist
    {code}ArrayList optLists = new ArrayList();{code}
    Inside the arraylist element, it holds data eg: *308577;;RS | [CAT 2] Level: Arena, Section: A02* with a pipe between RS and CAT 2.
    Now i looping the arraylist
    {code}int a = 0;
         for ( a=0; a < optLists.size(); a++)
              String tempString = "";
              String splitTemp = "";
                     String tempString = (String)optLists.get(a);
              splitTemp =  tempString.split("|");
              System.out.println("Split String Results: "+ splitTemp);
         {code}}
    Heres the error:
    *SeatAvailable_jsp.java:560: incompatible types*
        *[javac] found   : java.lang.String[]*
        *[javac] required: java.lang.String*
        *[javac]             splitTemp =  tempString.split("|");*
        *[javac]*       
    What can i do to solve the problem?
    Edited by: leeChaolan on May 2, 2008 4:45 AM
    Edited by: leeChaolan on May 2, 2008 4:48 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    paternostro is right, you are returning an array into a string which is wrong
    but try this, i haven't tested it though..
    nt a = 0;
         for ( a=0; a < optLists.size(); a++)
              String tempString = "";
              String splitTemp = "";
                     String tempString = (String)optLists.get(a);
              String[] splitTemp =  tempString.split("|");
              for(String xyz : splitTemp)
                   System.out.println("Split String Results: "+ xyz);
         }Edited by: linker on May 2, 2008 1:17 PM
    Edited by: linker on May 2, 2008 1:18 PM

  • How do I add multiple images into one file?

    I'm sure this is something that's been covered in another post (or even in the help portal) but I think my wording in my search terms are not correct or... I don't know, because I just can't find what I'm looking for.
    I want to know how to add multiple images into one file/one image, both horizontally and/or vertically. To give you an idea of what I mean, check out :
    http://www.best10apps.com/apps/comic-story,531596060.html
    If you scroll down, you'll see a heading entitled : Screenshots of Comic Story. Notice how there's 3 pictures (divided by borders). 2 of those pictures are side by side, and 1 of them is below the first 2 pictures.
    I want to know how to add different pictures/images and put them into one picture.

    One way is to create template PSD files and populate them with your images using Photoshops scripts.
    Photo Collage Toolkit UPDATED June 12, added Picture Package Support via PasteImageRoll and BatchPicturePackage scripts.
    The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.
    There are eleven scripts in this package they provide the following functions:
    TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
    CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
    LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
    InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
    ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
    ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
    PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
    BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
    BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
    BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder
    PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
    Documentation and Examples

  • How can I add a row into a JTable with JButton

    Hi all. I have the following code:
    package gui;
    import db.*;
    import javax.swing.table.AbstractTableModel;
    import java.util.ArrayList;
    public class FoundersTable extends AbstractTableModel{
        private static final int COLUMNS = 8;
        private String columnNames[] = {"��� ����", "���", "�������", "�������", "���������", "��������",
                "����� �� ����������", "������ �� ����, �����"};
        private ArrayList data;
        public FoundersTable(){
            data = new ArrayList();
        public int getRowCount() {
            return data.size();
        public int getColumnCount() {
            return columnNames.length;
        public String getColumnName(int colIndex) {
            return columnNames[colIndex];
        public Object getValueAt(int rowIndex, int columnIndex) {
            return ((ArrayList)data.get(rowIndex)).get(columnIndex);
        public void setValueAt(Object value, int rowIndex, int columnIndex) {
            ((ArrayList)data.get(rowIndex)).set(columnIndex, value);
            fireTableCellUpdated(rowIndex, columnIndex);
        public void addRow(ArrayList neueZeile) {
            data.add(neueZeile);
            int index = data.size() - 1;
            fireTableRowsInserted(index, index);
        public void removeRow(int index) {
            data.remove(index);
            fireTableRowsDeleted(index, index);
        public void removeAllRows() {
            data.clear();
            fireTableRowsDeleted(0, 0);
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return true;
    }Now in my MainJFrame class I have one button for additing and one button for removing a selected row. How can I add/remove rows with this two buttons.
    Thanks

    No my question is how can I add and remove rows WITH buttons My point was the code is the same. You use the addRow(...) method. Why did you write an addRow(...) method if you aren't going to use it?
    I don't understand your problem. Do you not know how to write an ActionListener?

  • How can I add jar files into the namespace in code?

    My friends:
    I need to add jar files into my namespace dynamicly in my code.But the jar files might be repeated, I am not sure.so, i wonder how can I add them into my namespace, ignoring the repeated files?
    This is my code:
    URL[] urlArrayA = new URL[5];
    urlArray[0] = sample1;
    urlArray[1] = sample2;
    URL[] urlArrayB = new URL[5];
    urlArrayB[0] = sample3;
    urlArrayB[1] = sample4;
    URLClassLoader urlClassLoaderA = URLClassLoader.newInstance(urlArrayA);
    URLClassLoader urlClassLoaderB = URLClassLoader.newInstance(urlArrayB);
    how can i visit classes in urlClassLoaderA from classes in urlClassLoaderB?

    could anyone please answer the question for me ? thank you...

  • How to find/add matched logfile into PL/SQL

    Hi,
    I make a PL/SQl like below to automate logminer to find out DMLs done in a schema (SCOTT) after a specific time.
    declare
    v_user_name varchar2(50) := 'SCOTT';
    V_ARCHIVE_LOG_DEST VARCHAR2(50) := '/var/tmp/arch';
    V_sequence_max number;
    v_start_query_time TIMESTAMP := '08-JAN-2010 00:00:00';
    begin
    --Create DICTIONARY file on the SOURCE database's redo files
    sys.dbms_logmnr_d.build( OPTIONS => sys.DBMS_LOGMNR_D.store_in_redo_logs);
    select MAX(sequence#) into V_sequence_max from v$archived_log WHERE DICTIONARY_BEGIN = 'YES' AND dictionary_end = 'YES';
    --add dictionary log files
    dbms_logmnr.add_logfile( logfilename=> 'V_ARCHIVE_LOG_DEST/1_3715_573231463.dbf',
    options=> dbms_logmnr.new);
    --add log files
    exec dbms_logmnr.add_logfile( logfilename=> 'V_ARCHIVE_LOG_DEST/1_3716_573231463.dbf');
    exec dbms_logmnr.add_logfile( logfilename=> 'V_ARCHIVE_LOG_DEST/1_3717_573231463.dbf');
    --start LogMiner, also (by the way) enable ddl tracking
    exec dbms_logmnr.start_logmnr(options => dbms_logmnr.dict_from_redo_logs + dbms_logmnr.ddl_dict_tracking);
    --To query
    execute immediate 'alter session set nls_date_format = ''dd_MM_yyyy hh24:mi:ss''';
    execute immediate 'SELECT username, sQL_REDO, SQL_UNDO FROM V$LOGMNR_CONTENTS WHERE username = ''v_user_name'' AND TIMESTAMP > ''v_start_query_time''';
    --END LOGMINER
    DBMS_LOGMNR.END_LOGMNR();
    END;
    ##########################3
    My question,
    After find out the redo logs SCN which include snapshot of data dictionary like below,
    select MAX(sequence#) into V_sequence_max from v$archived_log WHERE DICTIONARY_BEGIN = 'YES' AND dictionary_end = 'YES';
    I try to
    --add dictionary log files
    dbms_logmnr.add_logfile( logfilename=> *'V_ARCHIVE_LOG_DEST/1_3715_573231463.dbf'*,
    options=> dbms_logmnr.new); ---how can I add the logfile with above SCN# here automatically, above is just manually added.
    --add log files,
    exec dbms_logmnr.add_logfile( logfilename=> 'V_ARCHIVE_LOG_DEST/1_3716_573231463.dbf');
    exec dbms_logmnr.add_logfile( logfilename=> 'V_ARCHIVE_LOG_DEST/1_3717_573231463.dbf');
    ---how can I add all the files with SCN numbers after (>MAX(sequence#) ) here automatically?? --above redo files are just manually  added
    thanks
    Edited by: ROY123 on Jan 11, 2010 12:40 PM

    Is there any reason to not use [Fine Grained Auditing|http://www.oracle.com/technology/deploy/security/database-security/fine-grained-auditing/index.html] for something like this?
    Why reinvent the wheel in a more complex fashion ?

  • How do I add my logo into my signature

    How do I add my company logo into my email?

    There are a number of html mail editors in the App store for iPads.

  • How can if add multiple addresses into Contacts

    In OS 10.9.5 how can if add multiple addresses from from a tab separated file into contacts.
    I have a txt file with fields separated by tab and each and each record terminated a return,
    Importing using file>import tries to put all the data onto a single card
    Help

    Contacts – Import/Export

  • How to re-add the iPhone into the Find My iPhone and than to find the last known possition?

    Hello,
    I've got my iPhone stolen yesterday in the bar.
    In the morning I tried find it by Find My iPhone app but I hit the "remove" button by mistake. Is it possible to reverse this acction even without the iPhone in the hand?
    I need to re-add the iPhone into the iCloud (Find My iPhone) and than to find the last known possition. It's serial number is C3******39D
    Thank you
    Libor
    <Edited bu Host>

    Ringtones are a one-time only download from the store. You will need to connect the device that you downloaded it on to your computer's iTunes and do File > Devices > Transfer Purchases to copy it over to the Tones part of your computer's iTunes library and you can then sync it to your other device(s).

Maybe you are looking for

  • Is there any limitations to purchasing iTunes songs?

    I'm wondering if I should be concerned about anything as far as restrictions on how I can use songs I purchase from iTunes. I thought I heard somewhere that there were certain limitations putting your iTunes songs on different mediums. Or maybe that

  • IPod Touch 2nd gen restarts my PC

    So, I bought iTouch 2nd gen 8GB. Connecting to a PC worked for about month, and then it started to restart/reboot my PC every time I connect it. I've tried couple of things that might help but I wasn't successful. Here's a list of things: - restartin

  • Adobe Acrobat version 10  printing issues

    Not able to print all pages of a pdf. The pdf has 35 pages but will only print 32 of the 35 pages.

  • How to configure operator extension in UCxn?

    Hi all, I installed CUCM and UCxn 8.6.2 in my lab and was able to configure (using demo licenses) basic functionality meaning I can create voice mailbox for particular extension and it works just fine (can leave a message, listen it and finally delet

  • OfficejetPro 8000 won't stop cleaning, printing test pages

    Every time just after we print, our Officejet Pro 8000 A809 prints a test page, then starts cleaning and nothing can be printed again for several minutes. The test page can be canceled, but not the cleaning cycle. If we add several documents to the p