custom jtable copy command?

Discussion in 'Java' started by tiewknvc9, Nov 28, 2005.

  1. tiewknvc9

    tiewknvc9 Guest

    Hi.

    I am trying to implement a custom behavior on the copy command on
    jtable.

    Basically I force the entire row to be selected when a user is working
    with myJtable. I feel this is a good design because it allows the user
    to quickly see what they are working with, without a doubt.

    However I would like to customize the copy command on the jtable
    because some of the items in the row are images, which I would not like
    to allow the user to copy (it gets converted into text, and it looks
    ugly!).

    What I would like to do is have the copy command ignore the columns
    with the images in them, and only copy the textual columns. Im not
    sure how to go about doing this, does anyone have any insight for me?

    Thanks!
     
    tiewknvc9, Nov 28, 2005
    #1
    1. Advertising

  2. tiewknvc9

    oulan bator Guest

    Hi,

    jtable store its actions in "ActionMap", copy is called "copy" (I
    think so, you can check it easily in a debugguer), then :
    1- write your own action

    Action a = " your action"
    jtable.getActionMap().put("copy",a);


    and that's all ...


    BR
     
    oulan bator, Nov 28, 2005
    #2
    1. Advertising

  3. tiewknvc9

    zero Guest

    "tiewknvc9" <> wrote in news:1133191665.983414.267130
    @g47g2000cwa.googlegroups.com:

    > Hi.
    >
    > I am trying to implement a custom behavior on the copy command on
    > jtable.
    >
    > Basically I force the entire row to be selected when a user is working
    > with myJtable. I feel this is a good design because it allows the user
    > to quickly see what they are working with, without a doubt.
    >
    > However I would like to customize the copy command on the jtable
    > because some of the items in the row are images, which I would not like
    > to allow the user to copy (it gets converted into text, and it looks
    > ugly!).
    >
    > What I would like to do is have the copy command ignore the columns
    > with the images in them, and only copy the textual columns. Im not
    > sure how to go about doing this, does anyone have any insight for me?
    >
    > Thanks!
    >
    >


    How about something like this

    for(int i = 0; i < numColumns; i++)
    {
    Class colClass = table.getColumnClass(i);
    if(colClass.getName().contains("Image")
    continue;
    // else
    // copy the data
    }

    There may be a better way to code this, but the basic idea is just to get
    the type of each column, and then act accordingly.

    --
    Beware the False Authority Syndrome
     
    zero, Nov 28, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tivo Escobar
    Replies:
    1
    Views:
    7,420
    manusa
    Apr 12, 2007
  2. Alex
    Replies:
    2
    Views:
    1,254
  3. Tintin92
    Replies:
    1
    Views:
    1,752
    Andrew Thompson
    Feb 14, 2007
  4. Replies:
    26
    Views:
    2,140
    Roland Pibinger
    Sep 1, 2006
  5. Haircuts Are Important
    Replies:
    3
    Views:
    355
    Haircuts Are Important
    Jun 4, 2013
Loading...

Share This Page