org.fife.ui.rtextarea.RTextScrollPane类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.fife.ui.rtextarea.RTextScrollPane类的一些代码示例,展示了RTextScrollPane类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RTextScrollPane类的具体详情如下:
包路径:org.fife.ui.rtextarea.RTextScrollPane
类名称:RTextScrollPane

RTextScrollPane介绍

[英]An extension of JScrollPane that will only take RTextAreas (or javax.swing.JLayers decorating RTextAreas) for its view. This class has the ability to show:

  • Line numbers
  • Per-line icons (for bookmarks, debugging breakpoints, error markers, etc.)
  • +/- icons to denote code folding regions.
    The actual "meat" of these extras is contained in the Gutter class. Each RTextScrollPane has a Gutter instance that it uses as its row header. The gutter is only made visible when one of its features is being used (line numbering, folding, and/or icons).
    [中]JScrollPane的扩展,只需要RTextAreas(或javax.swing.JLayers装饰RTextAreas)即可查看。本课程能够展示:
    *行号
    *每行图标(用于书签、调试断点、错误标记等)
    *+/-表示代码折叠区域的图标。
    这些额外功能的实际“肉”包含在Groot类中。每个RTextScrollPane都有一个Gutter实例用作其行标题。排水沟仅在使用其功能之一(线编号、折叠和/或图标)时可见。

代码示例

代码示例来源:origin: bobbylight/RSyntaxTextArea

public FindAndReplaceDemo() {
 JPanel cp = new JPanel(new BorderLayout());
 RTextScrollPane sp = new RTextScrollPane(textArea);
 cp.add(sp);
 matchCaseCB = new JCheckBox("Match Case");
 toolBar.add(matchCaseCB);
 cp.add(toolBar, BorderLayout.NORTH);

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * 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);
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

DemoRootPane() {
    textArea = createTextArea();
    setText("JavaExample.txt");
    textArea.setSyntaxEditingStyle(SYNTAX_STYLE_JAVA);

    scrollPane = new RTextScrollPane(textArea, true);
    Gutter gutter = scrollPane.getGutter();
    gutter.setBookmarkingEnabled(true);
    URL url = getClass().getResource("bookmark.png");
    gutter.setBookmarkIcon(new ImageIcon(url));
    getContentPane().add(scrollPane);
    ErrorStrip errorStrip = new ErrorStrip(textArea);
//errorStrip.setBackground(java.awt.Color.blue);
    getContentPane().add(errorStrip, BorderLayout.LINE_END);
    setJMenuBar(createMenuBar());
  }

代码示例来源:origin: deathmarine/Luyten

else
  textArea.setSyntaxEditingStyle(SYNTAX_STYLE_PROPERTIES_FILE);
scrollPane = new RTextScrollPane(textArea, true);
scrollPane.setIconRowHeaderEnabled(true);
textArea.setText("");
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
final JScrollBar verticalScrollbar = scrollPane.getVerticalScrollBar();
if (verticalScrollbar != null) {
  verticalScrollbar.addAdjustmentListener(new AdjustmentListener() {
for (MouseWheelListener listeners : scrollPane.getMouseWheelListeners()) {
  scrollPane.removeMouseWheelListener(listeners);
scrollPane.addMouseWheelListener(new MouseWheelListener() {
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {

代码示例来源:origin: bobbylight/RSyntaxTextArea

@Override
public void actionPerformed(ActionEvent e) {
  scrollPane.setLineNumbersEnabled(
      !scrollPane.getLineNumbersEnabled());
}

代码示例来源:origin: deathmarine/Luyten

if (scrollPane.isWheelScrollingEnabled() && e.getWheelRotation() != 0) {
  JScrollBar toScroll = scrollPane.getVerticalScrollBar();
  int direction = e.getWheelRotation() < 0 ? -1 : 1;
  int orientation = SwingConstants.VERTICAL;
  if (toScroll == null || !toScroll.isVisible()) {
    toScroll = scrollPane.getHorizontalScrollBar();
    if (toScroll == null || !toScroll.isVisible()) {
      return;
    JViewport vp = scrollPane.getViewport();
    if (vp == null) {
      return;

代码示例来源:origin: org.zaproxy/zap

private void init() {
  mainPanel = new JPanel();
  mainPanel.setLayout(new BorderLayout());
  
  httpPanelTextArea = createHttpPanelTextArea();
  httpPanelTextArea.setEditable(false);
  httpPanelTextArea.setComponentPopupMenu(new CustomPopupMenu());
  
  JScrollPane scrollPane = new RTextScrollPane(httpPanelTextArea, false);
  scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
  
  mainPanel.add(scrollPane, BorderLayout.CENTER);
}

代码示例来源:origin: SAMLRaider/SAMLRaider

add(splitPaneMain, BorderLayout.CENTER);
JPanel panelTop = new JPanel();
splitPaneMain.setLeftComponent(panelTop);
panelTop.setLayout(new BorderLayout(0, 0));
panelTop.add(splitPaneTop);
scrollPane = new RTextScrollPane(textArea);
scrollPane.add(textArea);
panelText.add(scrollPane, BorderLayout.CENTER);
scrollPane.setViewportView(textArea);

代码示例来源:origin: pentaho/pentaho-reporting

private JPanel createGlobalScriptTab() {
 final JPanel globalHeader2 = new JPanel( new BorderLayout() );
 globalHeader2.add( new JLabel( Messages.getString( "QueryEditorPanel.GlobalScript" ) ), BorderLayout.CENTER );
 globalHeader2.add( new JButton( globalTemplateAction ), BorderLayout.EAST );
 final JPanel globalScriptHeader = new JPanel( new VerticalLayout( 5, VerticalLayout.BOTH, VerticalLayout.TOP ) );
 globalScriptHeader.add( new JLabel( Messages.getString( "QueryEditorPanel.GlobalScriptLanguage" ) ) );
 globalScriptHeader.add( globalLanguageField );
 globalScriptHeader.add( globalHeader2 );
 final JPanel globalScriptContentHolder = new JPanel( new BorderLayout() );
 globalScriptContentHolder.add( globalScriptHeader, BorderLayout.NORTH );
 globalScriptContentHolder.add( new RTextScrollPane( 700, 600, globalScriptTextArea, true ), BorderLayout.CENTER );
 globalScriptContentHolder.setBorder( BorderFactory.createEmptyBorder( 8, 8, 8, 8 ) );
 return globalScriptContentHolder;
}

代码示例来源:origin: com.fifesoft/languagesupport

RTextScrollPane scrollPane = new RTextScrollPane(textArea, true);
    scrollPane.setIconRowHeaderEnabled(true);
    scrollPane.getGutter().setBookmarkingEnabled(true);
JPanel cp = new JPanel(new BorderLayout());
cp.add(sp);
cp.add(errorStrip, BorderLayout.LINE_END);
setContentPane(cp);

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

public static void main(String args[])
{
  SwingUtilities.invokeLater(()
      -> 
      {
        WebLookAndFeel.install();
        JFrame frame = new JFrame("Teste Editor");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(800, 600);
        JPanel painel = new JPanel(new BorderLayout());
        Editor editor = new Editor();
        editor.scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        editor.scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < 60; i++)
        {   
          builder.append("linha ").append(String.valueOf(i)).append("\n");
        }
        editor.setCodigoFonte(builder.toString());
        
        painel.add(editor);
        WeblafUtils.configuraWeblaf(painel);
        frame.getContentPane().add(painel, BorderLayout.CENTER);
        frame.setVisible(true);
  });
}

代码示例来源:origin: pentaho/pentaho-reporting

protected JComponent getQueryEditor() {
  return new RTextScrollPane( 500, 300, queryTextArea, true );
 }
}

代码示例来源:origin: mvetsch/JWT4B

add(lblCookieFlags, gbc_lblCookieFlags);
RTextScrollPane sp = new RTextScrollPane(outputField);
sp.setLineNumbersEnabled(false);

代码示例来源:origin: sebbrudzinski/Open-LaTeX-Studio

rTextScrollPane1 = new org.fife.ui.rtextarea.RTextScrollPane(rSyntaxTextArea);
rTextScrollPane1.setFoldIndicatorEnabled(true);
rTextScrollPane1.setLineNumbersEnabled(true);

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
  scrollPane = new org.fife.ui.rtextarea.RTextScrollPane();
  textArea = new PSTextArea(new PortugolDocumento());
  setOpaque(false);
  setLayout(new java.awt.BorderLayout());
  scrollPane.setBorder(null);
  scrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setViewportBorder(javax.swing.BorderFactory.createEmptyBorder(3, 5, 0, 0));
  scrollPane.setName("scrollPaneEditor"); // NOI18N
  scrollPane.setOpaque(false);
  textArea.setBorder(null);
  textArea.setToolTipText("");
  textArea.setCodeFoldingEnabled(true);
  textArea.setName("textAreaEditor"); // NOI18N
  scrollPane.setViewportView(textArea);
  add(scrollPane, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents

代码示例来源:origin: RUB-NDS/BurpSSOExtension

updateOracle = new javax.swing.JToggleButton();
jLabel4 = new javax.swing.JLabel();
finalPayloadScrollPane = new org.fife.ui.rtextarea.RTextScrollPane();
finalPayload = new org.fife.ui.rsyntaxtextarea.RSyntaxTextArea();
payloadComboBox = new javax.swing.JComboBox();
jScrollPane1 = new javax.swing.JScrollPane();
attackDescriptionTextArea = new org.fife.ui.rsyntaxtextarea.RSyntaxTextArea();
rTextScrollPane1 = new org.fife.ui.rtextarea.RTextScrollPane();
payloadValue = new org.fife.ui.rsyntaxtextarea.RSyntaxTextArea();
finalPayloadScrollPane.setLineNumbersEnabled(true);
finalPayload.setRows(5);
finalPayload.setSyntaxEditingStyle("text/xml");
finalPayloadScrollPane.setViewportView(finalPayload);
rTextScrollPane1.setViewportView(payloadValue);

代码示例来源:origin: org.codehaus.jtstand/jtstand-editor

/**
 * 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);
}

代码示例来源:origin: RUB-NDS/BurpSSOExtension

textArea.setLineWrap(false);
sp = new RTextScrollPane(textArea);
sp.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);        
checkBox = new JCheckBox("Softwraps for long lines");
checkBox.setSelected(false);

代码示例来源:origin: fr.ifremer/isis-fish

private void $initialize() {
  if (allComponentsCreated) {
    return;
  }
  if (log.isDebugEnabled()) {
    log.debug(this);
  }
  $objectMap.put("$JPanel0", $JPanel0);
  // inline creation of $RTextScrollPane0
  $objectMap.put("$RTextScrollPane0", $RTextScrollPane0 = new RTextScrollPane());
  
  $RTextScrollPane0.setName("$RTextScrollPane0");
  createFieldSimulPreScript();
  // inline creation of $JButton0
  $objectMap.put("$JButton0", $JButton0 = new JButton());
  
  $JButton0.setName("$JButton0");
  $JButton0.setText(t("isisfish.preScript.backParameter"));
  $JButton0.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__$JButton0"));
  // inline creation of $JPanel0
  setName("$JPanel0");
  setLayout(new BorderLayout());
  
  /*protected void backParameter() {
        SimulUI simul = getParentContainer(SimulUI.class);
        simul.selTab(0);
      }*/;$completeSetup();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Returns the gutter component of the scroll pane containing a text
 * area, if any.
 *
 * @param textArea The text area.
 * @return The gutter, or <code>null</code> if the text area is not in
 *         an {@link RTextScrollPane}.
 * @see RTextScrollPane#getGutter()
 */
public static Gutter getGutter(RTextArea textArea) {
  Gutter gutter = null;
  Container parent = textArea.getParent();
  if (parent instanceof JViewport) {
    parent = parent.getParent();
    if (parent instanceof RTextScrollPane) {
      RTextScrollPane sp = (RTextScrollPane)parent;
      gutter = sp.getGutter(); // Should always be non-null
    }
  }
  return gutter;
}

相关文章