use of javax.swing.JEditorPane in project jdk8u_jdk by JetBrains.
the class LargeQuickDoc method main.
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(() -> {
JFrame f = new JFrame();
JEditorPane editorPane = new javax.swing.JEditorPane("text/html", "");
editorPane.setEditorKit(new HTMLEditorKit());
editorPane.setEditable(false);
JScrollPane scrollPane = new JScrollPane(editorPane);
scrollPane.setBorder(null);
try {
editorPane.setText(getText());
} catch (IOException | ArrayIndexOutOfBoundsException e) {
throw new RuntimeException(e);
}
f.getContentPane().add(scrollPane);
f.setSize(500, 500);
f.setVisible(true);
});
}
use of javax.swing.JEditorPane in project jmeter by apache.
the class SamplerResultTab method createResponseDataPanel.
private JPanel createResponseDataPanel() {
results = new JEditorPane();
results.setEditable(false);
resultsScrollPane = GuiUtils.makeScrollPane(results);
imageLabel = new JLabel();
JPanel panel = new JPanel(new BorderLayout());
panel.add(resultsScrollPane, BorderLayout.CENTER);
if (activateSearchExtension) {
// Add search text extension
searchTextExtension = new SearchTextExtension();
searchTextExtension.init(panel);
searchPanel = searchTextExtension.createSearchTextExtensionPane();
searchTextExtension.setResults(results);
searchPanel.setVisible(true);
panel.add(searchPanel, BorderLayout.PAGE_END);
}
return panel;
}
use of javax.swing.JEditorPane in project jabref by JabRef.
the class PreviewPanelTransferHandler method createTransferable.
@Override
protected Transferable createTransferable(JComponent component) {
if (component instanceof JEditorPane) {
// this method should be called from the preview panel only
// the default TransferHandler implementation is aware of HTML
// and returns an appropriate Transferable
// as textTransferHandler.createTransferable() is not available and
// I don't know any other method, I do the HTML conversion by hand
// First, get the HTML of the selected text
JEditorPane editorPane = (JEditorPane) component;
StringWriter stringWriter = new StringWriter();
try {
editorPane.getEditorKit().write(stringWriter, editorPane.getDocument(), editorPane.getSelectionStart(), editorPane.getSelectionEnd());
} catch (BadLocationException | IOException e) {
LOGGER.warn("Cannot write preview", e);
}
// Second, return the HTML (and text as fallback)
return new HtmlTransferable(stringWriter.toString(), editorPane.getSelectedText());
} else {
// if not called from the preview panel, return an error string
return new StringSelection(Localization.lang("Operation not supported"));
}
}
use of javax.swing.JEditorPane in project jgnash by ccavanaugh.
the class BudgetWizardDialog method initComponents.
private void initComponents() {
okButton = new JButton(rb.getString("Button.Ok"));
cancelButton = new JButton(rb.getString("Button.Cancel"));
budgetPeriodCombo = new JComboBox<>();
budgetPeriodCombo.setModel(new DefaultComboBoxModel<>(Period.values()));
budgetPeriodCombo.setSelectedItem(Period.MONTHLY);
budgetNameField = new JTextField();
DefaultUnitConverter unitConverter = DefaultUnitConverter.getInstance();
helpPane = new JEditorPane();
helpPane.setEditable(false);
helpPane.setEditorKit(new StyledEditorKit());
helpPane.setBackground(getBackground());
helpPane.setText(TextResource.getString("NewBudgetOne.txt"));
helpPane.setPreferredSize(new Dimension(unitConverter.dialogUnitXAsPixel(DLU_X, helpPane), unitConverter.dialogUnitYAsPixel(DLU_Y, helpPane)));
roundButton = new JCheckBox(rb.getString("Button.RoundToWhole"));
okButton.addActionListener(this);
cancelButton.addActionListener(this);
}
use of javax.swing.JEditorPane in project jgnash by ccavanaugh.
the class NewFileThree method initComponents.
private void initComponents() {
addButton = new JButton(rb.getString("Button.Add"));
addButton.setIcon(IconUtils.getIcon("/jgnash/resource/list-add.png"));
addButton.setHorizontalTextPosition(SwingConstants.LEADING);
removeButton = new JButton(rb.getString("Button.Remove"));
removeButton.setIcon(IconUtils.getIcon("/jgnash/resource/list-remove.png"));
aJList = new JList<>();
cJList = new JList<>();
helpPane = new JEditorPane();
helpPane.setEditable(false);
helpPane.setEditorKit(new StyledEditorKit());
helpPane.setBackground(getBackground());
helpPane.setText(TextResource.getString("NewFileThree.txt"));
addButton.addActionListener(this);
removeButton.addActionListener(this);
}
Aggregations