/** * Creates a new <code>DetailPanel</code> instance. * * @param aTable the table to listen for selections on * @param aModel the model backing the table */ DetailPanel(JTable aTable, final MyTableModel aModel) { mModel = aModel; setLayout(new BorderLayout()); setBorder(BorderFactory.createTitledBorder("Details: ")); mDetails = new JEditorPane(); mDetails.setEditable(false); mDetails.setContentType("text/html"); add(new JScrollPane(mDetails), BorderLayout.CENTER); final ListSelectionModel rowSM = aTable.getSelectionModel(); rowSM.addListSelectionListener(this); }
final JEditorPane editor = new JEditorPane(); editor.setEditorKit(JEditorPane.createEditorKitForContentType("text/html")); editor.setEditable(false);
componentEditor = new JEditorPane(); componentDetailsTab.setViewportView(componentEditor); highlightingEditor = new JEditorPane(); highlightingTab.setViewportView(highlightingEditor); symbolEditor = new JEditorPane(); symbolTab.setViewportView(symbolEditor); coverageEditor = new JEditorPane(); coverageTab.setViewportView(coverageEditor); duplicationEditor = new JEditorPane(); duplicationTab.setViewportView(duplicationEditor); testsEditor = new JEditorPane(); testsTab.setViewportView(testsEditor); issuesEditor = new JEditorPane(); issuesTab.setViewportView(issuesEditor); externalIssuesEditor = new JEditorPane(); externalIssuesTab.setViewportView(externalIssuesEditor); measuresEditor = new JEditorPane(); measuresTab.setViewportView(measuresEditor); scmEditor = new JEditorPane(); scmTab.setViewportView(scmEditor);
buttonCancel = new JButton(); JPanel panel3 = new JPanel(); txtDeckList = new JEditorPane(); JScrollPane txtScrollableDeckList = new JScrollPane(txtDeckList); panel3.add(txtScrollableDeckList, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
JEditorPane op = new JEditorPane(); op.setContentType("text/html"); op.setEditable(false); return new JScrollPane(op); fontExampleCol.add(getExampleOfFont(fonts[ii])); tabPane.add("Fonts", new JScrollPane(fontTable));
/** * Creates a non-editable widget to display the error message. * */ final JComponent createErrorMessage(Throwable t) { String txt = t.getLocalizedMessage(); JEditorPane msg = new JEditorPane(); msg.setContentType("text/plain"); msg.setEditable(false); msg.setText(txt); return msg; }
public void run() { JEditorPane jep = new JEditorPane(); jep.setContentType("text/html");//set content as html jep.setText("Welcome to <a href='http://stackoverflow.com/'>StackOverflow</a>.");
private JComponent getJComponent(List<String> lines) { final StringBuilder sb = new StringBuilder("<html>"); for (String s : lines) { sb.append(s + "</b></i></u>"); sb.append("<br>"); } sb.append("</html>"); final JEditorPane text = new JEditorPane("text/html", sb.toString()); text.setEditable(false); CompoundBorder border = new CompoundBorder(BorderFactory.createEtchedBorder(BevelBorder.RAISED), BorderFactory.createEmptyBorder(5, 5, 5, 5)); border = new CompoundBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, getBackground()), border); text.setBorder(border); final JScrollPane jScrollPane = new JScrollPane(text, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { jScrollPane.getVerticalScrollBar().setValue(0); } }); return jScrollPane; }
private void displayTsurgeonHelp() { if(tsurgeonHelpFrame != null) { tsurgeonHelpFrame.setVisible(true); } else { tsurgeonHelpFrame = new JFrame("TSurgeon Help..."); JEditorPane helpText = new JEditorPane(); helpText.setContentType("text/html"); // StringBuffer s = new StringBuffer(); // s.append(htmlTsurgeonHelp); helpText.setText(htmlTsurgeonHelp); helpText.setEditable(false); JScrollPane scroller = new JScrollPane(helpText); helpText.setCaretPosition(0); scroller.setPreferredSize(new Dimension(500,500)); tsurgeonHelpFrame.add(scroller); tsurgeonHelpFrame.pack(); tsurgeonHelpFrame.setBackground(Color.WHITE); tsurgeonHelpFrame.setVisible(true); } }
buttonCancel = new JButton(); JPanel panel3 = new JPanel(); txtDeckList = new JEditorPane(); txtDeckList.setPreferredSize(new Dimension(550, 400)); txtDeckList.setText(FORMAT_TEXT); JScrollPane txtScrollableDeckList = new JScrollPane(txtDeckList); panel3.add(txtScrollableDeckList, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
/** * Creates a new <code>DetailPanel</code> instance. * * @param aTable the table to listen for selections on * @param aModel the model backing the table */ DetailPanel(JTable aTable, final MyTableModel aModel) { mModel = aModel; setLayout(new BorderLayout()); setBorder(BorderFactory.createTitledBorder("Details: ")); mDetails = new JEditorPane(); mDetails.setEditable(false); mDetails.setContentType("text/html"); add(new JScrollPane(mDetails), BorderLayout.CENTER); final ListSelectionModel rowSM = aTable.getSelectionModel(); rowSM.addListSelectionListener(this); }
JEditorPane jep = new JEditorPane(); jep.setEditable(false); try { jep.setPage("http://www.yoursite.com"); }catch (IOException e) { jep.setContentType("text/html"); jep.setText("<html>Could not load</html>"); } JScrollPane scrollPane = new JScrollPane(jep); JFrame f = new JFrame("Test HTML"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(scrollPane); f.setPreferredSize(new Dimension(800,600)); f.setVisible(true);
private JComponent getJComponent(List<String> lines) { final StringBuilder sb = new StringBuilder("<html>"); for (String s : lines) { sb.append(s + "</b></i></u>"); sb.append("<br>"); } sb.append("</html>"); final JEditorPane text = new JEditorPane("text/html", sb.toString()); text.setEditable(false); CompoundBorder border = new CompoundBorder(BorderFactory.createEtchedBorder(BevelBorder.RAISED), BorderFactory.createEmptyBorder(5, 5, 5, 5)); border = new CompoundBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, getBackground()), border); text.setBorder(border); return text; }
String url = "http://host/path"; JEditorPane htmlPane = new JEditorPane(url); htmlPane.setContentType("text/html");
if (UpdateUtils.isNewerVersion(latestVersion)) { logger.info("Found newer version: " + latestVersion); JEditorPane changeListPane = new JEditorPane("text/html", String.format( "<html><font color=\"green\">New version (%s) is available!</font>" + "<br><br>Recent changes: %s" + "<br><br>Do you want to download and run the newest version?</html>", latestVersion, changeList.replaceAll("\\n", "<br><br>"))); changeListPane.setEditable(false); JScrollPane changeListScrollPane = new JScrollPane(changeListPane); changeListScrollPane.setPreferredSize(new Dimension(300, 300)); int result = JOptionPane.showConfirmDialog(null, changeListScrollPane, "RipMe Updater",
private void displayHelp() { if (helpFrame != null) { helpFrame.setVisible(true); } else { helpFrame = new JFrame("Tregex Help..."); //JPanel helpPanel = new JPanel(); JEditorPane helpText = new JEditorPane(); helpText.setContentType("text/html"); // StringBuffer s = new StringBuffer(); // s.append(htmlHelp); helpText.setText(htmlHelp); helpText.setEditable(false); //helpPanel.add(helpText); JScrollPane scroller = new JScrollPane(helpText); helpText.setCaretPosition(0); scroller.setPreferredSize(new Dimension(500,500)); helpFrame.add(scroller); helpFrame.pack(); helpFrame.setBackground(Color.WHITE); helpFrame.setVisible(true); //helpFrame.repaint(); } }
jScrollPane1 = new javax.swing.JScrollPane(); jEditorPane1 = new javax.swing.JEditorPane(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jScrollPane1.setViewportView(jEditorPane1); getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER); pack();
/** * Creates a new <code>DetailPanel</code> instance. * * @param aTable the table to listen for selections on * @param aModel the model backing the table */ DetailPanel(JTable aTable, final MyTableModel aModel) { mModel = aModel; setLayout(new BorderLayout()); setBorder(BorderFactory.createTitledBorder("Details: ")); mDetails = new JEditorPane(); mDetails.setEditable(false); mDetails.setContentType("text/html"); add(new JScrollPane(mDetails), BorderLayout.CENTER); final ListSelectionModel rowSM = aTable.getSelectionModel(); rowSM.addListSelectionListener(this); }
private void textDialog(String title, URL resource) { try { JDialog dialog = new JDialog(this, title); JEditorPane editor = new JEditorPane(resource); editor.setContentType("text/html"); editor.setEditable(false); editor.setBackground(Color.WHITE); editor.setPreferredSize(new Dimension(400, 250)); editor.addHyperlinkListener(this); dialog.add(editor); dialog.pack(); dialog.setVisible(true); } catch (IOException e) { e.printStackTrace(); } }
infoLabel.setAlignmentX(Component.CENTER_ALIGNMENT); panel.add(infoLabel); JEditorPane pane = new JEditorPane("text/html", "<a href=\"https://github.com/libgdx/libgdx/wiki/Dependency-management-with-Gradle\">Dependency Management</a>"); pane.addHyperlinkListener(new HyperlinkListener() { @Override pane.setEditable(false); pane.setOpaque(false); pane.setAlignmentX(Component.CENTER_ALIGNMENT);