Java Code Examples for javax.swing.text.JTextComponent#setBorder()

The following examples show how to use javax.swing.text.JTextComponent#setBorder() . 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: AdjudicationCellRenderer.java    From mae-annotation with GNU General Public License v3.0 6 votes vote down vote up
@Override
public JTextComponent getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {

    JTextComponent renderer = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);

    renderer.setBackground(dataModel.isGoldTagRow(table.convertRowIndexToModel(row)) ? getBackground() : nonGoldRowBackground);
    int lastMinimalColumn = associatedType.isExtent() ? TablePanelController.TEXT_COL : Collections.max(((TagTableModel) dataModel).getTextColumns());

    if (!dataModel.isGoldTagRow(table.convertRowIndexToModel(row))) {
        if (col == TablePanelController.SRC_COL) {
            renderer.setForeground(tablePanelController.getMainController().getDocumentColor((String) value));
            renderer.setBorder(null);
        } else if (((TagTableModel) dataModel).isTextColumn(col) || col > lastMinimalColumn) {
            java.util.List[] distribution = getValueDistribution(dataModel, col);
            if (distribution != null) {
                renderer.setBorder(getAgreementIndicator(distribution, (String) value));
            }
        } else {
            renderer.setBorder(null);
        }
    } else {
        renderer.setBackground(UIManager.getColor("Table.background")); // do not change background on selection
    }

    return renderer;
}
 
Example 2
Source File: AquaTextFieldSearch.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected static void installSearchField(final JTextComponent c) {
    final SearchFieldBorder border = getSearchTextFieldBorder();
    c.setBorder(border);
    c.setLayout(border.getCustomLayout());
    c.add(getFindButton(c), BorderLayout.WEST);
    c.add(getCancelButton(c), BorderLayout.EAST);
    c.add(getPromptLabel(c), BorderLayout.CENTER);

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(border);
    }
}
 
Example 3
Source File: AquaTextFieldSearch.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected static void installSearchField(final JTextComponent c) {
    final SearchFieldBorder border = getSearchTextFieldBorder();
    c.setBorder(border);
    c.setLayout(border.getCustomLayout());
    c.add(getFindButton(c), BorderLayout.WEST);
    c.add(getCancelButton(c), BorderLayout.EAST);
    c.add(getPromptLabel(c), BorderLayout.CENTER);

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(border);
    }
}
 
Example 4
Source File: AquaTextFieldSearch.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 5
Source File: AquaTextFieldSearch.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 6
Source File: AquaTextFieldSearch.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected static void installSearchField(final JTextComponent c) {
    final SearchFieldBorder border = getSearchTextFieldBorder();
    c.setBorder(border);
    c.setLayout(border.getCustomLayout());
    c.add(getFindButton(c), BorderLayout.WEST);
    c.add(getCancelButton(c), BorderLayout.EAST);
    c.add(getPromptLabel(c), BorderLayout.CENTER);

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(border);
    }
}
 
Example 7
Source File: AquaTextFieldSearch.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 8
Source File: AquaTextFieldSearch.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 9
Source File: AquaTextFieldSearch.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 10
Source File: AquaTextFieldSearch.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static void installSearchField(final JTextComponent c) {
    final SearchFieldBorder border = getSearchTextFieldBorder();
    c.setBorder(border);
    c.setLayout(border.getCustomLayout());
    c.add(getFindButton(c), BorderLayout.WEST);
    c.add(getCancelButton(c), BorderLayout.EAST);
    c.add(getPromptLabel(c), BorderLayout.CENTER);

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(border);
    }
}
 
Example 11
Source File: AquaTextFieldSearch.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static void installSearchField(final JTextComponent c) {
    final SearchFieldBorder border = getSearchTextFieldBorder();
    c.setBorder(border);
    c.setLayout(border.getCustomLayout());
    c.add(getFindButton(c), BorderLayout.WEST);
    c.add(getCancelButton(c), BorderLayout.EAST);
    c.add(getPromptLabel(c), BorderLayout.CENTER);

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(border);
    }
}
 
Example 12
Source File: AquaTextFieldSearch.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static void installSearchField(final JTextComponent c) {
    final SearchFieldBorder border = getSearchTextFieldBorder();
    c.setBorder(border);
    c.setLayout(border.getCustomLayout());
    c.add(getFindButton(c), BorderLayout.WEST);
    c.add(getCancelButton(c), BorderLayout.EAST);
    c.add(getPromptLabel(c), BorderLayout.CENTER);

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(border);
    }
}
 
Example 13
Source File: AquaTextFieldSearch.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 14
Source File: AquaTextFieldSearch.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected static void installSearchField(final JTextComponent c) {
    final SearchFieldBorder border = getSearchTextFieldBorder();
    c.setBorder(border);
    c.setLayout(border.getCustomLayout());
    c.add(getFindButton(c), BorderLayout.WEST);
    c.add(getCancelButton(c), BorderLayout.EAST);
    c.add(getPromptLabel(c), BorderLayout.CENTER);

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(border);
    }
}
 
Example 15
Source File: AquaTextFieldSearch.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 16
Source File: AquaTextFieldSearch.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected static void installSearchField(final JTextComponent c) {
    final SearchFieldBorder border = getSearchTextFieldBorder();
    c.setBorder(border);
    c.setLayout(border.getCustomLayout());
    c.add(getFindButton(c), BorderLayout.WEST);
    c.add(getCancelButton(c), BorderLayout.EAST);
    c.add(getPromptLabel(c), BorderLayout.CENTER);

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(border);
    }
}
 
Example 17
Source File: AquaTextFieldSearch.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 18
Source File: AquaTextFieldSearch.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 19
Source File: AquaTextFieldSearch.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}
 
Example 20
Source File: AquaTextFieldSearch.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected static void uninstallSearchField(final JTextComponent c) {
    c.setBorder(UIManager.getBorder("TextField.border"));
    c.removeAll();

    final TextUI ui = c.getUI();
    if (ui instanceof AquaTextFieldUI) {
        ((AquaTextFieldUI)ui).setPaintingDelegate(null);
    }
}