Search in sources :

Example 1 with TextUI

use of javax.swing.plaf.TextUI in project adempiere by adempiere.

the class VOvrCaret method paint.

//	VOvrCaret
/**
	 * Renders the caret as a top and button bracket.
	 *
	 * @param g the graphics context
	 * @see #damage
	 */
public void paint(Graphics g) {
    //	left-to-right
    boolean dotLTR = true;
    Position.Bias dotBias = Position.Bias.Forward;
    //
    if (isVisible()) {
        try {
            TextUI mapper = getComponent().getUI();
            Rectangle r = mapper.modelToView(getComponent(), getDot(), dotBias);
            Rectangle e = mapper.modelToView(getComponent(), getDot() + 1, dotBias);
            //	g.setColor(getComponent().getCaretColor());
            g.setColor(Color.blue);
            //
            int cWidth = e.x - r.x;
            int cHeight = 4;
            int cThick = 2;
            //
            //	 top
            g.fillRect(r.x - 1, r.y, cWidth, cThick);
            //	|
            g.fillRect(r.x - 1, r.y, cThick, cHeight);
            //	  |
            g.fillRect(r.x - 1 + cWidth, r.y, cThick, cHeight);
            //
            int yStart = r.y + r.height;
            //	 button
            g.fillRect(r.x - 1, yStart - cThick, cWidth, cThick);
            //	|
            g.fillRect(r.x - 1, yStart - cHeight, cThick, cHeight);
            //	  |
            g.fillRect(r.x - 1 + cWidth, yStart - cHeight, cThick, cHeight);
        } catch (BadLocationException e) {
        //	can't render
        //	System.err.println("Can't render cursor");
        }
    }
//	isVisible
}
Also used : Position(javax.swing.text.Position) Rectangle(java.awt.Rectangle) BadLocationException(javax.swing.text.BadLocationException) TextUI(javax.swing.plaf.TextUI)

Example 2 with TextUI

use of javax.swing.plaf.TextUI in project jdk8u_jdk by JetBrains.

the class AquaTextFieldSearch method uninstallSearchField.

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);
    }
}
Also used : TextUI(javax.swing.plaf.TextUI)

Example 3 with TextUI

use of javax.swing.plaf.TextUI in project jdk8u_jdk by JetBrains.

the class AquaTextFieldSearch method installSearchField.

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);
    }
}
Also used : TextUI(javax.swing.plaf.TextUI)

Aggregations

TextUI (javax.swing.plaf.TextUI)3 Rectangle (java.awt.Rectangle)1 BadLocationException (javax.swing.text.BadLocationException)1 Position (javax.swing.text.Position)1