Examples of TextUI


Examples of javax.swing.plaf.TextUI

    }

    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

Examples of javax.swing.plaf.TextUI

    //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

Examples of javax.swing.plaf.TextUI


        public void run() {
            JTextField field = (JTextField) getComponent();
            if (field != null) {
                TextUI ui = field.getUI();
                int dot = getDot();
                // PENDING: We need to expose the bias in DefaultCaret.
                Position.Bias bias = Position.Bias.Forward;
                Rectangle startRect = null;
                try {
                    startRect = ui.modelToView(field, dot, bias);
                } catch (BadLocationException ble) {}

                Insets i = field.getInsets();
                BoundedRangeModel vis = field.getHorizontalVisibility();
                int x = r.x + vis.getValue() - i.left;
                int quarterSpan = vis.getExtent() / 4;
                if (r.x < i.left) {
                    vis.setValue(x - quarterSpan);
                } else if (r.x + r.width > i.left + vis.getExtent()) {
                    vis.setValue(x - (3 * quarterSpan));
                }
                // If we scroll, our visual location will have changed,
                // but we won't have updated our internal location as
                // the model hasn't changed. This checks for the change,
                // and if necessary, resets the internal location.
                if (startRect != null) {
                    try {
                        Rectangle endRect;
                        endRect = ui.modelToView(field, dot, bias);
                        if (endRect != null && !endRect.equals(startRect)){
                            damage(endRect);
                        }
                    } catch (BadLocationException ble) {}
                }
View Full Code Here

Examples of javax.swing.plaf.TextUI

        public void paint(Graphics g, int offs0, int offs1, Shape bounds,
                JTextComponent c) {
            Rectangle alloc = bounds.getBounds();
            try {
                // --- determine locations ---
                TextUI mapper = c.getUI();
                Rectangle p0 = mapper.modelToView(c, offs0);
                Rectangle p1 = mapper.modelToView(c, offs1);

                // --- render ---
                Color color = getColor();

                if (color == null) {
View Full Code Here

Examples of javax.swing.plaf.TextUI

    //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

Examples of javax.swing.plaf.TextUI

    /**
     * Ensures that the phantom text field has a Plastic text field UI.
     */
    private static void ensurePhantomHasPlasticUI() {
        TextUI ui = PHANTOM.getUI();
        Class lafClass = UIManager.getLookAndFeel().getClass();
        if (   (phantomLafClass != lafClass)
            || !(ui instanceof MetalTextFieldUI)) {
            phantomLafClass = lafClass;
            PHANTOM.updateUI();
View Full Code Here

Examples of javax.swing.plaf.TextUI

   */
  Object 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.
    HighlightInfo i = new LayeredHighlightInfo();
    i.painter = p;
    i.p0 = doc.createPosition(start);
    i.p1 = doc.createPosition(end);
    i.notice = notice;//i.color = notice.getColor();

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

  }
View Full Code Here

Examples of javax.swing.plaf.TextUI

            textArea.repaint(lhi.x, lhi.y, lhi.width, lhi.height);
          }
      }
      else {
        HighlightInfo info = (HighlightInfo) tag;
        TextUI ui = textArea.getUI();
        ui.damageRange(textArea, info.getStartOffset(),info.getEndOffset());
        //safeDamageRange(info.p0, info.p1);
      }

    }
View Full Code Here

Examples of javax.swing.plaf.TextUI

            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);
        }
        i.remove();
      }
View Full Code Here

Examples of javax.swing.plaf.TextUI

          textArea.repaint(lhi.x, lhi.y, lhi.width, lhi.height);
        }
    }
    else {
      HighlightInfo info = (HighlightInfo) tag;
      TextUI ui = textArea.getUI();
      ui.damageRange(textArea, info.getStartOffset(),info.getEndOffset());
      //safeDamageRange(info.p0, info.p1);
    }
    list.remove(tag);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.