public static Point getLocationForCaret(JTextComponent pathTextField) {
    Point point;

    int position = pathTextField.getCaretPosition();
    try {
      final Rectangle rec = pathTextField.modelToView(position);
      point = new Point((int) rec.getMaxX(), (int) rec.getMaxY());
    } catch (BadLocationException e) {
      point = pathTextField.getCaret().getMagicCaretPosition();
    }

    SwingUtilities.convertPointToScreen(point, pathTextField);

    point.y += 2;

    return point;
  }
Example #2
0
 private void paintTextColumns(Graphics g, Rectangle clipBounds) {
   if (!hasIntersection(getTextColumnOffset(), myTextColumnWidth, clipBounds)) {
     return;
   }
   for (AbstractLeftColumn column : myLeftColumns) {
     if (clipBounds.x > column.getX() + column.getWidth()) {
       continue;
     }
     column.paint(g);
     //  COLORS: find out where it is and remove hardcoded color
     UIUtil.drawVDottedLine(
         (Graphics2D) g,
         myRightToLeft ? column.getX() : column.getX() + column.getWidth() - 1,
         (int) clipBounds.getMinY(),
         (int) clipBounds.getMaxY(),
         getBackground(),
         Color.GRAY);
   }
 }
Example #3
0
 public static RelativePoint getPointForBounds(JComponent aComponent, final Rectangle aBounds) {
   return new RelativePoint(aComponent, new Point(aBounds.x, (int) aBounds.getMaxY()));
 }