當前位置: 首頁>>代碼示例>>Java>>正文


Java RTextScrollPane.getGutter方法代碼示例

本文整理匯總了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);

}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:22,代碼來源:ThemeTest.java

示例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);

}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:18,代碼來源:ThemeTest.java

示例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;
}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:22,代碼來源:RSyntaxUtilities.java

示例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);

}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:33,代碼來源:ThemeTest.java

示例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();
}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:41,代碼來源:QueryEditor.java

示例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);
}
 
開發者ID:LogicAndTrick,項目名稱:kaitai_struct_ide,代碼行數:31,代碼來源:ResultViewer.java

示例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);
    }
}
 
開發者ID:intuit,項目名稱:Tank,代碼行數:29,代碼來源:WrappedSyntaxView.java


注:本文中的org.fife.ui.rtextarea.RTextScrollPane.getGutter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。