Package com.intellij.ui

Examples of com.intellij.ui.TabbedPaneImpl


public class SafeHtmlTextEditor extends JPanel {
    private EditorTextField messageField;

    public SafeHtmlTextEditor(Project project) {
        super(new BorderLayout());
        TabbedPaneImpl tabbedPane = new TabbedPaneImpl(SwingConstants.TOP);
        tabbedPane.setKeyboardNavigation(TabbedPaneImpl.DEFAULT_PREV_NEXT_SHORTCUTS);

        messageField = CommitMessage.createCommitTextEditor(project, false);
        messageField.setBorder(BorderFactory.createEmptyBorder());
        JPanel messagePanel = new JPanel(new BorderLayout());
        messagePanel.add(messageField, BorderLayout.CENTER);
        messagePanel.add(new JLabel("Write your comment here. You can use a simple markdown-like syntax."), BorderLayout.SOUTH);
        tabbedPane.addTab("Write", AllIcons.Actions.Edit, messagePanel);

        final JEditorPane previewEditorPane = new JEditorPane(UIUtil.HTML_MIME, "");
        previewEditorPane.setEditable(false);
        tabbedPane.addTab("Preview", AllIcons.Actions.Preview, previewEditorPane);

        tabbedPane.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                if (((TabbedPaneImpl) e.getSource()).getSelectedComponent() == previewEditorPane) {
                    String content = String.format("<html><head>%s</head><body>%s</body></html>",
                            UIUtil.getCssFontDeclaration(UIUtil.getLabelFont()),
View Full Code Here

TOP

Related Classes of com.intellij.ui.TabbedPaneImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.