/** * Returns the line rendered at the specified location. * * @param p The location in this row header. * @return The corresponding line in the editor. * @throws BadLocationException ble If an error occurs. */ private int viewToModelLine(Point p) throws BadLocationException { int offs = textArea.viewToModel(p); return offs>-1 ? textArea.getLineOfOffset(offs) : -1; }
@Override public void mousePressed(MouseEvent e) { if (textArea==null) { return; } if (e.getButton()==MouseEvent.BUTTON1) { int pos = textArea.viewToModel(new Point(0, e.getY())); if (pos>=0) { // Not -1 textArea.setCaretPosition(pos); } mouseDragStartOffset = pos; } else { mouseDragStartOffset = -1; } }
@Override public void mouseDragged(MouseEvent e) { if (mouseDragStartOffset>-1) { int pos = textArea.viewToModel(new Point(0, e.getY())); if (pos>=0) { // Not -1 textArea.setCaretPosition(mouseDragStartOffset); textArea.moveCaretPosition(pos); } } }
/** * Returns the tracking icons at the specified view position. * * @param p The view position. * @return The tracking icons at that position. If there are no tracking * icons there, this will be an empty array. * @throws BadLocationException If <code>p</code> is invalid. */ public GutterIconInfo[] getTrackingIcons(Point p) throws BadLocationException { int offs = textArea.viewToModel(new Point(0, p.y)); int line = textArea.getLineOfOffset(offs); return iconArea.getTrackingIcons(line); }
private int rowAtPoint(Point p) { int line = 0; try { int offs = textArea.viewToModel(p); if (offs>-1) { line = textArea.getLineOfOffset(offs); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } return line; }
if(selectedIndex != -1) { if (left) { selectedIndex = textArea.viewToModel( new Point(visible.x, visible.y)); selectedIndex = textArea.viewToModel( new Point(visible.x + visible.width - 1, visible.y + visible.height - 1));
newIndex = textArea.viewToModel( new Point(x, constrainY(textArea, dotBounds.y + yOffset, 0, 0))); newIndex = textArea.viewToModel(new Point( x, newVis.y)); newIndex = textArea.viewToModel(new Point( x, newVis.y + visible.height));
int topPosition = textArea.viewToModel( new Point(visibleRect.x,visibleRect.y)); int topLine = root.getElementIndex(topPosition);
Document doc = textArea.getDocument(); Element root = doc.getDefaultRootElement(); int topPosition = textArea.viewToModel( new Point(visibleRect.x,visibleRect.y)); int topLine = root.getElementIndex(topPosition);
Element root = doc.getDefaultRootElement(); int lineCount = root.getElementCount(); int topPosition = textArea.viewToModel( new Point(visibleRect.x,visibleRect.y)); int topLine = root.getElementIndex(topPosition);
Element root = doc.getDefaultRootElement(); int lineCount = root.getElementCount(); int topPosition = textArea.viewToModel( new Point(visibleRect.x,visibleRect.y)); int topLine = root.getElementIndex(topPosition);
/** * Returns the line rendered at the specified location. * * @param p The location in this row header. * @return The corresponding line in the editor. * @throws BadLocationException ble If an error occurs. */ private int viewToModelLine(Point p) throws BadLocationException { int offs = textArea.viewToModel(p); return offs>-1 ? textArea.getLineOfOffset(offs) : -1; }
public void mouseDragged(MouseEvent e) { if (mouseDragStartOffset>-1) { int pos = textArea.viewToModel(new Point(0, e.getY())); if (pos>=0) { // Not -1 textArea.setCaretPosition(mouseDragStartOffset); textArea.moveCaretPosition(pos); } } }
@Override public void mouseDragged(MouseEvent e) { if (mouseDragStartOffset>-1) { int pos = textArea.viewToModel(new Point(0, e.getY())); if (pos>=0) { // Not -1 textArea.setCaretPosition(mouseDragStartOffset); textArea.moveCaretPosition(pos); } } }
public void mouseDragged(MouseEvent e) { if (mouseDragStartOffset>-1) { int pos = textArea.viewToModel(new Point(0, e.getY())); if (pos>=0) { // Not -1 textArea.setCaretPosition(mouseDragStartOffset); textArea.moveCaretPosition(pos); } } }
@Override public String getToolTipText(MouseEvent e) { try { int offset = textArea.viewToModel(e.getPoint()); int linha = textArea.getLineOfOffset(offset) + 1; IconePontoDeParada pontoDeParada = getIconePontoDeParada(linha); if (pontoDeParada != null && !pontoDeParada.estaAtivado()) { return DICA_DOS_PONTOS_DE_PARADA + linha; } } catch (BadLocationException ex) { } return null; }
/** * Returns the tracking icons at the specified view position. * * @param p The view position. * @return The tracking icons at that position. If there are no tracking * icons there, this will be an empty array. * @throws BadLocationException If <code>p</code> is invalid. */ public Object[] getTrackingIcons(Point p) throws BadLocationException { int offs = textArea.viewToModel(new Point(0, p.y)); int line = textArea.getLineOfOffset(offs); return iconArea.getTrackingIcons(line); }
private int rowAtPoint(Point p) { int line = 0; try { int offs = textArea.viewToModel(p); if (offs>-1) { line = textArea.getLineOfOffset(offs); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } return line; }
public void mousePressed(MouseEvent e) { if (bookmarkingEnabled && bookmarkIcon!=null) { try { int offs = textArea.viewToModel(e.getPoint()); if (offs>-1) { int line = textArea.getLineOfOffset(offs); toggleBookmark(line); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } }
public void mousePressed(MouseEvent e) { if (bookmarkingEnabled && bookmarkIcon!=null) { try { int offs = textArea.viewToModel(e.getPoint()); if (offs>-1) { int line = textArea.getLineOfOffset(offs); toggleBookmark(line); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } }