/** * Creates a scroll pane. * * @param comp The component this scroll pane should display. This should * be an instance of {@link RTextArea}, * <code>javax.swing.JLayer</code> (or the older * <code>org.jdesktop.jxlayer.JXLayer</code>), or <code>null</code>. * If this argument is <code>null</code>, you must call * {@link #setViewportView(Component)}, passing in an instance of * one of the types above. * @param lineNumbers Whether line numbers are initially enabled. * @param lineNumberColor The color to use for line numbers. */ public RTextScrollPane(Component comp, boolean lineNumbers, Color lineNumberColor) { super(comp); RTextArea textArea = getFirstRTextAreaDescendant(comp); // Create the gutter for this document. Font defaultFont = new Font("Monospaced", Font.PLAIN, 12); gutter = new Gutter(textArea); gutter.setLineNumberFont(defaultFont); gutter.setLineNumberColor(lineNumberColor); setLineNumbersEnabled(lineNumbers); // Set miscellaneous properties. setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS); setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED); }
@Test public void testGetLineNumberColor() { RTextArea textArea = new RTextArea(PLAIN_TEXT); Gutter gutter = new Gutter(textArea); Color color = Color.red; gutter.setLineNumberColor(color); Assert.assertEquals(color, gutter.getLineNumberColor()); color = Color.green; gutter.setLineNumberColor(color); Assert.assertEquals(color, gutter.getLineNumberColor()); }
@Test public void testSetLineNumberColor() { RTextArea textArea = new RTextArea(PLAIN_TEXT); Gutter gutter = new Gutter(textArea); Color color = Color.red; gutter.setLineNumberColor(color); Assert.assertEquals(color, gutter.getLineNumberColor()); color = Color.green; gutter.setLineNumberColor(color); Assert.assertEquals(color, gutter.getLineNumberColor()); }
gutter.setActiveLineRangeColor(activeLineRangeColor); gutter.setIconRowHeaderInheritsGutterBackground(iconRowHeaderInheritsGutterBG); gutter.setLineNumberColor(lineNumberColor); String fontName = lineNumberFont!=null ? lineNumberFont : baseFont.getFamily();
gutter.setBackground( new Color(Integer.parseInt(temaEditor.getString("background_editor"), 16))); gutter.setBorderColor( new Color(Integer.parseInt(temaEditor.getString("borda_barra_lateral"), 16))); gutter.setLineNumberColor( new Color(Integer.parseInt(temaEditor.getString("numeros_das_linhas"), 16))); gutter.setFoldIndicatorForeground( new Color(Integer.parseInt(temaEditor.getString("dobrador_de_codigo"), 16))); gutter.setFoldBackground( new Color(Integer.parseInt(temaEditor.getString("background_editor"), 16)));
/** * Creates a scroll pane with preferred size (width, height). * * @param area The text area this scroll pane will contain. If this is * <code>null</code>, you must call * {@link #setViewportView(Component)}, passing in an * {@link RTextArea}. * @param lineNumbers Whether line numbers are initially enabled. * @param lineNumberColor The color to use for line numbers. */ public RTextScrollPane(RTextArea area, boolean lineNumbers, Color lineNumberColor) { super(area); // Create the text area and set it inside this scroll bar area. textArea = area; // Create the gutter for this document. Font defaultFont = new Font("Monospaced", Font.PLAIN, 12); gutter = new Gutter(textArea); gutter.setLineNumberFont(defaultFont); gutter.setLineNumberColor(lineNumberColor); setLineNumbersEnabled(lineNumbers); // Set miscellaneous properties. setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS); setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED); }
/** * Creates a scroll pane with preferred size (width, height). * * @param area The text area this scroll pane will contain. If this is * <code>null</code>, you must call * {@link #setViewportView(Component)}, passing in an * {@link RTextArea}. * @param lineNumbers Whether line numbers are initially enabled. * @param lineNumberColor The color to use for line numbers. */ public RTextScrollPane(RTextArea area, boolean lineNumbers, Color lineNumberColor) { super(area); // Create the text area and set it inside this scroll bar area. textArea = area; // Create the gutter for this document. Font defaultFont = new Font("Monospaced", Font.PLAIN, 12); gutter = new Gutter(textArea); gutter.setLineNumberFont(defaultFont); gutter.setLineNumberColor(lineNumberColor); setLineNumbersEnabled(lineNumbers); // Set miscellaneous properties. setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS); setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED); }
gutter.setActiveLineRangeColor(Color.orange); gutter.setIconRowHeaderInheritsGutterBackground(!gutter.getIconRowHeaderInheritsGutterBackground()); gutter.setLineNumberColor(Color.orange); gutter.setLineNumberFont(font); gutter.setFoldIndicatorForeground(Color.orange);
/** * Creates a scroll pane. * * @param comp The component this scroll pane should display. This should * be an instance of {@link RTextArea}, * <code>javax.swing.JLayer</code> (or the older * <code>org.jdesktop.jxlayer.JXLayer</code>), or <code>null</code>. * If this argument is <code>null</code>, you must call * {@link #setViewportView(Component)}, passing in an instance of * one of the types above. * @param lineNumbers Whether line numbers are initially enabled. * @param lineNumberColor The color to use for line numbers. */ public RTextScrollPane(Component comp, boolean lineNumbers, Color lineNumberColor) { super(comp); RTextArea textArea = getFirstRTextAreaDescendant(comp); // Create the gutter for this document. Font defaultFont = new Font("Monospaced", Font.PLAIN, 12); gutter = new Gutter(textArea); gutter.setLineNumberFont(defaultFont); gutter.setLineNumberColor(lineNumberColor); setLineNumbersEnabled(lineNumbers); // Set miscellaneous properties. setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS); setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED); }
@Override public void styleChanged(Style style) { //getGutter().setBackground(style.getBaseValues().getColor(VCodeEditor.LINE_NUMBER_FIELD_COLOR_KEY)); getGutter().setLineNumberColor(style.getBaseValues().getColor(VCodeEditor.LINE_NUMBER_COLOR_KEY)); getGutter().setBorderColor(style.getBaseValues().getColor(VCodeEditor.BORDER_COLOR_KEY)); }
gutter.setActiveLineRangeColor(activeLineRangeColor); gutter.setIconRowHeaderInheritsGutterBackground(iconRowHeaderInheritsGutterBG); gutter.setLineNumberColor(lineNumberColor); String fontName = lineNumberFont!=null ? lineNumberFont : baseFont.getFamily();