private void buildContentPanel() { editorPane = new JEditorPane (); editorPane.setContentType("text/rtf"); editorPane.addKeyListener(new InputListener()); // defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes(); StyleConstants.setFontFamily(defaultAttrSet, "Lucida Sans"); Document doc = new DefaultStyledDocument(); editorPane.setDocument(doc); try { doc.insertString(0, initText, defaultAttrSet); } catch (Exception ex) { throw new RuntimeException(ex); } JScrollPane scrollPane = new JScrollPane(editorPane); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); editorPane.setEditable(true); }
private void buildContentPanel() { editorPane = new JEditorPane (); editorPane.setContentType("text/rtf"); editorPane.addKeyListener(new InputListener()); // defaultAttrSet = ((StyledEditorKit)editorPane.getEditorKit()).getInputAttributes(); StyleConstants.setFontFamily(defaultAttrSet, "Lucinda Sans"); Document doc = new DefaultStyledDocument(); editorPane.setDocument(doc); try { doc.insertString(0, initText, defaultAttrSet); } catch (Exception ex) { throw new RuntimeException(ex); } JScrollPane scrollPane = new JScrollPane(editorPane); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); editorPane.setEditable(true); }
textArea.addKeyListener(ka);
@Override public void install(JEditorPane editor) { super.install(editor); editor.addKeyListener(this); }
private JComponent createLicense() { final URL licenseURL = ClassLoader.getSystemClassLoader().getResource( "LICENSE/gpl-license.txt"); // The license editor pane JEditorPane license; try { license = new JEditorPane(licenseURL); } catch (final IOException e) { license = new JEditorPane(); license.setText("GPL Licence file cannot be found!"); } license.setEditable(false); license.addKeyListener(this); final JScrollPane lcsScrollPane = new JScrollPane(license); lcsScrollPane.setVerticalScrollBarPolicy(20); lcsScrollPane.setHorizontalScrollBarPolicy(30); return lcsScrollPane; }
private JComponent createAcknowledgements() { final URL acknowledgementsURL = ClassLoader.getSystemClassLoader() .getResource("LICENSE/ACKNOWLEDGEMENTS.txt"); // The acknoledgement editor pane JEditorPane acknowledgements; try { acknowledgements = new JEditorPane(acknowledgementsURL); } catch (final IOException e) { acknowledgements = new JEditorPane(); acknowledgements.setText("Acknoledgements file cannot be found"); } acknowledgements.setEditable(false); acknowledgements.addKeyListener(this); final JScrollPane ackScrollPane = new JScrollPane(acknowledgements); ackScrollPane.setVerticalScrollBarPolicy(20); ackScrollPane.setHorizontalScrollBarPolicy(30); return ackScrollPane; }
private JComponent createOutput(String title, String content) { editor = new JEditorPane(); JScrollPane scroll = new JScrollPane(editor, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scroll.setMinimumSize(new Dimension(100, 100)); editor.setContentType("text/java_output"); editor.setEditable(false); editor.setText(content); editor.addKeyListener(keyListener); JLabel header = new JLabel(title); Box box = Box.createVerticalBox(); box.add(header); box.add(scroll); return box; }
about.addKeyListener(this);
private JComponent createCode() { final JLabel codeLabel = new JLabel(ImageCreator.IMG_OWASP); codeLabel.setLocation(20, 45); codeLabel.setSize(100, 100); final URL codeURL = ClassLoader.getSystemClassLoader() .getResource("LICENSE/CODE.txt"); JEditorPane code; try { code = new JEditorPane(codeURL); } catch (final IOException eAbout) { code = new JEditorPane(); code.setText("Code information cannot be found!"); } code.setEditable(false); code.addKeyListener(this); final JScrollPane codeScroll = new JScrollPane(code); codeScroll.setVerticalScrollBarPolicy(20); codeScroll.setHorizontalScrollBarPolicy(30); codeScroll.setLocation(140, 5); codeScroll.setSize(290, 185); final JPanel codePanel = new JPanel(); codePanel.setLayout(null); codePanel.add(codeLabel); codePanel.add(codeScroll); return codePanel; }
disclaimer.addKeyListener(this);
codeEditor.addKeyListener(new KeyAdapter() { @Override public void keyTyped(KeyEvent event) {
panel.editorPane.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) {
panel.editorPane.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) {
panel.editorPane.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) {
button.addActionListener(this); button.addKeyListener(this); editorPane.addKeyListener(this); editorPane.addHyperlinkListener(this); JPanel panel = new JPanel();
public @Override void install (JEditorPane c) { super.install (c); HyperlinkListener hl = new HyperlinkListener (); c.addMouseMotionListener (hl); c.addMouseListener (hl); c.addKeyListener(hl); c.addCaretListener (new MarkOccurrencesSupport (c)); }
button.addActionListener(this); button.addKeyListener(this); editorPane.addKeyListener(this); editorPane.addHyperlinkListener(this); JPanel panel = new JPanel();
textArea.addKeyListener(ka);
viewer.setFont(new Font("Monospaced",Font.PLAIN,12)); viewer.addPropertyChangeListener(new PropertyChangeHandler()); viewer.addKeyListener(new KeyHandler());