use of javax.swing.JEditorPane in project jdk8u_jdk by JetBrains.
the class bug7189299 method setup.
private static void setup() {
/**
* Note the input type is not restricted to "submit". Types "image",
* "checkbox", "radio" have the same problem.
*/
html = new JEditorPane("text/html", "<html><body><form action=\"http://localhost.cgi\">" + "<input type=submit name=submit value=\"submit\"/>" + "</form></body></html>");
frame = new JFrame();
frame.setLayout(new BorderLayout());
frame.add(html, BorderLayout.CENTER);
frame.setSize(200, 100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
use of javax.swing.JEditorPane in project processdash by dtuma.
the class AboutDialog method getEditorPane.
private Component getEditorPane(String href) {
try {
String url = Browser.mapURL(href);
JEditorPane editorPane = new JEditorPane(new URL(url));
editorPane.setEditable(false);
editorPane.addHyperlinkListener(this);
editorPane.setAlignmentX(Component.CENTER_ALIGNMENT);
return editorPane;
} catch (IOException e) {
e.printStackTrace();
return new JLabel();
}
}
use of javax.swing.JEditorPane in project cayenne by apache.
the class ErrorDebugDialog method init.
protected void init() {
setResizable(false);
Container pane = this.getContentPane();
pane.setLayout(new BorderLayout());
// info area
JEditorPane infoText = new JEditorPane("text/html", infoHTML());
infoText.setBackground(pane.getBackground());
infoText.setEditable(false);
// popup hyperlinks
infoText.addHyperlinkListener(this);
JPanel infoPanel = new JPanel();
infoPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
infoPanel.add(infoText);
pane.add(infoPanel, BorderLayout.NORTH);
// exception area
if (throwable != null) {
exText.setEditable(false);
exText.setLineWrap(true);
exText.setWrapStyleWord(true);
exText.setRows(16);
exText.setColumns(40);
JScrollPane exScroll = new JScrollPane(exText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
exPanel = new JPanel();
exPanel.setLayout(new BorderLayout());
exPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
exPanel.add(exScroll, BorderLayout.CENTER);
// buttons
showHide = new JButton("");
showHide.addActionListener(this);
if (isDetailed()) {
showDetails();
} else {
hideDetails();
}
}
close = new JButton("Close");
close.addActionListener(this);
JButton[] buttons = (showHide != null) ? new JButton[] { showHide, close } : new JButton[] { close };
pane.add(PanelFactory.createButtonPanel(buttons), BorderLayout.SOUTH);
// add a listener to clear static variables, not to produce garbage
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
instance = null;
}
});
// prepare to display
this.pack();
this.centerWindow();
}
use of javax.swing.JEditorPane in project suite by stupidsing.
the class EditorController method load.
private void load(String filename) {
String text = FileUtil.read(filename);
JEditorPane editor = view.getEditor();
editor.setText(text);
editor.setCaretPosition(0);
editor.requestFocusInWindow();
model.changeFilename(filename);
model.changeIsModified(false);
}
use of javax.swing.JEditorPane in project suite by stupidsing.
the class EditorController method unixFilter.
public void unixFilter() {
JFrame frame = view.getFrame();
JEditorPane editor = view.getEditor();
String command = //
JOptionPane.showInputDialog(//
frame, "Enter command:", "Unix Filter", JOptionPane.PLAIN_MESSAGE);
try {
Process process = Runtime.getRuntime().exec(command);
try (OutputStream pos = process.getOutputStream();
Writer writer = new OutputStreamWriter(pos, Constants.charset)) {
writer.write(editor.getText());
}
process.waitFor();
editor.setText(To.string(process.getInputStream()));
} catch (IOException | InterruptedException ex) {
Fail.t(ex);
}
}
Aggregations