List of utility methods to do JTextComponent Tab
void | disableTab(final JTextComponent txtComp) Disable the tab key for text components. txtComp.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, null); txtComp.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null); |
String | getTab(JTextComponent target) Return a string with number of spaces equal to the tab-stop of the TextComponent return SPACES.substring(0, getTabSize(target));
|
int | getTabSize(JTextComponent text) Return the TabStop property for the given text component, or 0 if not used Integer tabs = (Integer) text.getDocument().getProperty(PlainDocument.tabSizeAttribute);
return (null == tabs) ? 0 : tabs.intValue();
|
void | paintAboveline(Graphics g, JTextComponent tc, int pos0, int pos1) paint Aboveline g.setColor(Color.GREEN.darker()); TextUI ui = tc.getUI(); Rectangle r = ui.modelToView(tc, pos1 + 1); int h = r.y; int max = r.x - 2 + 1; int current = ui.modelToView(tc, pos0).x - 1; g.drawLine(current, h, max, h); g.drawLine(current, h + 1, current, h + 2); ... |