public ResultsTableCellRenderer() { RSyntaxTextArea area = CodeArea.getDefaultArea(mainWindow); this.font = area.getFont(); this.codeSelectedColor = area.getSelectionColor(); this.codeBackground = area.getBackground(); }
Font temp = getFont(); FontMetrics fm = getFontMetrics(temp); int height = fm.getHeight();
@Override public void actionPerformed(ActionEvent e) { JFontChooser fontChooser = new JFontChooser(); fontChooser.setSelectedFont(textArea.getFont()); fontChooser.setSelectedFontSize(textArea.getFont().getSize()); int result = fontChooser.showDialog(mainWindow); if (result == JFontChooser.OK_OPTION) { textArea.setFont(fontChooser.getSelectedFont()); luytenPrefs.setFont_size(fontChooser.getSelectedFontSize()); } } });
Font font = textArea.getFont(); int size = font.getSize(); if (e.getWheelRotation() > 0) {
/** * Returns the font for tokens of the specified type. * * @param type The type of token. * @return The font to use for that token type. * @see #getFontMetricsForTokenType(int) */ public Font getFontForTokenType(int type) { Font f = syntaxScheme.getStyle(type).font; return f!=null ? f : getFont(); }
/** * Returns the "default" syntax highlighting color scheme. The colors * used are somewhat standard among syntax highlighting text editors. * * @return The default syntax highlighting color scheme. * @see #restoreDefaultSyntaxScheme() * @see #getSyntaxScheme() * @see #setSyntaxScheme(SyntaxScheme) */ public SyntaxScheme getDefaultSyntaxScheme() { return new SyntaxScheme(getFont()); }
/** * Checks to see if the font metrics and longest line are up-to-date. */ private void updateMetrics() { host = (RSyntaxTextArea)getContainer(); Font f = host.getFont(); if (font != f) { // The font changed, we need to recalculate the longest line! // This also updates cached font and tab size. calculateLongestLine(); } }
public static String getTextAsHtml(RSyntaxTextArea textArea, int start, int end) { // Create the selection as HTML StringBuilder sb = new StringBuilder("<pre style='") .append("font-family: \"").append(textArea.getFont().getFamily()).append("\", courier;"); if (textArea.getBackground() != null) { // May be null if it is an image sb.append(" background: ") .append(HtmlUtil.getHexString(textArea.getBackground())) .append("'>"); } Token token = textArea.getTokenListFor(start, end); for (Token t = token; t != null; t = t.getNextToken()) { if (t.isPaintable()) { if (t.isSingleChar('\n')) { sb.append("<br>"); } else { sb.append(TokenUtils.tokenToHtml(textArea, t)); } } } sb.append("</pre>"); return sb.toString(); } }
private void refreshFontMetrics(Graphics2D g2d) { // It is assumed that any rendering hints are already applied to g2d. defaultFontMetrics = g2d.getFontMetrics(getFont()); syntaxScheme.refreshFontMetrics(g2d); if (!getLineWrap()) { // HORRIBLE HACK! The un-wrapped view needs to refresh its cached // longest line information. SyntaxView sv = (SyntaxView)getUI().getRootView(this).getView(0); sv.calculateLongestLine(); } }
Font font = rsta.getFont(); float oldSize = font.getSize2D(); float newSize = oldSize - decreaseAmount;
Font font = rsta.getFont(); float oldSize = font.getSize2D(); float newSize = oldSize + increaseAmount;
/** * Returns the "default" syntax highlighting color scheme. The colors * used are somewhat standard among syntax highlighting text editors. * * @return The default syntax highlighting color scheme. * @see #restoreDefaultSyntaxScheme() * @see #getSyntaxScheme() * @see #setSyntaxScheme(SyntaxScheme) */ public SyntaxScheme getDefaultSyntaxScheme() { return new SyntaxScheme(getFont()); }
/** * Returns the "default" syntax highlighting color scheme. The colors * used are somewhat standard among syntax highlighting text editors. * * @return The default syntax highlighting color scheme. * @see #restoreDefaultSyntaxScheme() * @see #getSyntaxScheme() * @see #setSyntaxScheme(SyntaxScheme) */ public SyntaxScheme getDefaultSyntaxScheme() { return new SyntaxScheme(getFont()); }
baseFont = textArea.getFont(); bgColor = textArea.getBackground(); caretColor = textArea.getCaretColor();
/** * Checks to see if the font metrics and longest line are up-to-date. */ private void updateMetrics() { host = (RSyntaxTextArea)getContainer(); Font f = host.getFont(); if (font != f) { // The font changed, we need to recalculate the longest line! // This also updates cached font and tab size. calculateLongestLine(); } }
/** * Checks to see if the font metrics and longest line are up-to-date. */ protected void updateMetrics() { host = (RSyntaxTextArea)getContainer(); Font f = host.getFont(); if (font != f) { // The font changed, we need to recalculate the longest line! // This also updates cached font and tab size. calculateLongestLine(); } }