Java Code Examples for javax.swing.JEditorPane#isEnabled()

The following examples show how to use javax.swing.JEditorPane#isEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StyledEditorKit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 2
Source File: StyledEditorKit.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 3
Source File: StyledEditorKit.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 4
Source File: DesktopUtil.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void hyperlinkUpdate(final HyperlinkEvent hle) {
	Object o = hle.getSource();
	if (o instanceof JEditorPane) {
		JEditorPane jEditorPane = (JEditorPane) o;
		if (HyperlinkEvent.EventType.ACTIVATED.equals(hle.getEventType()) && jEditorPane.isEnabled()) {
			browse(hle.getURL().toString(), window);
		}
	}
}
 
Example 5
Source File: StyledEditorKit.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 6
Source File: StyledEditorKit.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 7
Source File: StyledEditorKit.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 8
Source File: StyledEditorKit.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 9
Source File: StyledEditorKit.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 10
Source File: StyledEditorKit.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 11
Source File: StyledEditorKit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 12
Source File: StyledEditorKit.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 13
Source File: StyledEditorKit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 14
Source File: StyledEditorKit.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 15
Source File: StyledEditorKit.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 16
Source File: StyledEditorKit.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 17
Source File: StyledEditorKit.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}
 
Example 18
Source File: StyledEditorKit.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    JEditorPane target = getEditor(e);

    if (target != null) {
        if ((!target.isEditable()) || (!target.isEnabled())) {
            UIManager.getLookAndFeel().provideErrorFeedback(target);
            return;
        }
        StyledEditorKit sek = getStyledEditorKit(target);

        if (tempSet != null) {
            tempSet.removeAttributes(tempSet);
        }
        else {
            tempSet = new SimpleAttributeSet();
        }
        tempSet.addAttributes(sek.getInputAttributes());
        target.replaceSelection("\n");

        MutableAttributeSet ia = sek.getInputAttributes();

        ia.removeAttributes(ia);
        ia.addAttributes(tempSet);
        tempSet.removeAttributes(tempSet);
    }
    else {
        // See if we are in a JTextComponent.
        JTextComponent text = getTextComponent(e);

        if (text != null) {
            if ((!text.isEditable()) || (!text.isEnabled())) {
                UIManager.getLookAndFeel().provideErrorFeedback(target);
                return;
            }
            text.replaceSelection("\n");
        }
    }
}