コード例 #1
0
  /** action handler function for copying a legend into clip board */
  public void exportToClipBoard() {
    BufferedImage img;
    try {
      img = MapTools.getLegendAsImage(appContainer.getMapModel(null), true);
    } catch (Exception e) {
      LOG.logError(e.getMessage(), e);
      return;
    }

    final JLabel label = new JLabel(new ImageIcon(img));
    label.setTransferHandler(new ImageSelection());

    // use both clip boards for text?
    Clipboard clip = getDefaultToolkit().getSystemSelection();
    if (clip != null) {
      TransferHandler handler = label.getTransferHandler();
      handler.exportToClipboard(label, clip, TransferHandler.COPY);
    }
    clip = getDefaultToolkit().getSystemClipboard();
    TransferHandler handler = label.getTransferHandler();
    handler.exportToClipboard(label, clip, TransferHandler.COPY);
  }
コード例 #2
0
  public static void ImageToClipBoard(Image i) {

    final Clipboard clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();

    JLabel l = new JLabel("");

    l.setIcon(new ImageIcon(i));

    l.setTransferHandler(new ImageSelection());

    if (clipboard == null) {
      System.out.print("\ncb is null");
    }

    TransferHandler handler = l.getTransferHandler();

    if (handler == null) {
      System.out.print("\thc is null");
    }

    handler.exportToClipboard(l, clipboard, TransferHandler.COPY);
  }
コード例 #3
0
 @Override
 public void exportToClipboard(JComponent comp, Clipboard clip, int action) {
   // default implementation is OK
   super.exportToClipboard(comp, clip, action);
 }
コード例 #4
0
 public void exportToClipboard(JComponent comp, Clipboard clip, int action)
     throws IllegalStateException {
   super.exportToClipboard(comp, clip, action);
 }
コード例 #5
0
 @Override
 public void exportToClipboard(JComponent comp, Clipboard clip, int action)
     throws IllegalStateException {
   mTextHandler.exportToClipboard(comp, clip, action);
 }
コード例 #6
0
 @Override
 public void exportToClipboard(JComponent comp, Clipboard clip, int action) {
   super.exportToClipboard(comp, clip, action);
 }
コード例 #7
0
 @Override
 public void exportToClipboard(JComponent comp, Clipboard clip, int action)
     throws IllegalStateException {
   // TODO Auto-generated method stub
   super.exportToClipboard(comp, clip, action);
 }