本文整理汇总了Java中org.fife.ui.rtextarea.RTextScrollPane.getGutter方法的典型用法代码示例。如果您正苦于以下问题:Java RTextScrollPane.getGutter方法的具体用法?Java RTextScrollPane.getGutter怎么用?Java RTextScrollPane.getGutter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fife.ui.rtextarea.RTextScrollPane
的用法示例。
在下文中一共展示了RTextScrollPane.getGutter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testApply
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
@Test
public void testApply() {
RSyntaxTextArea textArea1 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp1 = new RTextScrollPane(textArea1);
Gutter gutter1 = sp1.getGutter();
initWithOddProperties(textArea1, gutter1);
RSyntaxTextArea textArea2 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp2 = new RTextScrollPane(textArea2);
Gutter gutter2 = sp2.getGutter();
assertAllThemePropertiesDifferent(textArea1, gutter1, textArea2, gutter2);
Theme theme = new Theme(textArea1);
theme.apply(textArea2);
assertEqualThemeProperties(textArea1, gutter1, textArea2, gutter2);
}
示例2: testLoad_FromStream_NoDefaultFont
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
@Test
public void testLoad_FromStream_NoDefaultFont() throws Exception {
InputStream in = getClass().getResourceAsStream("ThemeTest_theme1.xml");
Theme theme = Theme.load(in);
in.close();
RSyntaxTextArea textArea1 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp1 = new RTextScrollPane(textArea1);
Gutter gutter1 = sp1.getGutter();
initWithOddProperties(textArea1, gutter1);
theme.apply(textArea1);
assertColorsMatchTheme1(textArea1, gutter1);
}
示例3: getGutter
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
/**
* 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;
}
示例4: testSave
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
@Test
public void testSave() throws Exception {
RSyntaxTextArea textArea1 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp1 = new RTextScrollPane(textArea1);
Gutter gutter1 = sp1.getGutter();
initWithOddProperties(textArea1, gutter1);
RSyntaxTextArea textArea2 = new RSyntaxTextArea(
SyntaxConstants.SYNTAX_STYLE_PHP);
RTextScrollPane sp2 = new RTextScrollPane(textArea2);
Gutter gutter2 = sp2.getGutter();
assertAllThemePropertiesDifferent(textArea1, gutter1, textArea2, gutter2);
Theme theme = new Theme(textArea1);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
theme.save(baos);
String actual = new String(baos.toByteArray(), "UTF-8");
baos.close();
ByteArrayInputStream bin = new ByteArrayInputStream(actual.getBytes("UTF-8"));
Theme theme2 = Theme.load(bin);
bin.close();
theme2.apply(textArea2);
assertEqualThemeProperties(textArea1, gutter1, textArea2, gutter2);
}
示例5: QueryEditor
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
public QueryEditor(SyntaxElementSource syntaxElementSource, CompletionsSource completionsSource,
ClientSettings clientSettings) {
Check.notNull(syntaxElementSource);
this.syntaxElementSource = syntaxElementSource;
this.completionsSource = completionsSource;
this.clientSettings = clientSettings;
queryText = createTextArea();
queryText.addParser(new GftParser(syntaxElementSource, onStartParsing, onFinshParsing));
queryText.setMarkOccurrences(false);
queryText.setHighlightCurrentLine(clientSettings.highlightCurrentLine);
queryText.setParserDelay(700);
waitStateDisplay = new WaitStateDisplay(queryText);
scrollPane = new RTextScrollPane(queryText, false);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
Gutter gutter = scrollPane.getGutter();
gutter.setBookmarkingEnabled(true);
scrollPane.setIconRowHeaderEnabled(true);
scrollPane.setLineNumbersEnabled(clientSettings.lineNumbersEnabled);
setTheme(clientSettings.editorThemeXml);
URL url = getClass().getResource(Const.resourcePath + "bookmark.png");
gutter.setBookmarkIcon(new ImageIcon(url));
getContentPane().add(scrollPane);
ErrorStrip errorStrip = new ErrorStrip(queryText);
getContentPane().add(errorStrip, BorderLayout.LINE_END);
setCompletionProvider();
setTokenMaker();
queryText.setSyntaxEditingStyle(Const.languageId);
registerForLongOperationEvent();
}
示例6: ResultViewer
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
public ResultViewer() {
super(new BorderLayout());
textArea = new RSyntaxTextArea(25, 70);
textArea.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
// Hide the default scroll bar
scrollPane = new RTextScrollPane(textArea, false);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
// Set up custom line numbers
gutter = scrollPane.getGutter();
// Use a custom scroll bar
scrollBar = new JScrollBar(JScrollBar.VERTICAL);
// Hex table
table = new JTable();
table.setModel(tableModel = new HexTableModel());
table.setDefaultRenderer(Object.class, new HexTableRenderer());
add(scrollBar, BorderLayout.EAST);
add(scrollPane, BorderLayout.CENTER);
add(table, BorderLayout.SOUTH);
// Attach reprint listeners
addListeners();
update(null, null, null);
}
示例7: handleDocumentEvent
import org.fife.ui.rtextarea.RTextScrollPane; //导入方法依赖的package包/类
private void handleDocumentEvent(DocumentEvent e, Shape a,
ViewFactory f) {
int n = calculateLineCount();
if (this.nlines != n) {
this.nlines = n;
WrappedSyntaxView.this.preferenceChanged(this, false, true);
// have to repaint any views after the receiver.
RSyntaxTextArea textArea = (RSyntaxTextArea) getContainer();
textArea.repaint();
// Must also revalidate container so gutter components, such
// as line numbers, get updated for this line's new height
Container parent = textArea.getParent();
if (parent instanceof JViewport &&
parent.getParent() instanceof RTextScrollPane) {
RTextScrollPane sp = (RTextScrollPane) parent.getParent();
Gutter gutter = sp.getGutter();
if (gutter != null) {
gutter.revalidate();
gutter.repaint();
}
}
}
else if (a != null) {
Component c = getContainer();
Rectangle alloc = (Rectangle) a;
c.repaint(alloc.x, alloc.y, alloc.width, alloc.height);
}
}