Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4201563

Can only get Plain Text or Unicode String data flavours from native clipboard

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: dbT83986 Date: 01/07/99


      OS: 95 and NT

      Using the following code suggests that JDK1.2 provides trransferable support for RTF and HTML formats:

      FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap();
      Map map = flavorMap.getFlavorsForNatives(null);
      Set keys = map.keySet();
      Iterator keysIterator = keys.iterator();
      while(keysIterator.hasNext())
      {
      Object key = keysIterator.next();
      Object value = map.get(key);
      System.out.println("Key: '" + key + "'; Value: '" + value + "'");
      }


      However I seem unable to transfer HTML or RTF data from the native clipboard (I've pasted data from FrontPage and Word 97 into the clipboard). I've used the following code to establish what data flavours are available:

      public void actionPerformed(ActionEvent e)
      {
      if(e.getSource() == pasteB)
      {
      Transferable clipboardData = clipboard.getContents(this);
      String text = null;
      try
      {
      DataFlavor[] flavors = clipboardData.getTransferDataFlavors();
      for(int i = 0; i < flavors.length; i++)
      {
      String mime = flavors[i].getMimeType();
      String name = flavors[i].getHumanPresentableName();
      System.out.println("Mime: '" + mime + "'; Name: '" + name + "'");
      }
      text = (String)(clipboardData.getTransferData(DataFlavor.stringFlavor));
      }
      catch(Exception ex)
      {
      text = ex.toString();
      }
      textArea.append("\n" + text);
      }
      }

      The printout when I run the above indicates that only Plain Text and Unicode String types are available.

      Thanks,

      --Jonathan Allin
      (Review ID: 49003)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dmendenhsunw David Mendenhall (Inactive)
              Reporter:
              dblairsunw Dave Blair (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: