Package javax.swing.plaf

Examples of javax.swing.plaf.TextUI


                b.right - ( ltr ? fm.right : fm.left ) );
    }

    private Insets getFieldMargin ()
    {
        TextUI ui = textComponent.getUI ();
        if ( ui instanceof WebTextFieldUI )
        {
            return ( ( WebTextFieldUI ) ui ).getFieldMargin ();
        }
        else if ( ui instanceof WebPasswordFieldUI )
View Full Code Here


            @Override
            public void paint(final Graphics g) {
                /* painting cursor. If it is not visible it is out of focus, we
                 * make it barely visible. */
                try {
                    final TextUI mapper = getComponent().getUI();
                    final Rectangle r = mapper.modelToView(getComponent(), getDot(), getDotBias());
                    if (r == null) {
                        return;
                    }
                    g.setColor(getComponent().getCaretColor());
                    if (isVisible() && editEnabled) {
View Full Code Here

            Object useMap = attr.getAttribute(HTML.Attribute.USEMAP);
            if (useMap != null && (useMap instanceof String)) {
                Map m = hdoc.getMap((String)useMap);
                if (m != null && offset < hdoc.getLength()) {
                    Rectangle bounds;
                    TextUI ui = html.getUI();
                    try {
                        Shape lBounds = ui.modelToView(html, offset,
                                                   Position.Bias.Forward);
                        Shape rBounds = ui.modelToView(html, offset + 1,
                                                   Position.Bias.Backward);
                        bounds = lBounds.getBounds();
                        bounds.add((rBounds instanceof Rectangle) ?
                                    (Rectangle)rBounds : rBounds.getBounds());
                    } catch (BadLocationException ble) {
View Full Code Here

        private boolean doesElementContainLocation(JEditorPane editor,
                                                   Element e, int offset,
                                                   int x, int y) {
            if (e != null && offset > 0 && e.getStartOffset() == offset) {
                try {
                    TextUI ui = editor.getUI();
                    Shape s1 = ui.modelToView(editor, offset,
                                              Position.Bias.Forward);
                    if (s1 == null) {
                        return false;
                    }
                    Rectangle r1 = (s1 instanceof Rectangle) ? (Rectangle)s1 :
                                    s1.getBounds();
                    Shape s2 = ui.modelToView(editor, e.getEndOffset(),
                                              Position.Bias.Backward);
                    if (s2 != null) {
                        Rectangle r2 = (s2 instanceof Rectangle) ? (Rectangle)s2 :
                                    s2.getBounds();
                        r1.add(r2);
View Full Code Here

    }

    try {

      // Determine locations.
      TextUI mapper = c.getUI();
      Rectangle p0 = mapper.modelToView(c, offs0);
      Rectangle p1 = mapper.modelToView(c, offs1);
      Paint paint = getPaint();
      if (paint==null)
        g2d.setColor(c.getSelectionColor());
      else
        g2d.setPaint(paint);
View Full Code Here

    //long startTime = System.currentTimeMillis();

    backgroundPainter.paint(g, getVisibleRect());

    // Paint the main part of the text area.
    TextUI ui = getUI();
    if (ui != null) {
      // Not allowed to modify g, so make a copy.
      Graphics scratchGraphics = g.create();
      try {
        ui.update(scratchGraphics, this);
      } finally {
        scratchGraphics.dispose();
      }
    }
View Full Code Here

   * @see #clearMarkOccurrencesHighlights()
   */
  Object addMarkedOccurrenceHighlight(int start, int end,
      SmartHighlightPainter p) throws BadLocationException {
    Document doc = textArea.getDocument();
    TextUI mapper = textArea.getUI();
    // Always layered highlights for marked occurrences.
    SyntaxLayeredHighlightInfoImpl i = new SyntaxLayeredHighlightInfoImpl();
    i.setPainter(p);
    i.setStartOffset(doc.createPosition(start));
    // HACK: Use "end-1" to prevent chars the user types at the "end" of
    // the highlight to be absorbed into the highlight (default Highlight
    // behavior).
    i.setEndOffset(doc.createPosition(end-1));
    markedOccurrences.add(i);
    mapper.damageRange(textArea, start, end);
    return i;
  }
View Full Code Here

   */
  HighlightInfo addParserHighlight(ParserNotice notice, HighlightPainter p)
                throws BadLocationException {

    Document doc = textArea.getDocument();
    TextUI mapper = textArea.getUI();

    int start = notice.getOffset();
    int end = 0;
    if (start==-1) { // Could just define an invalid line number
      int line = notice.getLine();
      Element root = doc.getDefaultRootElement();
      if (line>=0 && line<root.getElementCount()) {
        Element elem = root.getElement(line);
        start = elem.getStartOffset();
        end = elem.getEndOffset();
      }
    }
    else {
      end = start + notice.getLength();
    }

    // Always layered highlights for parser highlights.
    SyntaxLayeredHighlightInfoImpl i = new SyntaxLayeredHighlightInfoImpl();
    i.setPainter(p);
    i.setStartOffset(doc.createPosition(start));
    // HACK: Use "end-1" to prevent chars the user types at the "end" of
    // the highlight to be absorbed into the highlight (default Highlight
    // behavior).
    i.setEndOffset(doc.createPosition(end-1));
    i.notice = notice;//i.color = notice.getColor();

    parserHighlights.add(i);
    mapper.damageRange(textArea, start, end);
    return i;

  }
View Full Code Here

   * @see #clearMarkAllHighlights()
   */
  Object addMarkAllHighlight(int start, int end, HighlightPainter p)
      throws BadLocationException {
    Document doc = textArea.getDocument();
    TextUI mapper = textArea.getUI();
    // Always layered highlights for marked occurrences.
    HighlightInfoImpl i = new LayeredHighlightInfoImpl();
    i.setPainter(p);
    i.p0 = doc.createPosition(start);
    // HACK: Use "end-1" to prevent chars the user types at the "end" of
    // the highlight to be absorbed into the highlight (default Highlight
    // behavior).
    i.p1 = doc.createPosition(end-1);
    markAllHighlights.add(i);
    mapper.damageRange(textArea, start, end);
    return i;
  }
View Full Code Here

        if (lhi.width > 0 && lhi.height > 0) {
          textArea.repaint(lhi.x, lhi.y, lhi.width, lhi.height);
        }
    }
    else {
      TextUI ui = textArea.getUI();
      ui.damageRange(textArea, info.getStartOffset(),info.getEndOffset());
      //safeDamageRange(info.p0, info.p1);
    }
  }
View Full Code Here

TOP

Related Classes of javax.swing.plaf.TextUI

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.