Urgent!!!Want to add different panels in different rows..

i am trying to add different Panels in differnt rows of same column..
But each time i am getting the default panel which is being retuned by the MyTableCellRenderer class which i have implemented from TableCellRenderer .
Would you like reply whats wrong in my approach...Can anyone modify my code???
public class TablePanel extends JPanel
JTable alertInsertTable;
JScrollPane alertInsertPane;
String columnnames[]={"Insert Alert"};
Object[][] values={
new JPanel()
DefaultTableModel tableModel= new DefaultTableModel(values,columnnames);
TablePanel()
setLayout(new BorderLayout());
alertInsertTable= new JTable(tableModel);
alertInsertPane = new JScrollPane(alertInsertTable);
alertInsertTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
this.add(alertInsertPane,BorderLayout.CENTER);
setDataInTable();
public void setDataInTable()
int count=0;
alertInsertTable.setRowHeight(80);
MyTableCellRenderer ob=new MyTableCellRenderer();
this.alertInsertTable.getColumn("Insert Alert").setCellRenderer(ob);
JPanel panel1=new JPanel();
JPanel panel2=new JPanel();
panel1.add(new JLabel("HIiiiiiiiiiiiiiii"));
panel2.add(new JLabel("Hellooooooooooooo"));
Object[] ob1={panel1};
Object[] ob2={panel2};
model.addRow(ob1);
//its always adding to the Panel with label new JLabel("Oppsssss")
//which is the panel instance returned by MyTableCellRender
model.addRow(ob2);
// this also adding to the Panel with label new JLabel("Oppsssss")
//which is the panel instance returned by MyTableCellRender
// ? What code should i write here so that i can add panel1 and panel2
//which i have created here.
class MyTableCellRenderer extends JPanel implements TableCellRenderer
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex)
     JPanel panel = new JPanel();
     panel.add(new JLabel("Oppsssss"));
return panel;
}

Only three exclamation marks; can't be that urgent.And only 1 cross-post...
Let's continue here:
http://forum.java.sun.com/thread.jspa?threadID=742590

Similar Messages

  • BDC : to select different rows in table control

    Hi,
    I have to fill many rows in table control and want to select different row one by one  in increasing order which rows are filled in BDC.
    Can anybody suggest me with coding...
    thanks
    naresh

    Hi ,
    I am attaching sample code for BDC transaction code is : FV11 , This code is also contains poage down concepts . By using this page down concept you can add number of item fields
    Program Name        : ZFV11_NEW
    Program Description : To Upload Condition Records-FV11
    Author              : Jagadish
    Start Date          : 11/06/2007
    REPORT zfv11
           NO STANDARD PAGE HEADING LINE-SIZE 255.
       DO NOT CHANGE - the generated data section - DO NOT CHANGE    ***
      If it is nessesary to change the data section use the rules:
      1.) Each definition of a field exists of two lines
      2.) The first line shows exactly the comment
          '* data element: ' followed with the data element
          which describes the field.
          If you don't have a data element use the
          comment without a data element name
      3.) The second line shows the fieldname of the
          structure, the fieldname must consist of
          a fieldname and optional the character '_' and
          three numbers and the field length in brackets
      4.) Each field must be type C.
    Generated data section with specific formatting - DO NOT CHANGE  ***
    TABLES : t100.
    DATA: BEGIN OF record OCCURS 0,
    data element: KSCHA
            kschl(004),               "Condition Type
    data element: SELKZ_LIST
          selkz(001),
    data element: WERKS_D
            werks(004),               "Plant
    data element: ELIFN
            lifnr(010),               "Vendor
    data element: MATNR
            matnr(018),               "Material No.
    data element: KBETR_KOND
            kbetr(016),               "Amount
    data element: KODATAB
            datab(010),               "Condition Validity Date from
    data element: KODATBI
            datbi(010),               "Condition Validity To
    data element: MWSKZ
            mwsk1(002),
          END OF record.
    DATA : BEGIN OF it_new OCCURS 0,                    " Internal Table for Header Data
           kschl(004),
           werks(004),
           lifnr(010),
           END OF it_new.
    DATA : BEGIN OF it_item OCCURS 0,                  " Internal table for Item Data
          werks(004),
          lifnr(010),
          matnr(018),
          kbetr(016),
          datab(010),
          datbi(010),
          mwsk1(002),
          END OF it_item.
    DATA : cnt(2) TYPE n,
           fld(25) TYPE c.
    TYPE-POOLS: truxs.
    DATA: it_raw TYPE truxs_t_text_data.
    DATA : n TYPE n.
    DATA:
         BEGIN OF t_data OCCURS 0,
               data TYPE string,
         END   OF t_data.
    DATA:BEGIN OF it_mess OCCURS 0,
      msgtyp(5),
       lms(200),
       msgv1(50),
        END OF it_mess.
    DATA : p_mode    TYPE c.
    DATA:it_msgtab TYPE STANDARD TABLE OF  bdcmsgcoll WITH HEADER LINE,
       it_msgtab1 TYPE STANDARD TABLE OF bdcmsgcoll WITH HEADER LINE.
    DATA :  l_mstring(150).
    DATA : BEGIN OF bdcdata OCCURS 0.
            INCLUDE STRUCTURE bdcdata.
    DATA: END OF bdcdata.
    PARAMETERS : p_file1 LIKE rlgrap-filename.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
      PERFORM file_selection.
      PERFORM data_upload.
      PERFORM table_control.
      LOOP AT it_new.
        REFRESH bdcdata.
        PERFORM bdc_dynpro      USING 'SAPMV13A' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RV13A-KSCHL'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'RV13A-KSCHL'
                                      it_new-kschl.
        PERFORM bdc_dynpro      USING 'SAPLV14A' '0100'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'RV130-SELKZ(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=WEIT'.
        PERFORM bdc_dynpro      USING 'SAPMV13A' '1363'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'KONP-KBETR(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '/00'.
        PERFORM bdc_field       USING 'KOMG-WERKS'
                                      it_new-werks.
        PERFORM bdc_field       USING 'KOMG-LIFNR'
                                      it_new-lifnr.
    DATA: "X(5) TYPE N,
             N(5) TYPE N.
       N = 0.
       LOOP AT it_item.
         N = N + 1.
       ENDLOOP.
       "X = 1.
       CNT = 1.
       DO N TIMES.
         IF CNT > 19.
           perform bdc_field       using 'BDC_OKCODE' 'KOMG-MATNR(01)'.
           perform bdc_field       using 'BDC_OKCODE' '=P+'.
           PERFORM bdc_dynpro      USING 'SAPMV13A' '1363'.
           CNT = 1.
         ENDIF.
        cnt = 1.
        LOOP AT it_item WHERE werks EQ it_new-werks AND lifnr EQ it_new-lifnr . "FROM x TO x.
          CONCATENATE 'KOMG-MATNR(' cnt ')' INTO fld.
          PERFORM bdc_field USING fld it_item-matnr.
          CONCATENATE 'KONP-KBETR(' cnt')' INTO fld.
          PERFORM bdc_field USING fld it_item-kbetr.
          CONCATENATE 'RV13A-DATAB(' cnt ')' INTO fld.
          PERFORM bdc_field USING fld it_item-datab.
          CONCATENATE 'RV13A-DATBI(' cnt ')' INTO fld.
          PERFORM bdc_field USING fld it_item-datbi.
          CONCATENATE 'KONP-MWSK1(' cnt ')' INTO fld.
          PERFORM bdc_field USING fld it_item-mwsk1.
          cnt = cnt + 1.
          if cnt = 20.
            perform bdc_field       using 'BDC_OKCODE' 'KOMG-MATNR(19)'.
            perform bdc_field       using 'BDC_OKCODE' '=P+'.
            PERFORM bdc_dynpro      USING 'SAPMV13A' '1363'.
            CNT = 1.
           endif.
    CLEAR it_item.
        ENDLOOP.
       ENDDO.
        PERFORM bdc_dynpro      USING 'SAPMV13A' '1363'.
        PERFORM bdc_field       USING 'BDC_CURSOR'
                                      'KONP-MWSK1(01)'.
        PERFORM bdc_field       USING 'BDC_OKCODE'
                                      '=SICH'.
        CALL TRANSACTION 'FV11' USING bdcdata MODE 'A'
                                            UPDATE 'S'
                                           MESSAGES  INTO it_msgtab.
        CLEAR bdcdata[].
        PERFORM error.
      ENDLOOP.
           Start new screen   -Subroutine     for screen s                                      *
    FORM bdc_dynpro USING program dynpro.
      CLEAR bdcdata.
      bdcdata-program  = program.
      bdcdata-dynpro   = dynpro.
      bdcdata-dynbegin = 'X'.
      APPEND bdcdata.
    ENDFORM.                    "BDC_DYNPRO
           Insert field        -Subroutine   for field s                                         *
    FORM bdc_field USING fnam fval.
      CLEAR bdcdata.
      bdcdata-fnam = fnam.
      bdcdata-fval = fval.
      APPEND bdcdata.
    ENDFORM.                    "BDC_FIELD
    *&      Form  file_selection
    FORM file_selection .
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = 'P_FILE1'
        IMPORTING
          file_name     = p_file1.
    ENDFORM.                    " file_selection
    *&      Form  data_upload
    FORM data_upload .
      CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
       EXPORTING
        I_FIELD_SEPERATOR        =
           i_line_header            =  'X'
           i_tab_raw_data           =  it_raw
           i_filename               =  p_file1
         TABLES
           i_tab_converted_data     = record
        EXCEPTIONS
           conversion_failed        = 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.
    ENDFORM.                    " data_upload
    *&      Form  error
    FORM error .
      LOOP AT it_msgtab.
        IF it_msgtab-msgtyp = 'E'.
          SELECT SINGLE * FROM t100 WHERE sprsl = it_msgtab-msgspra
                                    AND   arbgb = it_msgtab-msgid
                                    AND   msgnr = it_msgtab-msgnr.
          IF sy-subrc = 0.
            l_mstring = t100-text.
            IF l_mstring CS '&1'.
              REPLACE '&1' WITH it_msgtab-msgv1 INTO l_mstring.
              REPLACE '&2' WITH it_msgtab-msgv2 INTO l_mstring.
              REPLACE '&3' WITH it_msgtab-msgv3 INTO l_mstring.
              REPLACE '&4' WITH it_msgtab-msgv4 INTO l_mstring.
            ELSE.
              REPLACE '&' WITH it_msgtab-msgv1 INTO l_mstring.
              REPLACE '&' WITH it_msgtab-msgv2 INTO l_mstring.
              REPLACE '&' WITH it_msgtab-msgv3 INTO l_mstring.
              REPLACE '&' WITH it_msgtab-msgv4 INTO l_mstring.
            ENDIF.
            CONDENSE l_mstring.
            it_mess-msgtyp = it_msgtab-msgtyp.
            it_mess-lms = l_mstring.
            it_mess-msgv1 = it_msgtab-msgv1.
            APPEND it_mess.
           WRITE: / it_msgtab-msgtyp, l_mstring(150).
          ELSE.
           WRITE: / it_msgtab.
            it_mess-msgtyp = it_msgtab-msgtyp.
            it_mess-lms = l_mstring.
            it_mess-msgv1 = it_msgtab-msgv1.
            APPEND it_mess.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " error
    *&      Form  table_Control
    FORM table_control .
    SORT record BY lifnr matnr.
      LOOP AT record.
        ON CHANGE OF record-lifnr.
          MOVE-CORRESPONDING record TO it_new.
          APPEND it_new.
        ENDON.
        MOVE-CORRESPONDING record TO it_item.
        APPEND it_item.
      ENDLOOP.
    ENDFORM.                    " table_Control
    Reward if useful
    Thanks
    Jagadeesh.G

  • ADF: want to add multiple instance of .jsff page in af:region dynamically

    Hi,
    I am having following requirement.
    We have one .jsff page, and we want to add multiple instance of this fragment page in <af:region> at runtime.
    Basically our requirement is anyhow we want to add multiple panel which is having many other child component at run time.
    Your suggestion will be very helpful.
    Regards,
    Deepak Parmar

    Vinod,
    Hmm.. only option left is i should add component at run time. but i am facing following issue...
    I am trying to add child component into RichPanelStretchLayout object at runtime, but getFacetCount() and getFacet() method of RichPanelStretchLayout is returning 0 and null respectively.
    can you please suggest me how can i add child component into RichPanelStretchLayout object?, i have directly added component using getChildered.add() method. but it wont work as i must need one facet object ( either START,BOTTOM or CENTER).
    Regards,
    Deepak

  • I want to insert the line under each row except last one

    Hi,
    How to test it is the last row in the Rich:datalist component?
    I want to add the line under each row except the last one.

    <x:someUIDataTag binding="#{someBean.someUIDataProperty}" value="#{someBean.someList}">
        <x:someUIColumnTag>
            <x:someUIOutputTag rendered="#{someBean.someUIDataProperty.rowIndex + 1 != someBean.someListSize}" />
        </x:someUIColumnTag>
    </x:someUIDataTag>

  • I am putting together a slide show using iphoto and I wanted to add a description on each slide/photo. How can I do that? Also on the choice of music for the silde show, if the slide show is longer than one song can you chose a different song for backgrou

    I am putting together a slide show using iphoto and I wanted to add a description on each slide/photo. How can I do that? Also on the choice of music for the silde show, if the slide show is longer than one song can you chose a different song for background music?

    This might help
    http://www.apple.com/findouthow/photos/#slideshow
    Regards
    TD

  • I want to add another ipod, but under a different account and user name can i do this and how?

    I want to add another ipod under my exticting I tunes. But want to set it up as a different account and user. Is this possible and how?

    The easiest way is set up a new user profile on your PC. Then copy the iTunes folder to the public folder and from there copy it to the iTunes folder in the new user profile.
    (this way you can use music in both accounts, even if you bought it from Apple - it needs to be DRM free though, so older stuff might be protected)

  • I want to add new songs to my ipod.  When I set it up with itunes years ago I had a different computer that I no longer have.  Now it will not let me add new songs to my ipod shuffle without erasing everything that is already on it.  Help!!!

    I want to add new songs to my ipod.  When I set it up with itunes years ago I had a different computer that I no longer have.  Now it will not let me add new songs to my ipod shuffle without erasing everything that is already on it.  Help!!!  Is there any way around this?

    Yes, I was aware of this but the phrase "Any items imported from audio CDs or acquired from other sources will not copy from your device to the iTunes library." is what worries me.  Will this eliminate my Notes, Calendar Events, etc or will it apply mostly just to the music?

  • I have a column in a Numbers document that currently only contains a number--the numbers are different in different columns.  Before each number I want to add the words "Pack Qty."  How would I do this?

    I have a column in a Numbers document that currently contains a number and that number is different in different columns.  I want to add the words "Pack Qty" before each number in the column.  How do I do that?  I'm using Numbers '09 on a brand new Macbook Pro.  Thanks!

    In an adjacent column add the formula:
    ="Pack Qty: "&<CELL>
    where <CELL> is the cell in the same row where the quantity is,
    Like:
    E2="Pack Qty: "&D2
    select, and hold,  the little circle at the bottom right corner of the selction, then drag down

  • How can i do with labview program,when i have 20 different values,and 1 want to add it with constant value.and how to get the results?

    how can i do with labview program,when i have   20 different values,and 1 want to add it with constant value.and how to get the results?

    Why do the 20 values have to be different? The same code should work even if some are equal.
    What do you mean by "get the result"? The result is available at the output terminal and all you need is a wire to get it where you need it. That could be an indicator, another operation, or even a hardware device.
    What is the data type of the 20 values? An array? A cluster? A bunch of scalars? A waveform? Dynamic data?
    LabVIEW Champion . Do more with less code and in less time .

  • TS1382 I want to add multiples of the same song from different playlists to my ipod but iTunes wont let me. How can I override this so that I get the songs I want on my ipod?

    I want to add multiples of the same song from different playlists to my ipod but iTunes wont let me. How can I override this so that I get the songs I want on my ipod?

    You can sync those different playlists to the iPod, and the song appears on each playlist.  However, the song is stored on the iPod once.  What is the practical reason for wanting to store the same song file multiple times (and waste storage space) on the iPod?

  • HT4436 I have 2 I phone which is using same apple id to back to icloud and restore it. I want to use different id on the one phone what can I do or change the id?

    I have 2 I phone which is using same apple id to back to icloud and restore it. I want to use different id on the one phone what can I do or change the id?

    Welcome to the Apple community.
    In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add a new account by tapping the "create Apple ID" button. (Settings > iCloud, scroll down and hit "Delete Account")

  • Can you add different songs to different slides while making a slideshow

    Can I change music on individual slides while making a slideshows

    You mean javascript, right? That's not Java.
    You cannot apply such things to a table.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "nyran20" <[email protected]> wrote in
    message
    news:ek33hv$g3k$[email protected]..
    > Hi all. Can someone tell me if you can add different
    states to an html
    > table?
    > I am using a table as a nav bar now, but I want to make
    it more fun by
    > adding
    > an over state. I feel that FW doesn't offer some of the
    simplicities that
    > a
    > regular HTML table does. I have the states (in java)
    made in FW, how do I
    > apply them to my existing html table?
    >

  • Can I have 2 itunes accounts on one computer, one for me and one for my wife.  We want to synchronize different content to our iPhones.

    Can I have 2 itunes accounts on one computer, one for me and one for my wife.  We want to synchronize different content to our iPhones.

    HELLO EVERYONE,
    WELL I HAVE TWO ACCOUNTS TOO... ONE FOR MY BROTHER AND ONE FOR ME...
    THIS IS WHAT YOU WILL HAVE TO DO..
    EVERYTIME YOU OR YOUR WIFE LOG ON TO ITUNES YOU WILL HAVE TO GO TO THE TOP LEFT AND AT THE TOP IT WILL SAY STORE..
    YOU WILL HIT LOG OUT AND LOG OUT OF YOURS..
    THEN GO TO THE SAME PLACE AGAIN AND HIT LOG IN AND THAT SHOULD HOPEFULLY HELP..
    ANYTIME YOU HAVE A QUESTION JUST GO TO MY PAGE AND ASK ME[:
    THANKS,
    BK[:

  • I own 2 ipods an ipod nano series 4 and ipod series 6 I want to store different tunmes on each ipod, but when I try to sync the series 4 with I tunes I get a message that says there is not enough space on my device.  How do I achieve what I want?

    O wn 2 iPod nanos series 4 and series 6 I want to sync different music on each iPod but I get the message when trying to sync the series 4 that there is too much data for the sync to take place.  It seems both iPods have the same name, so I guess I have to rename one, how do I do this?
    Or is there another solution
    Any help appreiated
    Wighill 13

    It would be useful to you if they had a different name, but the computer knows they are different. Create separate sync playlists for each device and go to the Music tab when it is connected and specify which playlist should be used for the sync.

  • I want to dispaly different colours in my report out put

    hii..
    am having 12 columns..i want to display different colors for every row.
    plz any one tell me the answere

    Hi,
    Kindly have a look into http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a559ee09411d2acb90000e829fbfe/frameset.htm link for formatted related information..
    In BEx Analyzer it is not possible to have 12 different colors.. for each column..
    In WEB with the help of JavaScript this should be possible..
    Regards,
    Vinay

Maybe you are looking for