/** * Changes the height of the cells in the JList so that they are as tall as * font. This function should be called whenever the user changes the Font * of <code>textArea</code>. */ private void updateCellHeights() { if (textArea!=null) { cellHeight = textArea.getLineHeight(); ascent = textArea.getMaxAscent(); } else { cellHeight = 20; // Arbitrary number. ascent = 5; // Also arbitrary } repaint(); }
int lineHeight = textArea.getLineHeight();
/** * Positions tool tips to be aligned in the text component, so that the * displayed content is shown (almost) exactly where it would be in the * editor. * * @param e The mouse location. */ @Override public Point getToolTipLocation(MouseEvent e) { // ToolTipManager requires both location and text to be null to hide // a currently-visible tool tip window. If text is null but location // has some value, it will show a tool tip with empty content, the size // of its border (!). String text = getToolTipText(e); if (text==null) { return null; } // Try to overlap the tip's text directly over the code Point p = e.getPoint(); p.y = (p.y/textArea.getLineHeight()) * textArea.getLineHeight(); p.x = getWidth() + textArea.getMargin().left; Gutter gutter = getGutter(); int gutterMargin = gutter.getInsets().right; p.x += gutterMargin; JToolTip tempTip = createToolTip(); p.x -= tempTip.getInsets().left; p.y += 16; return p; }
int height = textArea.getLineHeight();
/** * Repaints the line pointed to by the specified highlight information. * * @param lhi The highlight information. */ private void repaintLine(LineHighlightInfo lhi) { int offs = lhi.getOffset(); // May be > length if they deleted text including the highlight if (offs>=0 && offs<=textArea.getDocument().getLength()) { try { int y = textArea.yForLineContaining(offs); if (y>-1) { textArea.repaint(0, y, textArea.getWidth(), textArea.getLineHeight()); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } }
int cellHeight = textArea.getLineHeight(); int topLine = (visibleRect.y-textAreaInsets.top)/cellHeight; int bottomLine = Math.min(topLine+visibleRect.height/cellHeight+1,
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Container parent = textArea.getParent(); if (parent instanceof JViewport) { JViewport viewport = (JViewport)parent; Point p = viewport.getViewPosition(); p.y += delta*textArea.getLineHeight(); if (p.y<0) { p.y = 0; } else { Rectangle viewRect = viewport.getViewRect(); int visibleEnd = p.y + viewRect.height; if (visibleEnd>=textArea.getHeight()) { p.y = textArea.getHeight() - viewRect.height; } } viewport.setViewPosition(p); } }
int cellHeight = textArea.getLineHeight();
new Point(visibleRect.x,visibleRect.y)); int topLine = root.getElementIndex(topPosition); int cellHeight = textArea.getLineHeight(); FoldManager fm = ((RSyntaxTextArea)textArea).getFoldManager();
visibleRect.y = textAreaInsets.top; int cellHeight = textArea.getLineHeight(); int topLine = (visibleRect.y-textAreaInsets.top)/cellHeight; int y = topLine*cellHeight +
int cellHeight = textArea.getLineHeight(); while (y < visibleBottom) {
int cellHeight = textArea.getLineHeight(); int topLine = (visibleRect.y-textAreaInsets.top)/cellHeight;
/** * Changes the height of the cells in the JList so that they are as tall as * font. This function should be called whenever the user changes the Font * of <code>textArea</code>. */ private void updateCellHeights() { if (textArea!=null) { cellHeight = textArea.getLineHeight(); ascent = textArea.getMaxAscent(); } else { cellHeight = 20; // Arbitrary number. ascent = 5; // Also arbitrary } repaint(); }
/** * Changes the height of the cells in the JList so that they are as tall as * font. This function should be called whenever the user changes the Font * of <code>textArea</code>. */ private void updateCellHeights() { if (textArea!=null) { cellHeight = textArea.getLineHeight(); ascent = textArea.getMaxAscent(); } else { cellHeight = 20; // Arbitrary number. ascent = 5; // Also arbitrary } repaint(); }
/** * Changes the height of the cells in the JList so that they are as tall as * font. This function should be called whenever the user changes the Font * of <code>textArea</code>. */ private void updateCellHeights() { if (textArea!=null) { cellHeight = textArea.getLineHeight(); ascent = textArea.getMaxAscent(); } else { cellHeight = 20; // Arbitrary number. ascent = 5; // Also arbitrary } repaint(); }
/** * Repaints the line pointed to by the specified highlight information. * * @param lhi The highlight information. */ private void repaintLine(LineHighlightInfo lhi) { int offs = lhi.getOffset(); // May be > length if they deleted text including the highlight if (offs>=0 && offs<=textArea.getDocument().getLength()) { try { int y = textArea.yForLineContaining(offs); if (y>-1) { textArea.repaint(0, y, textArea.getWidth(), textArea.getLineHeight()); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } }
/** * Repaints the line pointed to by the specified highlight information. * * @param lhi The highlight information. */ private void repaintLine(LineHighlightInfo lhi) { int offs = lhi.getOffset(); // May be > length if they deleted text including the highlight if (offs>=0 && offs<=textArea.getDocument().getLength()) { try { int y = textArea.yForLineContaining(offs); if (y>-1) { textArea.repaint(0, y, textArea.getWidth(), textArea.getLineHeight()); } } catch (BadLocationException ble) { ble.printStackTrace(); // Never happens } } }
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Container parent = textArea.getParent(); if (parent instanceof JViewport) { JViewport viewport = (JViewport)parent; Point p = viewport.getViewPosition(); p.y += delta*textArea.getLineHeight(); if (p.y<0) { p.y = 0; } else { Rectangle viewRect = viewport.getViewRect(); int visibleEnd = p.y + viewRect.height; if (visibleEnd>=textArea.getHeight()) { p.y = textArea.getHeight() - viewRect.height; } } viewport.setViewPosition(p); } }
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Container parent = textArea.getParent(); if (parent instanceof JViewport) { JViewport viewport = (JViewport)parent; Point p = viewport.getViewPosition(); p.y += delta*textArea.getLineHeight(); if (p.y<0) { p.y = 0; } else { Rectangle viewRect = viewport.getViewRect(); int visibleEnd = p.y + viewRect.height; if (visibleEnd>=textArea.getHeight()) { p.y = textArea.getHeight() - viewRect.height; } } viewport.setViewPosition(p); } }
@Override public void actionPerformedImpl(ActionEvent e, RTextArea textArea) { Container parent = textArea.getParent(); if (parent instanceof JViewport) { JViewport viewport = (JViewport)parent; Point p = viewport.getViewPosition(); p.y += delta*textArea.getLineHeight(); if (p.y<0) { p.y = 0; } else { Rectangle viewRect = viewport.getViewRect(); int visibleEnd = p.y + viewRect.height; if (visibleEnd>=textArea.getHeight()) { p.y = textArea.getHeight() - viewRect.height; } } viewport.setViewPosition(p); } }