Java Code Examples for javax.swing.JEditorPane#setEditable()

The following examples show how to use javax.swing.JEditorPane#setEditable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ObjectivePanel.java    From triplea with GNU General Public License v3.0 6 votes vote down vote up
EditorPaneCellEditor() {
  super(new JTextField());
  final JEditorPane textArea = new JEditorPane();
  textArea.setEditable(false);
  textArea.setContentType("text/html");
  final JScrollPane scrollPane = new JScrollPane(textArea);
  scrollPane.setBorder(null);
  editorComponent = scrollPane;
  delegate =
      new DefaultCellEditor.EditorDelegate() {
        private static final long serialVersionUID = 5746645959173385516L;

        @Override
        public void setValue(final Object value) {
          textArea.setText((value != null) ? value.toString() : "");
        }

        @Override
        public Object getCellEditorValue() {
          return textArea.getText();
        }
      };
}
 
Example 2
Source File: HelpDialog.java    From Briss-2.0 with GNU General Public License v3.0 6 votes vote down vote up
public HelpDialog(final Frame owner, final String title, final Dialog.ModalityType modalityType) {
    super(owner, title, modalityType);
    setBounds(232, 232, 500, 800);

    String helpText = "";

    InputStream is = getClass().getResourceAsStream(HELP_FILE_PATH);
    byte[] buf = new byte[1024 * 100];
    try {
        int cnt = is.read(buf);
        helpText = new String(buf, 0, cnt);
    } catch (IOException e) {
        helpText = "Couldn't read the help file... Please contact [email protected]";
    }

    JEditorPane jEditorPane = new JEditorPane("text/html", helpText);
    jEditorPane.setEditable(false);
    jEditorPane.setVisible(true);

    JScrollPane scroller = new JScrollPane(jEditorPane);
    getContentPane().add(scroller);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setVisible(true);
}
 
Example 3
Source File: GenericTagPanel.java    From jpexs-decompiler with GNU General Public License v3.0 6 votes vote down vote up
public GenericTagPanel(MainPanel mainPanel) {
    super(new BorderLayout());

    this.mainPanel = mainPanel;
    hdr = new HeaderLabel("");
    add(hdr, BorderLayout.NORTH);
    genericTagPropertiesEditorPane = new JEditorPane() {
        @Override
        public boolean getScrollableTracksViewportWidth() {
            return true;
        }
    };
    genericTagPropertiesEditorPane.setEditable(false);
    genericTagPropertiesEditorPaneScrollPanel = new JScrollPane(genericTagPropertiesEditorPane);
    add(genericTagPropertiesEditorPaneScrollPanel, BorderLayout.CENTER);

    genericTagPropertiesEditPanel = new JPanel();
    genericTagPropertiesEditPanel.setLayout(new SpringLayout());
    JPanel edPanel = new JPanel(new BorderLayout());
    edPanel.add(genericTagPropertiesEditPanel, BorderLayout.NORTH);
    genericTagPropertiesEditPanelScrollPanel = new JScrollPane(edPanel);
}
 
Example 4
Source File: InflateReader.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
	JDialog dlg = new JDialog(((Main) PacketSamurai.getUserInterface()).getMainFrame(), "Text");
	dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
	dlg.setSize(350, 400);
	dlg.setLocationRelativeTo(((Main) PacketSamurai.getUserInterface()).getMainFrame());

	JEditorPane sourceDisplay = new JEditorPane();
	sourceDisplay.setEditable(false);
	sourceDisplay.setContentType("text/plain");
	sourceDisplay.setText(_xml);

	dlg.add(new JScrollPane(sourceDisplay));
	dlg.setVisible(true);
}
 
Example 5
Source File: FoldView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public JComponent getToolTip(double x, double y, Shape allocation) {
    Container container = getContainer();
    if (container instanceof JEditorPane) {
        JEditorPane editorPane = (JEditorPane) getContainer();
        JEditorPane tooltipPane = new JEditorPane();
        EditorKit kit = editorPane.getEditorKit();
        Document doc = getDocument();
        if (kit != null && doc != null) {
            Element lineRootElement = doc.getDefaultRootElement();
            tooltipPane.putClientProperty(FoldViewFactory.DISPLAY_ALL_FOLDS_EXPANDED_PROPERTY, true);
            try {
                // Start-offset of the fold => line start => position
                int lineIndex = lineRootElement.getElementIndex(fold.getStartOffset());
                Position pos = doc.createPosition(
                        lineRootElement.getElement(lineIndex).getStartOffset());
                // DocumentView.START_POSITION_PROPERTY
                tooltipPane.putClientProperty("document-view-start-position", pos); // NOI18N
                // End-offset of the fold => line end => position
                lineIndex = lineRootElement.getElementIndex(fold.getEndOffset());
                pos = doc.createPosition(lineRootElement.getElement(lineIndex).getEndOffset());
                // DocumentView.END_POSITION_PROPERTY
                tooltipPane.putClientProperty("document-view-end-position", pos); // NOI18N
                tooltipPane.putClientProperty("document-view-accurate-span", true); // NOI18N
                // Set the same kit and document
                tooltipPane.setEditorKit(kit);
                tooltipPane.setDocument(doc);
                tooltipPane.setEditable(false);
                return new FoldToolTip(editorPane, tooltipPane, getBorderColor());
            } catch (BadLocationException e) {
                // => return null
            }
        }
    }
    return null;
}
 
Example 6
Source File: HelpCompononent.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
public HelpCompononent() {
	pane = new JEditorPane();
	pane.setContentType("text/html");
	setLayout(new BorderLayout());
	pane.setEditable(false);
	add(new JScrollPane(pane),BorderLayout.CENTER);
}
 
Example 7
Source File: JEditorPaneBrowser.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
public JEditorPaneBrowser() {
	setLayout(new BorderLayout());
	browse = new JEditorPane() ;
	browse.setContentType("text/html");
	HTMLEditorKit kit = new HTMLEditorKit();
	browse.setEditorKit(kit);
	browse.setEditable(false);
	add(browse,BorderLayout.CENTER);
	client = URLTools.newClient();
	
}
 
Example 8
Source File: CommonHelpDialog.java    From megamek with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a help dialog for the given <code>parentFrame</code> by reading
 * from the indicated <code>File</code>.
 */
public CommonHelpDialog(JFrame parentFrame, File helpfile) {
    super(parentFrame);

    setLayout(new BorderLayout());
    JEditorPane helpPane = new JEditorPane();
    helpPane.setEditable(false);

    // Get the help content file if possible
    try {
        helpPane.setPage(helpfile.toURI().toURL());
        setTitle(Messages.getString("CommonHelpDialog.helpFile") + helpfile.getName()); //$NON-NLS-1$
    } catch (Exception exc) {
        helpPane.setText(Messages.getString("CommonHelpDialog.errorReading") //$NON-NLS-1$
                + exc.getMessage());
        setTitle(Messages.getString("CommonHelpDialog.noHelp.title")); //$NON-NLS-1$
        exc.printStackTrace();
    }

    // Close Button
    JButton butClose = new ButtonEsc(new CloseAction(this));

    // Add all to the dialog
    getContentPane().add(new JScrollPane(helpPane), BorderLayout.CENTER);
    getContentPane().add(butClose, BorderLayout.SOUTH);
    
    // Make the window half the screensize and center on screen
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
    Dimension windowSize = new Dimension(gd.getDisplayMode().getWidth() / 2,
            gd.getDisplayMode().getHeight() / 2);
    pack();
    setSize(windowSize);
    setLocationRelativeTo(null);
}
 
Example 9
Source File: MainGui.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Allow to display a modal dialog with an html content.
 *
 * @param htmlStr the HTML string
 */
public void displayMessage (String htmlStr)
{
    JEditorPane htmlPane = new JEditorPane("text/html", htmlStr);
    htmlPane.setEditable(false);
    JOptionPane.showMessageDialog(
            frame,
            htmlPane,
            appName,
            JOptionPane.INFORMATION_MESSAGE);
}
 
Example 10
Source File: Help.java    From FancyBing with GNU General Public License v3.0 5 votes vote down vote up
public Help(URL contents, MessageDialogs messageDialogs,
            String title)
{
    m_messageDialogs = messageDialogs;
    m_contents = contents;
    Container contentPane;
    if (Platform.isMac())
    {
        JDialog dialog = new JDialog((Frame)null, title);
        contentPane = dialog.getContentPane();
        m_window = dialog;
    }
    else
    {
        JFrame frame = new JFrame(title);
        GuiUtil.setGoIcon(frame);
        contentPane = frame.getContentPane();
        m_window = frame;
    }
    JPanel panel = new JPanel(new BorderLayout());
    contentPane.add(panel);
    panel.add(createButtons(), BorderLayout.NORTH);
    m_editorPane = new JEditorPane();
    m_editorPane.setEditable(false);
    m_editorPane.addHyperlinkListener(this);
    int width = GuiUtil.getDefaultMonoFontSize() * 50;
    int height = GuiUtil.getDefaultMonoFontSize() * 60;
    JScrollPane scrollPane =
        new JScrollPane(m_editorPane,
                        JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                        JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    if (Platform.isMac())
        // Default Apple L&F uses no border, but Quaqua 3.7.4 does
        scrollPane.setBorder(null);
    scrollPane.setPreferredSize(new Dimension(width, height));
    panel.add(scrollPane, BorderLayout.CENTER);
    m_window.pack();
    loadURL(m_contents);
    appendHistory(m_contents);
}
 
Example 11
Source File: CodeChickenCorePlugin.java    From CodeChickenCore with MIT License 5 votes vote down vote up
public static void versionCheck(String reqVersion, String mod) {
    String mcVersion = (String) FMLInjectionData.data()[4];
    if (!VersionParser.parseRange(reqVersion).containsVersion(new DefaultArtifactVersion(mcVersion))) {
        String err = "This version of " + mod + " does not support minecraft version " + mcVersion;
        logger.error(err);

        JEditorPane ep = new JEditorPane("text/html",
                "<html>" +
                        err +
                        "<br>Remove it from your coremods folder and check <a href=\"http://www.minecraftforum.net/topic/909223-\">here</a> for updates" +
                        "</html>");

        ep.setEditable(false);
        ep.setOpaque(false);
        ep.addHyperlinkListener(new HyperlinkListener()
        {
            @Override
            public void hyperlinkUpdate(HyperlinkEvent event) {
                try {
                    if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
                        Desktop.getDesktop().browse(event.getURL().toURI());
                } catch (Exception ignored) {}
            }
        });

        JOptionPane.showMessageDialog(null, ep, "Fatal error", JOptionPane.ERROR_MESSAGE);
        System.exit(1);
    }
}
 
Example 12
Source File: XArrayDataViewer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static Component loadArray(Object value) {
    Component comp = null;
    if (isViewableValue(value)) {
        Object[] arr;
        if (value instanceof Collection) {
            arr = ((Collection<?>) value).toArray();
        } else if (value instanceof Map) {
            arr = ((Map<?,?>) value).entrySet().toArray();
        } else if (value instanceof Object[]) {
            arr = (Object[]) value;
        } else {
            int length = Array.getLength(value);
            arr = new Object[length];
            for (int i = 0; i < length; i++) {
                arr[i] = Array.get(value, i);
            }
        }
        JEditorPane arrayEditor = new JEditorPane();
        arrayEditor.setContentType("text/html");
        arrayEditor.setEditable(false);
        Color evenRowColor = arrayEditor.getBackground();
        int red = evenRowColor.getRed();
        int green = evenRowColor.getGreen();
        int blue = evenRowColor.getBlue();
        String evenRowColorStr =
                "rgb(" + red + "," + green + "," + blue + ")";
        Color oddRowColor = new Color(
                red < 20 ? red + 20 : red - 20,
                green < 20 ? green + 20 : green - 20,
                blue < 20 ? blue + 20 : blue - 20);
        String oddRowColorStr =
                "rgb(" + oddRowColor.getRed() + "," +
                oddRowColor.getGreen() + "," +
                oddRowColor.getBlue() + ")";
        Color foreground = arrayEditor.getForeground();
        String textColor = String.format("%06x",
                                         foreground.getRGB() & 0xFFFFFF);
        StringBuilder sb = new StringBuilder();
        sb.append("<html><body text=#"+textColor+"><table width=\"100%\">");
        for (int i = 0; i < arr.length; i++) {
            if (i % 2 == 0) {
                sb.append("<tr style=\"background-color: " +
                        evenRowColorStr + "\"><td><pre>" +
                        (arr[i] == null ?
                            arr[i] : htmlize(arr[i].toString())) +
                        "</pre></td></tr>");
            } else {
                sb.append("<tr style=\"background-color: " +
                        oddRowColorStr + "\"><td><pre>" +
                        (arr[i] == null ?
                            arr[i] : htmlize(arr[i].toString())) +
                        "</pre></td></tr>");
            }
        }
        if (arr.length == 0) {
            sb.append("<tr style=\"background-color: " +
                    evenRowColorStr + "\"><td></td></tr>");
        }
        sb.append("</table></body></html>");
        arrayEditor.setText(sb.toString());
        JScrollPane scrollp = new JScrollPane(arrayEditor);
        comp = scrollp;
    }
    return comp;
}
 
Example 13
Source File: SwingComponents.java    From triplea with GNU General Public License v3.0 4 votes vote down vote up
public static JEditorPane newHtmlJEditorPane() {
  final JEditorPane descriptionPane = new JEditorPane();
  descriptionPane.setEditable(false);
  descriptionPane.setContentType("text/html");
  return descriptionPane;
}
 
Example 14
Source File: EULADialog.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
private EULADialog(@Nullable Project project, @NotNull String title, @Nullable String eulaText, boolean isPlainText, OnEulaAccepted onAccept) {
    super(project);
    this.onAccept = onAccept;
    myEulaTextFound = eulaText != null;

    JComponent component;
    if (isPlainText) {
        JTextArea textArea = new JTextArea();
        textArea.setText(eulaText);
        textArea.setMinimumSize(null);
        textArea.setEditable(false);
        textArea.setCaretPosition(0);
        textArea.setBackground(null);
        textArea.setBorder(JBUI.Borders.empty());

        component = textArea;
    } else {
        JEditorPane editor = new JEditorPane();
        editor.setContentType("text/html");
        editor.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE); // work around <meta> tag
        editor.setText(eulaText);
        editor.setEditable(false);
        editor.setCaretPosition(0);
        editor.setMinimumSize(null);
        editor.setBorder(JBUI.Borders.empty());

        component = editor;
    }

    myScrollPane = new JBScrollPane(component);
    myScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    setModal(true);
    setTitle(title);

    setOKButtonText("Accept");
    getOKAction().putValue(DEFAULT_ACTION, null);

    setCancelButtonText("Decline");
    getCancelAction().putValue(DEFAULT_ACTION, Boolean.TRUE);

    init();
}
 
Example 15
Source File: HelpFrame.java    From RegexReplacer with MIT License 4 votes vote down vote up
private HelpFrame() {
	setTitle(StrUtils.getStr("HelpFrame.title"));
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	jtp = new JTabbedPane();
	try {
		JEditorPane regexPane = new JEditorPane(RegexReplacer.class
				.getClassLoader().getResource(
						StrUtils.getStr("html.JavaRegex")));
		regexPane.setEditable(false);
		// regexPane.addHyperlinkListener(new HyperlinkListener() {
		// @Override
		// public void hyperlinkUpdate(HyperlinkEvent e) {
		// if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
		// URL url = e.getURL();
		// try {
		// ((JEditorPane) e.getSource()).setPage(url);
		// } catch (IOException e1) {
		// e1.printStackTrace();
		// }
		// }
		// }
		// });
		jtp.addTab(regexHelp, new JScrollPane(regexPane));

		JEditorPane helpPane = new JEditorPane(RegexReplacer.class
				.getClassLoader().getResource(StrUtils.getStr("html.Help")));
		helpPane.setEditable(false);
		jtp.addTab(help, new JScrollPane(helpPane));
		JEditorPane functionsPane = new JEditorPane(RegexReplacer.class
				.getClassLoader().getResource(
						StrUtils.getStr("html.Functions")));
		functionsPane.setEditable(false);
		jtp.addTab(functionsHelp, new JScrollPane(functionsPane));
		JEditorPane newFunctionPane = new JEditorPane(RegexReplacer.class
				.getClassLoader().getResource(
						StrUtils.getStr("html.NewFunction")));
		newFunctionPane.setEditable(false);
		jtp.addTab(newFunctionHelp, new JScrollPane(newFunctionPane));
	} catch (IOException e) {
		e.printStackTrace();
	}
	add(jtp);
	setSize(700, 500);
	setLocationRelativeTo(null);
}
 
Example 16
Source File: TreeIconDemo.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public TreeIconDemo() {
    super(new GridLayout(1, 0));

    // Create the nodes.
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");
    createNodes(top);

    // Create a tree that allows one selection at a time.
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Set the icon for leaf nodes.
    ImageIcon leafIcon = createImageIcon("images/middle.gif");
    if (leafIcon != null) {
        DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
        renderer.setLeafIcon(leafIcon);
        tree.setCellRenderer(renderer);
    } else {
        System.err.println("Leaf icon missing; using default.");
    }

    // Listen for when the selection changes.
    tree.addTreeSelectionListener(this);

    // Create the scroll pane and add the tree to it.
    JScrollPane treeView = new JScrollPane(tree);

    // Create the HTML viewing pane.
    htmlPane = new JEditorPane();
    htmlPane.setEditable(false);
    initHelp();
    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Add the scroll panes to a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(treeView);
    splitPane.setBottomComponent(htmlView);

    Dimension minimumSize = new Dimension(100, 50);
    htmlView.setMinimumSize(minimumSize);
    treeView.setMinimumSize(minimumSize);
    splitPane.setDividerLocation(100); // XXX: ignored in some releases
                                       // of Swing. bug 4101306
    // workaround for bug 4101306:
    // treeView.setPreferredSize(new Dimension(100, 100));

    splitPane.setPreferredSize(new Dimension(500, 300));

    // Add the split pane to this panel.
    add(splitPane);
}
 
Example 17
Source File: TreeIconDemo2.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
public TreeIconDemo2() {
    super(new GridLayout(1, 0));

    // Create the nodes.
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");
    createNodes(top);

    // Create a tree that allows one selection at a time.
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    // Enable tool tips.
    ToolTipManager.sharedInstance().registerComponent(tree);

    // Set the icon for leaf nodes.
    ImageIcon tutorialIcon = createImageIcon("images/middle.gif");
    if (tutorialIcon != null) {
        tree.setCellRenderer(new MyRenderer(tutorialIcon));
    } else {
        System.err.println("Tutorial icon missing; using default.");
    }

    // Listen for when the selection changes.
    tree.addTreeSelectionListener(this);

    // Create the scroll pane and add the tree to it.
    JScrollPane treeView = new JScrollPane(tree);

    // Create the HTML viewing pane.
    htmlPane = new JEditorPane();
    htmlPane.setEditable(false);
    initHelp();
    JScrollPane htmlView = new JScrollPane(htmlPane);

    // Add the scroll panes to a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(treeView);
    splitPane.setBottomComponent(htmlView);

    Dimension minimumSize = new Dimension(100, 50);
    htmlView.setMinimumSize(minimumSize);
    treeView.setMinimumSize(minimumSize);
    splitPane.setDividerLocation(100); // XXX: ignored in some releases
                                       // of Swing. bug 4101306
    // workaround for bug 4101306:
    // treeView.setPreferredSize(new Dimension(100, 100));

    splitPane.setPreferredSize(new Dimension(500, 300));

    // Add the split pane to this panel.
    add(splitPane);
}
 
Example 18
Source File: XArrayDataViewer.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static Component loadArray(Object value) {
    Component comp = null;
    if (isViewableValue(value)) {
        Object[] arr;
        if (value instanceof Collection) {
            arr = ((Collection<?>) value).toArray();
        } else if (value instanceof Map) {
            arr = ((Map<?,?>) value).entrySet().toArray();
        } else if (value instanceof Object[]) {
            arr = (Object[]) value;
        } else {
            int length = Array.getLength(value);
            arr = new Object[length];
            for (int i = 0; i < length; i++) {
                arr[i] = Array.get(value, i);
            }
        }
        JEditorPane arrayEditor = new JEditorPane();
        arrayEditor.setContentType("text/html");
        arrayEditor.setEditable(false);
        Color evenRowColor = arrayEditor.getBackground();
        int red = evenRowColor.getRed();
        int green = evenRowColor.getGreen();
        int blue = evenRowColor.getBlue();
        String evenRowColorStr =
                "rgb(" + red + "," + green + "," + blue + ")";
        Color oddRowColor = new Color(
                red < 20 ? red + 20 : red - 20,
                green < 20 ? green + 20 : green - 20,
                blue < 20 ? blue + 20 : blue - 20);
        String oddRowColorStr =
                "rgb(" + oddRowColor.getRed() + "," +
                oddRowColor.getGreen() + "," +
                oddRowColor.getBlue() + ")";
        Color foreground = arrayEditor.getForeground();
        String textColor = String.format("%06x",
                                         foreground.getRGB() & 0xFFFFFF);
        StringBuilder sb = new StringBuilder();
        sb.append("<html><body text=#"+textColor+"><table width=\"100%\">");
        for (int i = 0; i < arr.length; i++) {
            if (i % 2 == 0) {
                sb.append("<tr style=\"background-color: " +
                        evenRowColorStr + "\"><td><pre>" +
                        (arr[i] == null ?
                            arr[i] : htmlize(arr[i].toString())) +
                        "</pre></td></tr>");
            } else {
                sb.append("<tr style=\"background-color: " +
                        oddRowColorStr + "\"><td><pre>" +
                        (arr[i] == null ?
                            arr[i] : htmlize(arr[i].toString())) +
                        "</pre></td></tr>");
            }
        }
        if (arr.length == 0) {
            sb.append("<tr style=\"background-color: " +
                    evenRowColorStr + "\"><td></td></tr>");
        }
        sb.append("</table></body></html>");
        arrayEditor.setText(sb.toString());
        JScrollPane scrollp = new JScrollPane(arrayEditor);
        comp = scrollp;
    }
    return comp;
}
 
Example 19
Source File: GUIUtils.java    From mzmine3 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add a new editorpane to a given component
 *
 * @param component Component to add the label to
 * @param text Label's text
 * @return Created EditorPane
 */
public static JEditorPane addEditorPane(String text) {
  JEditorPane result = new JEditorPane("text/html", text);
  result.setEditable(false);
  return result;
}
 
Example 20
Source File: PreviewMultiViewElement.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 *  Sets CloneableEditor instance not editable, according to component specification.
 *  CloneableEditor isn't working properly with MultiViewComponent and part of editor 
 *  functionality couldn't work, otherwise.
 */
public void setEditableDisabled() {
    JEditorPane prev = this.getEditorPane();
    prev.setEditable(false);
}