Package java.awt.datatransfer

Examples of java.awt.datatransfer.StringSelection


    this.source = source;
  }

  public void cut() {
    selection = source.getSelectedText();
    StringSelection clipString = new StringSelection(selection);
    clipbd.setContents(clipString, clipString);
    source.replaceSelection("");
    /* updateMenu(); */
  }
 
View Full Code Here


    /* updateMenu(); */
  }

  public void copy() {
    selection = source.getSelectedText();
    StringSelection clipString = new StringSelection(selection);
    clipbd.setContents(clipString, clipString);
    /* updateMenu(); */
  }
 
View Full Code Here

  }
 
  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 (options[i].equals(obj)) {
                        result = i;
                    }
                }
                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);
                }
            }
View Full Code Here

    }
  }

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

    reset();
  }

  @Override
  protected Transferable createTransferable(JComponent c) {
    return new StringSelection(exportString(type.cast(c)));
  }
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

    }

    void copyToClipBoard() {
        Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
        try {
            StringSelection content = new StringSelection(jtaExportArea.getText());
            if (content != null) {
                c.setContents(content, content);
            }
        } catch (Exception ex) {
            LogX.log(Level.WARNING, "Error accessing clipboard", ex, true);
View Full Code Here

                    String content = doc.getText(start, end);
                    doc.remove(start, end);

                    // Copy the deleted portion of text into the system clipboard
                    Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
                    cb.setContents(new StringSelection(content), null);
                } catch (BadLocationException e1) {
                    e1.printStackTrace();
                }
            }
        });
View Full Code Here

        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        clipboard.setContents(createClipboardContent(content), null);
    }

    public Transferable createClipboardContent(String content) {
        return new StringSelection(content);
    }
View Full Code Here

TOP

Related Classes of java.awt.datatransfer.StringSelection

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.