Examples of JEditorPane


Examples of javax.swing.JEditorPane

                "  * Hardware Architecture: " + System.getProperty("os.arch") + "\n\n" +
            "We are sorry for the trouble and thanks for reporting problems with JabRef!\n";
           
            System.out.println(errorMessage);
           
            JEditorPane pane = new JEditorPane("text/html",
                "<html>The following error occurred while running JabRef:<p><font color=\"red\">" +
                exceptionToString(e.getCause()).replaceAll("\\n", "<br>") +
                "</font></p>" +
                "<p>Please first check if this problem and a solution is already known. Find our...</p>" +
                "<ul><li>...FAQ at <b>http://jabref.sf.net/faq.php</b> and our..." +
                "<li>...user mailing-list at <b>http://sf.net/mailarchive/forum.php?forum_name=jabref-users</b></ul>" +
                "If you do not find a solution there, please let us know about the problem by writing a bug report.<br>" +
                "You can find our bug tracker at <b>http://sourceforge.net/tracker/?atid=600306&group_id=92314</b>.<br>"  +
                "<ul><li>If the bug has already been reported there, please add your comments to the existing bug.<br>" +
                "<li>If the bug has not been reported yet, then we need the complete error message given above<br>" +
                "and a description of what you did before the error occured.</ul>" +
                "We also need the following information (you can copy and paste all this):</p>" +
                "<ul><li>Java Version: " + javaVersion +
                "<li>Java Vendor: " + javaVendor + 
                "<li>Operating System: " + System.getProperty("os.name") + " (" + System.getProperty("os.version") + ")" +
                "<li>Hardware Architecture: " + System.getProperty("os.arch") + "</ul>" +
                "We are sorry for the trouble and thanks for reporting problems with JabRef!</html>");
            pane.setEditable(false);
            pane.setOpaque(false);
            pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
           
            Component componentToDisplay;
            if (pane.getPreferredSize().getHeight() > 700){
                JScrollPane sPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
                sPane.setBorder(BorderFactory.createEmptyBorder());
                sPane.setPreferredSize(new Dimension((int)pane.getPreferredSize().getWidth() + 30, 700));
                componentToDisplay = sPane;
            } else {
                componentToDisplay = pane;
            }
           
            JOptionPane.showMessageDialog(null, componentToDisplay, "An error occurred while running JabRef", JOptionPane.ERROR_MESSAGE);
        } catch (SecurityException e) {
            System.out.println("ERROR: You are running JabRef in a sandboxed"
                + " environment that does not allow it to be started.");
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            System.out
                .println("This error should not happen."
                    + " Write an email to the JabRef developers and tell them 'NoSuchMethodException in JabRefMain'");
        } catch (ClassNotFoundException e) {
            System.out
                .println("This error should not happen."
                    + " Write an email to the JabRef developers and tell them 'ClassNotFoundException in JabRefMain'");
        } catch (IllegalArgumentException e) {
            System.out
                .println("This error should not happen."
                    + " Write an email to the JabRef developers and tell them 'IllegalArgumentException in JabRefMain'");
        } catch (IllegalAccessException e) {
            System.out
                .println("This error should not happen."
                    + " Write an email to the JabRef developers and tell them 'IllegalAccessException in JabRefMain'");
        } catch (UnsupportedClassVersionError e){
           
            String errorMessage =
                exceptionToString(e) + "\n" +
                "This means that your Java version (" + javaVersion + ") is not high enough to run JabRef.\n" +
                    "Please update your Java Runtime Environment to a version 1.5 or higher.\n";
           
            System.out.println(errorMessage);
           
            JEditorPane pane = new JEditorPane("text/html",
                "<html>You are using Java version " + javaVersion + ", but JabRef needs version 1.5 or higher." +
                "<p>Please update your Java Runtime Environment.</p>" +
                "<p>For more information visit <b>http://jabref.sf.net/faq.php</b>.</p></html>");
            pane.setEditable(false);
            pane.setOpaque(false);
            pane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
           
            JOptionPane.showMessageDialog(null, pane, "Insufficient Java Version Installed", JOptionPane.ERROR_MESSAGE);
        }
    }
View Full Code Here

Examples of javax.swing.JEditorPane

  /**
   *
   */
  public String convert(String srcText)
  {
    JEditorPane editorPane = new JEditorPane("text/rtf", srcText);
    editorPane.setEditable(false);

    List elements = new ArrayList();

    Document document = editorPane.getDocument();

    Element root = document.getDefaultRootElement();
    if (root != null)
    {
      addElements(elements, root);
View Full Code Here

Examples of javax.swing.JEditorPane

    String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT);
    String scaleType = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_SCALE_TYPE);
    String horizontalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HORIZONTAL_ALIGN);
    String verticalAlignment = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_VERTICAL_ALIGN);
   
    JEditorPane editorPane = new JEditorPane();
    editorPane.setContentType("text/html");
   
    editorPane.setText(htmlContent);
    editorPane.setBorder(null);
    editorPane.setSize(editorPane.getPreferredSize());

    JRBasePrintImage printImage = new JRBasePrintImage(element.getDefaultStyleProvider());
        printImage.setX(element.getX());
        printImage.setY(element.getY());
        printImage.setWidth(element.getWidth());
View Full Code Here

Examples of javax.swing.JEditorPane

  }

  public JRPrintImage createImageFromComponentElement(JRComponentElement componentElement) throws JRException {
    HtmlComponent html = (HtmlComponent) componentElement.getComponent();
   
    JEditorPane editorPane = new JEditorPane();
    editorPane.setContentType("text/html");
   
    String htmlContent = "";
   
    if (html.getHtmlContentExpression() != null) {
      htmlContent = JRExpressionUtil.getExpressionText(html.getHtmlContentExpression());
    }
   
    editorPane.setText(htmlContent);
    editorPane.setBorder(null);
    editorPane.setSize(editorPane.getPreferredSize());
   
    JRBasePrintImage printImage = new JRBasePrintImage(componentElement.getDefaultStyleProvider());
    printImage.setX(componentElement.getX());
        printImage.setY(componentElement.getY());
        printImage.setWidth(componentElement.getWidth());
View Full Code Here

Examples of javax.swing.JEditorPane

        return printImage;
  }

  public Dimension getComputedSize(JRGenericPrintElement element) {
    String htmlContent = (String) element.getParameterValue(HtmlPrintElement.PARAMETER_HTML_CONTENT);
    JEditorPane editorPane = new JEditorPane();
    editorPane.setContentType("text/html");
    editorPane.setText(htmlContent);
    editorPane.setBorder(null);
    return editorPane.getPreferredSize();
  }
View Full Code Here

Examples of javax.swing.JEditorPane

    private void initialize(String help) {
        this.setLayout(new GridBagLayout());
        interfacePanel = new JPanel(new GridBagLayout());
        if (help != null) {
            HTMLEditorKit hek = new HTMLEditorKit();
            helpPanel = new JEditorPane();
            helpPanel.setEditable(false);
            helpPanel.setEditorKit(hek);
            try {
                InputStream helpStream = getHelp(help);
                if (helpStream != null) {
View Full Code Here

Examples of javax.swing.JEditorPane

        Switchboard.InfoBox.setBackground(Color.decode("#EEEEDD"));
        Switchboard.InfoBox.setText("search window initialized");
        Switchboard.InfoBox.setFont(font.deriveFont((float) 11.0));
       
        // make the scroll pane that contains the search result
        JComponent mainText = new JEditorPane();
        mainText.setPreferredSize(new java.awt.Dimension(480, 590));
        String infotext =
            "This is a very early test for a YaCy GUI.\n\n" +
            "The YaCy administration interface is in your browser\n" +
            "just open http://localhost:8090\n\n" +
            "You may also enter a search term and press enter,\n" +
View Full Code Here

Examples of javax.swing.JEditorPane

  public void showAboutDialog() {
    String messageFormat = this.preferences.getLocalizedString(HomePane.class, "about.message");
    String aboutVersion = this.controller.getVersion();
    String message = String.format(messageFormat, aboutVersion, System.getProperty("java.version"));
    // Use an uneditable editor pane to let user select text in dialog
    JEditorPane messagePane = new JEditorPane("text/html", message);
    messagePane.setOpaque(false);
    messagePane.setEditable(false);
    try {
      // Lookup the javax.jnlp.BasicService object
      final BasicService service = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
      // If basic service supports  web browser
      if (service.isWebBrowserSupported()) {
        // Add a listener that displays hyperlinks content in browser
        messagePane.addHyperlinkListener(new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent ev) {
            if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              service.showDocument(ev.getURL());
            }
          }
View Full Code Here

Examples of javax.swing.JEditorPane

        public void removeUpdate(DocumentEvent ev) {
          changedUpdate(ev);
        }
      });
   
    this.helpEditorPane = new JEditorPane();
    this.helpEditorPane.setBorder(null);
    this.helpEditorPane.setEditable(false);
    this.helpEditorPane.setContentType("text/html");
    this.helpEditorPane.putClientProperty(JEditorPane.W3C_LENGTH_UNITS, Boolean.TRUE);
    this.helpEditorPane.setHighlighter(new DefaultHighlighter());
View Full Code Here

Examples of javax.swing.JEditorPane

       JScrollPane treeView = new JScrollPane(tree);
       treeView.setPreferredSize
           new Dimension( leftWidth, windowHeight ));

       // Build right-side view
       JEditorPane htmlPane = new JEditorPane("text/html","");
       htmlPane.setEditable(false);
       JScrollPane htmlView = new JScrollPane(htmlPane);
       htmlView.setPreferredSize(
           new Dimension( rightWidth, windowHeight ));

       // Build split-pane view
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.