How to extend JTable's TransferHandler in 1.4.1?

Has anyone successfully extended a JTable's TransferHandler in 1.4.0 or 1.4.1beta?
Here is a simple working JTable DnD example but I need to be able to transfer data other than just strings (which is all that this example is designed to do) and the only way I can think of is to extend the TransferHandler (by default, in 1.4.1, JTable BasicTableUI has a TableTranserHandler class with a createTransferable method that is supposed to create a Transferable with various HTML tags but it doesn't seem to get called). I can't seem to do anything with the TransferHandler without clobbering the drag operation -- see bug report at the link shown below:
http://developer.java.sun.com/developer/bugParade/bugs/4514071.html
The bug shown above is supposedly fixed and closed but I think the problem still exists. I would appreciate anyone who can shed some light on this subject -- I've assign 5 dukes to this subject but if needed, I can assign more later.
;o)
V.V.
prog.java
=========
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import java.text.*;
public class AOKabc extends JApplet {
   static myMenu window;
   public void init() {
      initialize();
      window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
   public void stop() {
      window.dispose();
   public static void main(String[] args) {
      initialize();
      window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   private static void initialize() {
      window = new myMenu("AOKabc");
      window.setVisible(true);
   static class myMenu extends JFrame {
      JScrollPane scrollPane;
      public myTable myTbl;
      JFrame frame=new JFrame();
      JPanel panel=new JPanel(new BorderLayout());
      public myMenu(String title) {
         super(title);
         setSize(800,600);
         Container contentPane = getContentPane();
         myTbl=new myTable(800,600);
         scrollPane=new JScrollPane(myTbl);
         panel.add("Center",scrollPane);
         contentPane.add(panel,BorderLayout.CENTER);
}myTable.java
============
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.text.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
public class myTable extends JTable implements DropTargetListener {
   public static final int maxCol=26;
   public static final int maxRow=100;
   Object rowData[][]=new Object[maxRow][maxCol];
   Rectangle drawRect;
   private DropTarget dropTarget;
   myTable(int width, int height) {
      setPreferredScrollableViewportSize(new Dimension(width,height));
      TableModel TM=new AbstractTableModel() {
         public Object getValueAt(int row, int col) {
            if (rowData[row][col]==null) return "";
            return rowData[row][col];
         public int getColumnCount() {
            return maxCol;
         public int getRowCount() {
            return maxRow;
         public boolean isCellEditable(int row, int col) {
            return true;
         public void setValueAt(Object value, int row, int col) {
            rowData[row][col]=value;
            fireTableCellUpdated(row, col);
      setModel(TM);
      setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
      setCellSelectionEnabled(true);     // this basically turn off row selection highlighting
      getTableHeader().setReorderingAllowed(false);
      for (int i=0;i<maxCol;i++) getColumnModel().getColumn(i).setMinWidth(50);
      setDragEnabled(true);
/*** uncomment the next lines and the drag stops working (it won't work even if it's followed by a call to updateUI() ***/
//      setTransferHandler(new TransferHandler("Text"));
      dropTarget=new DropTarget(this,this);
   public void dropActionChanged(DropTargetDragEvent event) {}
   public void dragEnter(DropTargetDragEvent event) {}
   public void dragExit(DropTargetEvent event) {}
   public void dragOver(DropTargetDragEvent event) {}
   public void drop(DropTargetDropEvent event) {
      Transferable contents=event.getTransferable();
      if (contents!=null) {
         if (contents.isDataFlavorSupported(DataFlavor.stringFlavor)) {
            try {
               Point p=event.getLocation();
               int row=rowAtPoint(p);
               int col=columnAtPoint(p);
               String line=(String)contents.getTransferData(DataFlavor.stringFlavor);
               int start=0;
               int end=line.indexOf("\n");
               if (end<0) {
                  setValueAt(line,row,col);
                  return;
               String[] tmp;
               while (end<=line.length()) {
                  tmp=getStringArray(line.substring(start,end),'\t');
                  for (int j=0;j<tmp.length;j++) setValueAt(tmp[j],row,col+j);
                  row++;
                  start=end+1;
                  if (start>=line.length()) break;
                  end=line.substring(start).indexOf("\n");
                  if (end>=0) end+=start; else end=line.length();
            } catch (Throwable e) {
               e.printStackTrace();
   private String[] getStringArray(String inStr, char ctkn) {
      String[] x;
      if (inStr.length()==0) {
         x=new String[1];
         x[0]="";
         return x;
      int i=0;
      String tmp="";
      ArrayList AL=new ArrayList(20);
      while (i<inStr.length()) {
         if (inStr.charAt(i)==ctkn) {
            AL.add(new String(tmp));
            tmp="";
         } else tmp+=inStr.charAt(i);
         i++;
      AL.add(new String(tmp));
      x=new String[AL.size()];
      for (i=0;i<AL.size();i++) x=(String)AL.get(i);
return x;

Finally revisited this problem and found that it's a matter of putting the horse before the cart....i.e., TransferHandler has to be set before drag is enabled.
Consider ubject matter closed!
;o)
V.V.

Similar Messages

  • How To Extend Adobe Audition CS5.5

    I've received a number of questions on how to extend Adobe Audition with questions similar to:
    How do I import file format X?
    How do I import a project from application Y?
    Will there be an SDK available?
    How do I add plug-ins to Audition?
    I had made a post similar to this in the public beta of Audition for Mac, but I can no longer find the thread. So I'll reiterate some stuff here:
    Area
    Info
    Adding VST Plug-Ins
    Most of you have found this already, but the best place to start is in the Audio Plug-In Manager
    If you want to "write" new plug-ins for Audition, writing a VST plug-in will be the best option as it will allow you to write something that will work on Windows as well as OSX.  Info on writing a VST plug-in may be found here (http://www.steinberg.net/en/company/developer.html)
    Adding Audio Unit Plug-Ins (Mac OSX)
    Same as Above.   Note that OSX ships with some built-in AU plug-ins that Audition can utilize for free if you just scan at least once.   We don't scan on startup because there's several plug-ins out there in the world that don't behave well.  Info on Audio Unit plug-in development can be found here (http://developer.apple.com/library/mac/#documentation/MusicAudio/Conceptual/AudioUnitProgr ammingGuide/TheAudioUnit/TheAudioUnit.html)
    Adding more import formats via libsndfile
    libsndfile is an open-source C library for reading and writing audio files (http://www.mega-nerd.com/libsndfile/)   Ambitious people could download the source, write support for another format, and create their own custom-rolled library of libsndfile.  You would then replace the version of libsndfile with which Audition CS5.5 ships, with the one you rolled.   Due to the way we use libsndfile, any format you add would show up in Audition.   This is also true if there's an official update to libsndfile that comes out in the future, you could just plop it in and it should work. 
    If you're interested in exporting or writing formats that libnsdfile supports, please tell us which formats are the most important to you and in what way you use them in your workflow.
    Adding more import formats via QuickTime components
    QuickTime has the ability to be extended via QuickTime Components.   There's several examples out there, but here are some websites to check out:
    QuickTime Components (http://www.apple.com/quicktime/resources/components.html)
    Learn about even more QuickTime capabilities (http://www.apple.com/quicktime/extending/components.html)
    Flip4Mac for Windows Media support on OSX (http://www.telestream.net/flip4mac-wmv/overview.htm)
    Perian -- the swiss-army knife for QuickTime (http://perian.org/)
    Calibrated Software (http://www.calibratedsoftware.com/products.asp)
    In most cases, just adding the various QuickTime components will automatically add the import functionality to Audition.
    Importing project formats from other applications
    As seen on other threads in this forum, Ses2sesx (http://www.aatranslator.com.au/ses2sesx.html) and AATranslator (http://www.aatranslator.com.au/) seem to add quite a bit of support.
    SDK
    At this time, we haven't released an SDK for Audition.   If you're interested in one, however, please tell us what you would want from an SDK for Audition and we'll take it into consideration.
    Message was edited by: Charles VW
    Added links to AU and VST development info

    Charles,
    could you please also advise what PC users can do to make common avi files useable in AA CS5.5? The obvious problem is, no matter how many exotic video formats a PC can play by way of video-for-windows codecs, these are useless for Quicktime, because Quicktime on the PC needs codecs specifically written for "Quicktime for Windows", which are, as I've come to find, EXTREMELY rare. So far I've only found ONE, sold by 3ivx, but this costs as much as the AA CS5.5 update itself. Without them, Quicktime on the PC will only handle mov files, which are not too popular on the PC. Is there any other way out of this?

  • Hi i would like to know how to extend the range of my time capsule wifi network(500G 802.11n) using an airport express. i have a double storey home and would like to extend range to my upstairs bedrooms.i have a time capsules network setup via a netgear a

    hi i would like to know how to extend the range of my time capsule wifi network(500G 802.11n) using an airport express. i have a double storey home and would like to extend range to my upstairs bedrooms.i have a time capsules network setup via a netgear adsl.i have a second imac upstairs which connects to time capsule wifi network (it is within range as it is directly abobe on 1st floor)
    could you tell me how best to set airport express up to extend my wifi range?

    Greetings,
    This is called an "Extended wireless network".
    Read this article for details and steps on how to extend your TimeCapsule's network:
    http://support.apple.com/kb/HT4259
    Cheers.

  • How to extend an address of a BP  with more fields ???? EEWB??

    Hi Gurus,
    I need to extend the address of a BP with some customer fields. I have tried to do it using EEWB but when you have to choose a Business Object for the new extension, the reasonable only possibility is to choose BUPA Object. Thus, the DB table BUT000 is extended with a custom include that contains the customer fields, but what I want to do is extending ADRC DB table. There is some way that I do not know of achieve this in which the system creates automatically all the FM for the BDT events????
    If it is not possible, which would be the procedure to do that with my own development???
    Thanks in Advance.
    Regards,
    Rosa

    Rosa, you can only extend table BUP000 and not the actual address table. Sorry for that for more details on how to extend the BP itself refer to my WeBLOG I wrote on this. Have fun and let me know whether you need more help, Tiest.
    Also do not forget to award points to useful responses.
    <a href="/people/tiest.vangool/blog/2005/07/24/pc-ui-and-easy-enhancement-workbench-eew-integration and Easy Enhancement Workbench (EEW) Integration</a>

  • In an inbuild example of can .. that CAN transmit periodic vi .. i am unable to understand how the extended and standard frame is set?

    In an inbuild example of can .. that CAN transmit  periodic vi .. i am unable to understand how the extended and standard frame is set?
    plz help me .. stuck up very badly
    thanks
    mahadev
    Solved!
    Go to Solution.

    I suggest this KB which explains usage of Ext IDs with NI-CAN
    http://digital.ni.com/public.nsf/allkb/2FA120A37EDBC51D86256854004FB0C7

  • Outlook 2013 - How to extend/add new meeting in recurrent meeting inside SharePoint site ?

    I have created a recurrence meeting but now it is exired, how to extend ? Please advise

    Hi,
    Please check the link below
    https://support.office.com/en-us/article/Create-link-to-or-update-Meeting-Workspaces-98834566-4750-45e9-bb71-fe4acb26f170?ui=en-US&rs=en-US&ad=US#BM2
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/01054bef-1cb0-4401-88c9-e4593ab4b806/how-to-extend-date-in-recurring-meeting-workspace-in-sharepoint-site?forum=sharepointgenerallegacy
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • How to extend the range with a second Airport Express? Do I need a DSL cable?

    How to extend the range with a second Airport Express? Do I need a DSL cable?

    Thanks, now we need a bit more information, please, in order to provide you with the correct information that you need.
    I assume that you already have one AirPort Express.....either a model A1264 or A1392.....set up and operating OK, is that correct?
    If yes, you can extend the network either by using wireless or an Ethernet cable with a second AirPort Express.....either the A1264 or A1392 model. A wired connection is the way to go, if possible, since it provides better performance.  But, wireless might work OK for you if you want to try that.
    Let us know "how" you want to extend......wireless or wired?

  • How to extend business partner number length

    My legacy business partner id is 13 digits long. But SAP business partner is only 10 digits long at maximum.
    Please tell me how to extend this constraint?
    Giang

    Hi Giang,
    Unfortunately, this is not possible - you cannot extend the length of BP number.
    But there's a simpler way - there is a field called BPEXT in BUT000, this is the external BP number, and can store 20 digits.
    You can transfer the BP number of legacy system into BPEXT field on the SAP system. This is a standard practice and is used by most people.
    Regards,
    Rishu.

  • How to extend Article to Different Sales organization

    Hi experts
    How to extend Article to Different Sales organization
    thanks in advance

    Hi Hanumant,
    1. Go to MM42
    2. Enter the article to be extended.
    3. Enter the Sales Organization and Distribution Channel to which the article to be extended to.
    4. Select the Sales View.
    5. Press Enter
    Save
    It's Done.
    To verify, goto mm43 and enter the detail and check
    or
    after entering the article code in mm43 go to Sales Org. field and press F4, in the popup you will see a column 'Maint.' , X should be marked in front of your new sales org,dist channel combination.
    Hope it helps.
    Regards,
    Anirban Roy

  • When saving a page under text format, the text is limited to 80 columns only, how to extend to 120 columns

    When I save a page under text format, the text is limited to 80 columns only, how to extend to 120 columns (or more)?

    HI K,
    This is the Numbers (Mac OS) forum. Your question about Numbers for iOS will probably get better results posting in the iWork for iOS area. the link will take you there.
    Regards,
    Barry

  • How to extend same material into different plants?

    Hi all,
    how to extend the same material into different plants anybody please tell me.
    thanks
    s.muthu

    hi
    go to mm01 create a material with name abcd
    then again in mm01 in material filed give same no (abcd)and  in copy from field also give that no(abcd)
    sytem will ask u for from and t locations give that and proceed
    similarly if u want to extend view in the material go to mm50 and do
    reward if helpful
    regards
    kunal

  • How to extend factory calender to a plant ?

    Hi Ranga:
    How to extend factory calender to a plant ? ( Tcode: SCAL, The calender is not client specific)
    I check marked US factory calender, where after can you tell how to extend factory calender to plant
    Note: I am using IDES ( International Demonstration & Education System)
    Thanks

    Hi Sandeep,
    you need to use the following path
    Go to SPRO>ENTERPRISE STRUCTURE->DEFINITION> LOG GENERAL>DEFINE COPY,DELETE AND CHECK PLANT>DEFINE PLANT
    Here you need to assign the factory calendar. The assignment in work center will only applicable for capacity not for MRP and others.
    <b>For information how to create a factory calendar</b>
    Pl follow the steps
    1.Go to SCAL transaction
    2.there will be three options.
    Click first public holidays and go in change mode.
    Click create and create your holidays there and save.(Generally fixed date will be used in the pop up)
    3.Now click Holiday calendar and go in change mode.
    Click create and give holdiay cal id and description.
    Click assign public holiday and add your holidays one by one and save
    Now holiday cal is created.
    4.Now come out and choose fact calendar and go in change mode
    Click create and give Factory calendar id and description, and validity period.
    Give the holiday calendar ID.
    If you want to give special rule like any of the specific date/ day is the holiday or work day (which is different from holiday calendar you can define)
    and save.
    5.You have to assign factory calendar to PLANT
    Go to SPRO>ENTERPRISE STRUCTURE->DEFINITION> LOG GENERAL>DEFINE COPY,DELETE AND CHECK PLANT>DEFINE PLANT
    Choose your plant and go to details-
    You have to define factory calendar there
    Hope this will help you
    Regards
    Ranga

  • How to extend factory calendar

    Hi,
    We need to do extend our factory calendar before we
    update the time stream. Our factory calendar
    only up to year 2010.
    Kindly please advise how to extend the factory calendar?
    Thank you.

    Hi Harish,
    I try to change the "To Year" from 2010 to 2020, but there is an error message coming out and does not allowed me to change: "Please enter validity area between years 1998 - 2010".
    Kindly please advise. Thank you.

  • How to extend an existing network with airport

    How  Do you extend a wireless network using two airports?

    Please check out the following Apple Support article for details on how to extend a wireless network with multiple AirPort base stations.

  • How to extend an Bapi_po_change

    hi,
         How to extend bapi_po_change useing  extensionin and  extensionout.

    when i execute the program, the debugger is not stooping at the above mentioned exit.
    the below is the code.
    data: lt_poaccount like bapimepoaccount occurs 0 with header line,
          lt_poaccountx like bapimepoaccountx occurs 0 with header line,
          return type bapiret2 occurs 0 with header line,
          poitem like bapimepoitem occurs 0 with header line,
          poitemx like bapimepoitem occurs 0 with header line,
          extin like bapiparex occurs 0 with header line,
          extou like bapiparex occurs 0 with header line.
      poitem-po_item = '0010'.
      poitemx-po_item = '0010'.
      poitem-vendrbatch = 12322.
      poitemx-vendrbatch = 'X'.
      poitem-ematerial = 'TEST'.
      poitemx-ematerial = 'X'.
      poitem-grant_nbr = 'GRANT_NBR'.
      poitemx-grant_nbr = 'X'.
      poitem-no_more_gr = 'NO_MORE'.
      poitemx-no_more_gr = 'X'.
       append poitem.
       append poitemx.
       extin-structure = 'BAPI_TE_MEPOITEM'.
       extin-valuepart1 = 'EAN_UPC'.
       append extin.
      lt_poaccount-po_item = '0010'.
      lt_poaccountx-po_item = '0010'.
      lt_poaccount-serial_no = '0001'.
      lt_poaccountx-serial_no = '0001'.
      lt_poaccount-gr_rcpt = '176'.
      lt_poaccountx-gr_rcpt = 'X'.
        append lt_poaccount.
        append lt_poaccountx.
    data: po_num type ebeln.
    po_num = 7600000285.
    call function 'BAPI_PO_CHANGE'
      exporting
        purchaseorder = po_num
      tables
        return        = return
        poitem        = poitem
        poitemx       = poitemx
        poaccount     = lt_poaccount
        poaccountx    = lt_poaccountx
        extensionin   = extin
        extensionout  = extou
    if sy-subrc eq 0.
        call function 'BAPI_TRANSACTION_COMMIT'.
      endif.
    write :/ 'a'.

Maybe you are looking for

  • PCMCIA firewire card for G4 laptop (follow-up to excessive timecode breaks)

    1.) It was recommended that I get a new firewire bus to resolve excessive timecode breaks when importing from a Canon camcorder to an external hard drive. I've been reading through posts on this topic...and saw getting a new firewire port mentioned a

  • HT203167 How do I find music that disappeared after home sharing downloads.

    I try to play a song from my list, and get an exclamation point, and the message: "The song "We Wish You A Merry Christmas" could not be used because the original file could not be found. Would you like to locate it?"  I click LOCATE, and my finder c

  • Need to get MS explorer again

    most people seem to agree that Explorer was no good, but there is one place where it was superior to both firefox and safari- the saving options. you had a bunch of different options, allowing you to make save an archive of a site, several levels of

  • Create a Fancy Custom Control

    I'm trying to create a fancy Custom Control for processing Cell Counter images.  I want a Control that lets me select two image types, Fluorescent or DAB, and if I choose Fluorescent, will let me pick Red, Green, or Blue. I created two Radio Button c

  • BPS - sign and balance within planning cube

    Hi, does anyone have experience with planning using debit/credit characteristic and the SAP stand function "Automatic Sign Assignment"? We do have positive amounts for debit and credit in any case. The assignment of the sign we are realising using th