How can I give different Editors in the same column for the jTable?

I am having a JTable with 2 columns and 10 rows. In the 2nd column, for the first 2 rows
I need to show JCheckBox, for nect 2 JComboBox and for remaining JTextField as the editor.
How can I do this. Thanks in Advance.

Remember, the parent class of a cell renderer does NOT have to be a Component itself. Most do simply because the end result of the getCellRenderer call is the component itself.
Create 3 cell renderers, one based off of the checkbox, one based off the combobox, one based off of Object. The Object based one will hold instances of the other two renderers and will be the actual renderer supplied to the JTable. When called, based on the row, it will forward the call to the to the appropriate renderer and return the result of the call.
Technically, the internal components do not NEED to be renderers themselves, but doing so makes it a lot easier to test them independently of the combined renderer.

Similar Messages

  • ALV  List  in the same Column for the row  CELL  i need button or value

    Hi,
    In my ALV list  for the same column I need Button or  Value for the different rows (CELL) depending upon my condition.
    as well as I have to make  read only of 3 rd column CELL based on my first column dropdown value CELL for this Row Only.
    Depends upon the value in  column 1 /  row 2   I have to  read only  the CELL of   column 5 / row 2   ie for the same row.
    Depends upon the value in Column 1/ row 3    I have to   EDITABLE  or   Button   the CELL  of column 5 / row 3 ie for the same row
    How to do the logic for this.
    I tried and got it for the entire column only.
    But my requirement is for the sepecific cell in the column.
    Kindly help to proceed further.
    Thanks in advance.
    Dav

    Here is how you can make a particular cell in the row read-only based on certain conditions.
    In my example I am displaying the flight details in an ALV. Here I am checking the airline id and if it is "AA' I am making the cell in the column airline id as readonly. In my example I am putting a check and readonly on the same column. However you can do this for different columns as well.
    In order to achieve this you need to add a new context attribute 'READONLY' of type abap_bool to the context node which is bound to data node of ALV.
    The method where I populate the node has the following code to populate the data.
      data: lr_input_node type ref to if_wd_context_node,
            lr_flight_node type ref to if_wd_context_node,
            lv_cityfrom   type s_from_cit,
            lv_cityto     type s_to_city,
            ls_from       type bapisfldst,
            ls_to         type bapisfldst,
            lt_flights    type table of bapisfldat,
            ls_flights    type bapisfldat.
      data: lt_final type if_mainview=>elements_node_flighttab,
            ls_final type if_mainview=>element_node_flighttab.
    * Instantiate the variable lr_input_note to the node NODE_FLIGHT
      lr_input_node  = wd_context->get_child_node( name = 'NODE_FLIGHT' ).
    * Instantiate the variable lr_flight_note to the node NODE_FLIGHTTAB
      lr_flight_node = wd_context->get_child_node( name = 'NODE_FLIGHTTAB' )
    * Get the attributes CityFrom und CityTo
      lr_input_node->get_attribute( exporting name = 'CITYFROM'
                                    importing value = lv_cityfrom ).
      lr_input_node->get_attribute( exporting name = 'CITYTO'
                                    importing value = lv_cityto ).
    * Fill the stuctures ls_from and ls_to
      ls_from-city = lv_cityfrom.
      ls_to-city   = lv_cityto.
    * Call the function BAPI_FLIGHT_GETLIST
      call function 'BAPI_FLIGHT_GETLIST'
       exporting
         destination_from       = ls_from
         destination_to         = ls_to
       tables
         flight_list            = lt_flights.
    Now I am going to check if the airline id is 'AA' and based on that I will fill the readonly context attribute.
    loop at lt_flights into ls_flights.
        MOVE-CORRESPONDING ls_flights to ls_final.
        if ls_flights-airlineid = 'AA'.
          ls_final-readonly = abap_true.
        else.
          ls_final-readonly = abap_false.
        endif.
        append ls_final to  lt_final.
      endloop.
    Finally bind the data to the context node.
    * Bind the data to the node NODE_FLIGHTTAB
      lr_flight_node->bind_elements( lt_final ).
    Now you need to do the ALV configuration settings.
    * create an instance of ALV component
      DATA:
        lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage.
      lr_salv_wd_table_usage = wd_this->wd_cpuse_alv( ).
      IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
        lr_salv_wd_table_usage->create_component( ).
      ENDIF.
    * get ALV component
      DATA:
        lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
      lr_salv_wd_table = wd_this->wd_cpifc_alv( ).
      wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
      CALL METHOD wd_this->alv_config_table->if_salv_wd_table_settings~set_read_only
        EXPORTING
          VALUE  = ABAP_FALSE
    * set visible row count
      DATA:
        lr_table_settings TYPE REF TO if_salv_wd_table_settings.
      lr_table_settings ?= wd_this->alv_config_table.
      lr_table_settings->set_visible_row_count( '10' ).
      DATA:
        lr_column_settings TYPE REF TO if_salv_wd_column_settings,
        lr_column          TYPE REF TO cl_salv_wd_column.
      lr_column_settings ?= wd_this->alv_config_table.
      DATA: lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
      lr_column = lr_column_settings->get_column( 'AIRLINEID' ).
      CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'AIRLINEID'.
      lr_column->set_cell_editor( lr_input_field ).
      lr_input_field->set_read_only_fieldname( value = 'READONLY' ).
      CALL METHOD lr_column_settings->delete_column
        EXPORTING
          id     = 'READONLY'

  • How can I download a purchased ringtone so that it appears in the sounds column for the alarm clock sound

    How can I download a purchased ringtone so that it appears in the sounds column for the alarm clock sound

    Welcome to the Apple Community Elizabeth.
    You should be able to access any book you have purchased from iTunes anywhere.
    Do you have settings > iBooks > Show all purchases turned on.

  • When I copy/paste a paragraph from a PDF doc, it pastes with no spaces between words. How can I fix this? I've searched everywhere for the solution but didn't find anyone had this issue.

    When I copy/paste a paragraph from a PDF doc (onto Facebook status bar, for example) it pastes with no spaces between words.  I.e: "The manhadajugofcoolwaterand offeredmeadrink." How can I fix this? I've searched everywhere for the solution but didn't find anyone had this issue. I'm new to Apple so any help will be much appreciated. Thanks!

    I can't speak about this occurring with FaceBook since I don't use FaceBook, but I see the same type of thing when I copy and pasted from websites. It doesn't always happen and I cannot find any particular set of circumstances under which it occurs or does not occur.
    I am merely responding to let you know that it happens to me as well and I have seen no way to correct it. I'm not so sure that there is a way to correct in in that it may have something to do with how the original text is formatted in the PDF or on the website and how it eventually "fits" into the text field or the area in which it is pasted.

  • Premiere CS4 - How can you import QuickTime (.mov) videos and which settings for the sequence?

    Premiere CS4
    How can you import QuickTime (.mov) videos and which settings for the sequence?
    Please reply in plain English or if possible in German
    Greetings from Vienna, Peter

    I have not installed Quicktime.
    I got a few scenes (.mov) from a Canon Eos 70d.
    I want to create a short film (in Premiere CS4) with these scenes, mixed with photos and MP3 music.

  • Can we create two dashboard prompts for the same column in the samepage

    hi ,
    can we create two dashboard prompts for the same column on the same page,
    I have a date column and I am trying to create 2 dashboard prompts on the same page one as from date and the other one as to date.Is this possible to create.When I am trying to create it is giving me error like cannot use same column for creating the prompt
    Any suggestions or ideas

    863997 wrote:
    hi ,
    can we create two dashboard prompts for the same column on the same page,
    I have a date column and I am trying to create 2 dashboard prompts on the same page one as from date and the other one as to date.Is this possible to create.When I am trying to create it is giving me error like cannot use same column for creating the prompt
    Any suggestions or ideasYou are correct. You cannot build two prompts on the same column. Use this link for instructions on how to build a "between prompt" because of this fact:
    http://oraclebizint.wordpress.com/2008/02/26/oracle-bi-ee-101332-between-prompts-for-date-columns-using-presentation-variables/

  • HT4245 can somebody tell me what to do with my iMessage in Ipad 2? before i can send message tru iMessage from my contacts who is having the same applications, for the existing one, i can send message but if i want to send message from a new contact, not

    can somebody tell me what to do with my iMessage in Ipad 2? before i can send message tru iMessage from my contacts who is having the same applications, for the existing one, i can send message but if i want to send message from a new contact, its not working....

    Please Rephrase your query.

  • Messenger classic: how can I give different colors to the conversati​on

    In my old bold messenger I had different colors for the received messages (light blue) and the sent messages (white) of the chat. Now they are both on white. How can I change that? 
    Thanks

    This is probably possible in the "conversation" mode that you can activate in the messages options (hit the blackberry menu key when in the messages window).
    There, you can also assign different colors to each account.
    Hope this helps
    Please don't forget to mark as "solved" if your question is replied and to "like" a useful reply to your post ;-)

  • Loading the different result sets in the same sequence for the target table

    Dear all,
    I have 5 tables say A,B,C,D as my source and i made 3 joins P,Q,R .the result sets of these 3 joins are loading into a target table X but with 3 different targets with same table name.
    I created one sequence say Y as my target table has primary key and mapped to three different targets for the same target table which i need to load.
    But after deployed and executed successfully ,i am able to load the data from three join result sets with differeent sequence numbers.
    I am looking to load data like this.
    If First Result set P has 10 Records,SEcond Result Set Q Has 20 and the third result set has 30 records then while loading data into first target it creates the seq for the 10 records from 1..10 and while loading the data for second result set ,it creates the sequence from 11 ...20 and while loading the third target with the third result set it creates the sequence from 21 ----30.
    But i am looking to load the three result sets in the sequence 1to 10 but not like creating fresh sequence for each result set.
    how can we achieve this in owb?
    any solution for this will be appreciated.
    thank you
    kumar

    My design is like following
    SRC1
    ---->Join1--------------------------->Target1( Table X)<-----Seq1
    SRC2
    SRC3
    ----> Join2----------->Target2(Table X)<----Seq1
    SRC4
    -----> Join3 -------> Target3(Table X)<-----Seq1
    SRC5
    Here the three 3 targets are for the same Table X as well sequence is same i.e seq1
    If the First Join has 10 rows ,Seq1 generates sequence in 1 to 10 while loading target1
    But while loading second target,Same Seq1 is generating new sequence from 11 but i am looking to load target2 and target 3 starting from sequence 1 but not from 11 or so.
    As per your comments :
    you want to load 3 sources to one target with same sequence numbers?
    yes
    Are you doing match from the other two sources on first source by id provided by sequence (since this is the primary key of the table)?
    No
    can you please tell me how to approach for this?
    Thank You
    Kumar

  • How to display 2 lines in the same column header of jTable?

    Please could you help me to display 2 character lines in the same column header of a JTable?
    And how to make a fusion between to cells?
    Thank you very much

    In Swing, most components will accept text in the html format
    http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
    You can then use <br> tags to make your header text multiline

  • Can I customize the standard columns for the search results (list view) specifically?

    When searching for emails I would like to adjust the columns in the search results list view, e.g. add the sender's address. This I would like to save as standard columns specifically for the search results list view, since in other contexts I do not need it. However, I can only set standard columns for existing folders, not for the context of "search results".

    re :When searching for emails
    what method are you using?
    Are you talking about 'Quick filter' or 'Global Search' or via 'Edit' > 'Find' > 'Search Messages' ?
    '''If you used the Global Search:'''
    Typed in a word: eg: Birthday and selected 'Messages mentioning birthday'
    Then a search is returned in a new tab.
    You click on 'open email as list' - to open in a new tab.
    Is this the search results list view that you are refering to?
    the default columns should be:
    From, Subject, Date, Location
    If you only want to see eg: From and Date
    click on the icon 'select columns to display' located to far right of header column name.
    deselect Subject and Location
    next time you run a global search then only those columns appear in the 'open email as list' view.
    '''If via 'Edit' > 'Find' > 'Search Messages' ?'''
    enter search parameters and click on 'Search'
    Is this the search results list view that you are refering to?
    the default columns should be:
    From, Subject, Date, Location
    Subject and Location cannot be edited.
    Other column headers can be selected in the same way using the far right 'Select columns to display' icon.
    Any column headers you select will not be remembered if you close and later peform another search.
    If you click on 'Save as Search folder'
    This will create a folder in your Folder Pane and you can select column(s) you wish to display.
    Any Column headers you choose to display are selected for that saved search folder.
    The column headers only change if you select to reset defaults on that folder or from another folder you select to apply to other folders for either the search folder or all folders in the account.
    '''If using Quick Filter:'''
    The QuickFilter type of search is done on the folder that is selected.
    You are still in the same folder, it has simply ''filtered'' what it is displaying, so it will obviously still display the same column headers.

  • If I bought Pages for my Mac, I have to buy the same application for the ipad

    I bought the application Pages for my iMac, I have to buy the same application for y Ipad also?

    Yes, the Mac Pages app is different than the iOS Pages app.
    Once you purchase Pages for iPad you can then use it on all your iOS devices (iPhone, iPod) but not on your Mac and vice versa.

  • Sharing the same JTableHeader for several JTables

    Hello,
    I would like to know if it is possible to have a JTableHeader common to several JTables.
    For instance the resizing of a column in the common header should resize the corresponding column for all the JTables.
    Thanks for your help !
    Joel

    Except there's a bug introduced in 1.4x (1.3 works fine) that disables resizing of the columns in all the tables except the last into which the shared columnModel is set.
    To workaround, subclass JTable and override columnMarginChanged:
        JTable table = new JTable()
        // including the following will fix the bug
          public void columnMarginChanged(ChangeEvent e) {
            if (isEditing()) {
              removeEditor();
            TableColumn resizingColumn = null;
            if (tableHeader != null) {
              resizingColumn = tableHeader.getResizingColumn();
            if (resizingColumn != null) {
              if (autoResizeMode == AUTO_RESIZE_OFF) {
                resizingColumn.setPreferredWidth(resizingColumn.getWidth());
              } else {    // this else block is missing in jdk1.4 as compared to 1.3
                doLayout();
                repaint();
                return;
            resizeAndRepaint();
          private int viewIndexForColumn(TableColumn aColumn) {
            TableColumnModel cm = getColumnModel();
            for (int column = 0; column < cm.getColumnCount(); column++) {
              if (cm.getColumn(column) == aColumn) {
                return column;
            return -1;
        };Greetings
    Jeanette

  • How can I specify different settings in CustomSettings.ini based on the OS that is being deployed?

    I originally thought this could be achieved using "OSVersion" or "OSCurrentVersion" but (unless I'm mistaken) those variables are in fact tied to the OS from witch you actually launch the MDT Wizard right? i.e. say I run MDT from within
    Windows PE to deploy Windows 8. The "OSVersion" and "OSCurrentVersion" will contain values for the Windows PE instance that is currently running MDT and not the Windows 8 OS I am actually deploying right? Assuming that is the case then
    is there some variable in MDT that stores version information about the OS you are currently deploying? If so can I use that in CustomSettings.ini to specify different settings for specific OSes I deploy?

    Rens,
    First thanks for responding. Next please don't take my response the wrong way but this is a bit of a pet peeve of mine. Maybe I'm just "doing it wrong" but I have used the TaskSequenceID trick in the past and thats actually where my problem lies.
    Too many people are recommending this course of action without including the caveats. Your response implies that using TaskSequenceID is as simple as just adding "TaskSequenceID" to priority and then creating entries based on the TSIDs themselves.
    In reality getting this to work is far more challenging. One needs to only check the following threads (and several others) for the issues other people are having when they try to use TaskSequenceID in CustomSettings.ini:
    http://social.technet.microsoft.com/Forums/en-US/e17a1952-d1f7-41ef-8231-0d6fcc41882e/mdt-2012-settings-per-task-sequence?forum=mdt#f0810428-e6fd-468e-8c76-ca18b210c191
    http://social.technet.microsoft.com/Forums/en-US/320aafee-07d2-4b96-9138-a902fec7edf5/mdt-2012-custom-rules-by-tasksequenceid-not-working-now
    In fact, following the steps outlined here was the *only* way I was able to get TaskSequenceID to work for me:
    http://www.the-d-spot.org/wordpress/2012/07/20/how-to-use-different-settings-per-task-sequence-with-mdt-2012/
    Even then its causing some erratic issues in some areas like button lag in the Wizard because ZTIGather has to run twice and pre-checked Applications in the wizard still installing even if they are unchecked. Since my needs are more OS-specific (as opposed
    to Task Sequence specific) I was hoping for a better solution. I suppose I can check BDD.log but I was hoping someone here had already encounter this same issue and hit upon a solution they could share. 
    Anyone?

  • How can i find different piano options, pianos that fill up the screen not just a small piano?

    So when i first bought my mac i messed around with garageband and i pulled up all of these painos and synthisizers and the piano would cover about half of the screen. Well now i'm in college and i need to know pitches for my music courses and thought this would help me but i cant find the "big" pianos anymore just the small one for recording. please help me

    The "big" piano is called "Musical Typing": You launch from the "Windows" menu:
         Windows > Musical Typing ⇧⌘ K
    Regards
    Léonie

Maybe you are looking for

  • ITunes 6.0.1 is a pain...

    I Dont feel like reading all the posts here so link me around. Doesn't anyone else have problems w/iTunes 6.0.1 or just 6.0? I can listen to my music fine but, if i quit which sometimes I do, when I goto open it again it messes up and goes real slow.

  • ITunes and iPhon will not sync....

    I just bought a new computer using Windows7. I installed iTunes and plugged in my iPhone4. When I check Library in iTunes all of my Apps, Music and Books are there. I downloaded a few new apps tonight in iTunes but when I Sync the do not got to my Ph

  • Poor image quality when displaying OLE Word object in PDF

    MS Word 2007 OLE object in Crystal Reports XII R2 designer...looks OK in designer.  When we export to PDF, the image quality has been degraded significantly.  Anybody had this issue before?  tried replacing usp10.dll with one found in CommonFiles fol

  • Current Document Metadata insertion into Current Document

    Help!!  I need to place 'current document' metadata (not a placed photo, for instance) into the current document.  I have been able to place the "File Name" into the current file and that works great.  But I want to now place current file metadata, l

  • PROBLEM IN T-CODE- MMSC

    DEAR CONS For a particular material & plant for using T-code- mmsc the error message " plant does not have a main. status DL".MESSAGE NO-M3260. Actually we want to create A RESERVATION of movement type-411. at that time system gives a message that "n