Search in sources :

Example 1 with DottedBorder

use of com.intellij.ui.DottedBorder in project intellij-community by JetBrains.

the class JBListTable method createEditorTextFieldPresentation.

public static JComponent createEditorTextFieldPresentation(final Project project, final FileType type, final String text, boolean selected, boolean focused) {
    final JPanel panel = new JPanel(new BorderLayout());
    final EditorTextField field = new EditorTextField(text, project, type) {

        @Override
        protected boolean shouldHaveBorder() {
            return false;
        }
    };
    Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
    font = new Font(font.getFontName(), font.getStyle(), 12);
    field.setFont(font);
    field.addSettingsProvider(EditorSettingsProvider.NO_WHITESPACE);
    if (selected && focused) {
        panel.setBackground(UIUtil.getTableSelectionBackground());
        field.setAsRendererWithSelection(UIUtil.getTableSelectionBackground(), UIUtil.getTableSelectionForeground());
    } else {
        panel.setBackground(UIUtil.getTableBackground());
        if (selected) {
            panel.setBorder(new DottedBorder(UIUtil.getTableForeground()));
        }
    }
    panel.add(field, BorderLayout.WEST);
    return panel;
}
Also used : EditorTextField(com.intellij.ui.EditorTextField) DottedBorder(com.intellij.ui.DottedBorder)

Example 2 with DottedBorder

use of com.intellij.ui.DottedBorder in project intellij-community by JetBrains.

the class InplaceRefactoring method createPreviewComponent.

public static EditorEx createPreviewComponent(Project project, FileType languageFileType) {
    Document document = EditorFactory.getInstance().createDocument("");
    UndoUtil.disableUndoFor(document);
    EditorEx previewEditor = (EditorEx) EditorFactory.getInstance().createEditor(document, project, languageFileType, true);
    previewEditor.setOneLineMode(true);
    final EditorSettings settings = previewEditor.getSettings();
    settings.setAdditionalLinesCount(0);
    settings.setAdditionalColumnsCount(1);
    settings.setRightMarginShown(false);
    settings.setFoldingOutlineShown(false);
    settings.setLineNumbersShown(false);
    settings.setLineMarkerAreaShown(false);
    settings.setIndentGuidesShown(false);
    settings.setVirtualSpace(false);
    previewEditor.setHorizontalScrollbarVisible(false);
    previewEditor.setVerticalScrollbarVisible(false);
    previewEditor.setCaretEnabled(false);
    settings.setLineCursorWidth(1);
    final Color bg = previewEditor.getColorsScheme().getColor(EditorColors.CARET_ROW_COLOR);
    previewEditor.setBackgroundColor(bg);
    previewEditor.setBorder(BorderFactory.createCompoundBorder(new DottedBorder(Color.gray), new LineBorder(bg, 2)));
    return previewEditor;
}
Also used : EditorEx(com.intellij.openapi.editor.ex.EditorEx) LineBorder(javax.swing.border.LineBorder) DottedBorder(com.intellij.ui.DottedBorder)

Example 3 with DottedBorder

use of com.intellij.ui.DottedBorder in project intellij-community by JetBrains.

the class CopiesPanel method setFocusableForLinks.

@SuppressWarnings("MethodMayBeStatic")
private void setFocusableForLinks(final LinkLabel label) {
    final Border border = new DottedBorder(new Insets(1, 2, 1, 1), JBColor.BLACK);
    label.setFocusable(true);
    label.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            super.focusGained(e);
            label.setBorder(border);
        }

        @Override
        public void focusLost(FocusEvent e) {
            super.focusLost(e);
            label.setBorder(null);
        }
    });
    label.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if (KeyEvent.VK_ENTER == e.getKeyCode()) {
                label.doClick();
            }
        }
    });
}
Also used : KeyEvent(java.awt.event.KeyEvent) FocusAdapter(java.awt.event.FocusAdapter) KeyAdapter(java.awt.event.KeyAdapter) DottedBorder(com.intellij.ui.DottedBorder) Border(javax.swing.border.Border) DottedBorder(com.intellij.ui.DottedBorder) FocusEvent(java.awt.event.FocusEvent)

Aggregations

DottedBorder (com.intellij.ui.DottedBorder)3 EditorEx (com.intellij.openapi.editor.ex.EditorEx)1 EditorTextField (com.intellij.ui.EditorTextField)1 FocusAdapter (java.awt.event.FocusAdapter)1 FocusEvent (java.awt.event.FocusEvent)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 Border (javax.swing.border.Border)1 LineBorder (javax.swing.border.LineBorder)1