예제 #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);
  }
  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);
  }
 @Override
 public void exportToClipboard(JComponent comp, Clipboard clip, int action) {
   // default implementation is OK
   super.exportToClipboard(comp, clip, action);
 }
 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);
 }
 @Override
 public void exportToClipboard(JComponent comp, Clipboard clip, int action)
     throws IllegalStateException {
   // TODO Auto-generated method stub
   super.exportToClipboard(comp, clip, action);
 }