Click « JTextPane « Java Swing Q&A





1. Keeping selection after clicking a JButton to style text    stackoverflow.com

I'm making a fairly simple text editor, and I have a question about my style buttons. When I highlight text and click my "bold" button, the text bolds as expected, but ...

2. Toggle JToggleButton without clicking it, and unsetting styles    stackoverflow.com

I have a few toggle buttons to add styling to text in the form of:

    JToggleButton boldButton = new JToggleButton("Bold");
    boldButton.addActionListener(new StyledEditorKit.BoldAction());
    ...

3. Jtextpane click to create popup menu effect on selection not as intended    stackoverflow.com

I have a JTextPane sitting in a JFrame, with a popup menu that is assigned to the JTextPane through the JTextPane.setComponentPopupMenu method. I want to give the JTextPane a "Word-like" popup ...