Package javax.swing.plaf

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



        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

        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

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

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

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

            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

            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

          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

            if( sdoc==null )return;

            Element rootEl = sdoc.getDefaultRootElement();
            if( rootEl==null )return;

            TextUI tui = textPane.getUI();
            if( tui==null )return;

            Font fnt = getFont();
            FontRenderContext fctx = gs.getFontRenderContext();

            Object savedRH = gs.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
            gs.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

            try
            {
                for( int i=0; i<rootEl.getElementCount(); i++ )
                {
                    Element e = rootEl.getElement(i);
                    if( e==null )continue;

                    int start = e.getStartOffset();

                    try
                    {
                        Rectangle rect = tui.modelToView(textPane, start, Bias.Forward);
                        if( rect==null )continue;

                        String textToRender = Integer.toString(i+1);
                        Rectangle2D textRect = fnt.getStringBounds(textToRender, fctx);
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.