Package java.awt.datatransfer

Examples of java.awt.datatransfer.Clipboard


  public void toClipboardButton_clicked() {
    try {
      Flame currFlame = getCurrFlame();
      if (currFlame != null) {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        String xml = new FlameWriter().getFlameXML(currFlame);
        StringSelection data = new StringSelection(xml);
        clipboard.setContents(data, data);
      }
    }
    catch (Throwable ex) {
      errorHandler.handleError(ex);
    }
View Full Code Here


  }

  public void loadFlameFromClipboardButton_clicked() {
    List<Flame> newFlames = null;
    try {
      Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
      Transferable clipData = clipboard.getContents(clipboard);
      if (clipData != null) {
        if (clipData.isDataFlavorSupported(DataFlavor.stringFlavor)) {
          String xml = (String) (clipData.getTransferData(
              DataFlavor.stringFlavor));
          newFlames = new FlameReader(prefs).readFlamesfromXML(xml);
View Full Code Here

                              ((InvocationTargetException) e).getTargetException() : e));
          // e.printStackTrace();
        } finally {
          if (clipboard == null) {
            System.err.println("Applet: copy & paste only within the JTA");
            clipboard = new Clipboard("de.mud.jta.Main");
          }
        }

        if ((new Boolean(options.getProperty("Applet.detach.immediately"))
                .booleanValue())) {
View Full Code Here

    try {
      clipboard = frame.getToolkit().getSystemClipboard();
    } catch (Exception e) {
      System.err.println("jta: system clipboard access denied");
      System.err.println("jta: copy & paste only within the JTA");
      clipboard = new Clipboard("de.mud.jta.Main");
    }

    // configure the application and load all plugins
    final Common setup = new Common(options);
View Full Code Here

    } else {
      myMenu.copy.setEnabled(false);
      myMenu.cut.setEnabled(false);
      myMenu.delete.setEnabled(false);
    }
    Clipboard clipbd = getToolkit().getSystemClipboard();
    if (clipbd.getContents(this) != null)
      myMenu.insert.setEnabled(true);
    else
      myMenu.insert.setEnabled(false);
  }
View Full Code Here

    setLocationRelativeTo(app.getMainComponent());
  }
 
  private void exportToClipboard(int type) throws IOException {
    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Clipboard clipboard = toolkit.getSystemClipboard();
    StringSelection stringSelection = null;
   
    switch (type) {
    case TYPE_HTMLCLIPBOARD:
      stringSelection = new StringSelection(getHTML(null));
      break;
     
    case TYPE_MEDIAWIKI:
      stringSelection = new StringSelection(getMediaWiki());
      break;
     
    case TYPE_GOOGLEGADGET:
      stringSelection = new StringSelection(getGoogleGadget());
    break;
    }
   
    clipboard.setContents(stringSelection, null);

  }
View Full Code Here

                    }
                }
                if (result == 0) {
                    StringSelection stringSelection = new StringSelection("FTB Launcher logs:\n" + Logger.getLogs()
                            + "[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "]" + " Logs copied to clipboard");
                    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
                    clipboard.setContents(stringSelection, null);
                }
            }
        });
        panel.add(clipboard);
View Full Code Here

    }
    return sb.toString();
  }

  public static String getClipboardText () {
    Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();

    try {
      return (String)cb.getData(DataFlavor.stringFlavor);
    }
    catch (UnsupportedFlavorException e) {
      return null;
    }
    catch (java.io.IOException e) {
View Full Code Here

      return null;
    }
  }

  public static void setClipboardText (String s) {
    Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
    StringSelection ss = new StringSelection(s);
    cb.setContents(ss, ss);
  }
View Full Code Here

            }
        }.start();
    }

    private void pasteToClipboard(StatementGeneratorResult result) {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        clipboard.setContents(new StringSelection(result.getStatement()), null);
        MessageUtil.showInfoMessage("SQL statement exported to clipboard.", "Statement extracted");
    }
View Full Code Here

TOP

Related Classes of java.awt.datatransfer.Clipboard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.