• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LineNumberFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.fxmisc.richtext.LineNumberFactory的典型用法代码示例。如果您正苦于以下问题:Java LineNumberFactory类的具体用法?Java LineNumberFactory怎么用?Java LineNumberFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LineNumberFactory类属于org.fxmisc.richtext包,在下文中一共展示了LineNumberFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: EditorPane

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
/**
 * <p>
 * Creates an editable EditorPane with the given code as initial source code text.
 * </p>
 *
 * @param code the string to initialize the {@link CodeArea} to
 * @param syntaxErrors the initial list of {@link SyntaxError}s.
 * @param showLineNumbers whether to show line numbers in the {@link CodeArea}
 */
public EditorPane(String code, ObservableList<SyntaxError> syntaxErrors,
    boolean showLineNumbers) {
  super();
  this.syntaxErrors = syntaxErrors;
  ViewUtils.setupView(this);

  codeArea = new CodeArea(code);
  lineNumberFactory = LineNumberFactory.get(codeArea);
  if (showLineNumbers) {
    codeArea.setParagraphGraphicFactory(this::createLinePrefixForLine);
  }
  this.getItems().addAll(codeArea);
  this.setOrientation(Orientation.VERTICAL);
  this.setDividerPositions(0.8);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:25,代码来源:EditorPane.java


示例2: initialize

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
@FXML
public void initialize() {
	findAndReplaceHelper = new CodeAreaFindAndReplaceHelper<>(txtLog);
	txtLog.addEventHandler(KeyEvent.KEY_PRESSED, this::txtLogOnKeyPress);
	this.isStared.addListener((oba, o, n) -> {

		Platform.runLater(() -> {
			if (n) {
				lblStatus.setText("Started");
				btnStart.setDisable(true);
			} else {
				lblStatus.setText("Stopped");
				btnStart.setDisable(false);
			}
		});

	});

	btnStart.setOnAction(ev -> {
		start();
	});

	txtLog.setParagraphGraphicFactory(LineNumberFactory.get(txtLog));

	createContextMenu();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:27,代码来源:LogViewController.java


示例3: initialize

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
@FXML private void initialize() {
    container.setCenter(vsPane);
    sourceText.getStylesheets().add(MainApp.class.getResource("css/editor.css").toExternalForm());
    sourceText.setStyle("-fx-font-family: \"" + MainApp.getConfig().getEditorFont() + "\";-fx-font-size: " + MainApp.getConfig().getEditorFontsize() + ";");

    if(MainApp.getConfig().isEditorLinenoView())
        sourceText.setParagraphGraphicFactory(LineNumberFactory.get(sourceText));

    if(MainApp.getConfig().isEditorRenderView()) {
        initRenderTask();
    } else {
        splitPane.getItems().remove(1);
    }

    Platform.runLater(sourceText::requestFocus);
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:17,代码来源:MdConvertController.java


示例4: JavaCodeArea

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
public JavaCodeArea() {
	EventHandlerHelper.install(this.onKeyPressedProperty(), tabHandler);
	executor = Executors.newSingleThreadExecutor();
	this.setParagraphGraphicFactory(LineNumberFactory.get(this));
	this.richChanges().filter(ch -> !ch.getInserted().equals(ch.getRemoved())) // XXX
			.successionEnds(Duration.ofMillis(250)).supplyTask(this::computeHighlightingAsync)
			.awaitLatest(this.richChanges()).filterMap(t -> {
				if (t.isSuccess()) {
					return Optional.of(t.get());
				} else {
					t.getFailure().printStackTrace();
					return Optional.empty();
				}
			}).subscribe(this::applyHighlighting);

	this.getStylesheets().add(this.getClass().getResource("java-keywords.css").toExternalForm());
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-2,代码行数:18,代码来源:JavaCodeArea.java


示例5: AbstractRichTextCodeEditor

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
AbstractRichTextCodeEditor()
    {
        AnchorPane.setTopAnchor(codeArea, 0.0);
        AnchorPane.setLeftAnchor(codeArea, 0.0);
        AnchorPane.setBottomAnchor(codeArea, 0.0);
        AnchorPane.setRightAnchor(codeArea, 0.0);

        getChildren().add(codeArea);

        IntFunction<String> format = (digits -> " %" + digits + "d ");
/*        String stylesheet = AbstractRichTextCodeEditor.class.getResource("java-keywords.css").toExternalForm();     */
        IntFunction<Node> factory = LineNumberFactory.get(codeArea, format);
        codeArea.setParagraphGraphicFactory(factory);

        codeArea.textProperty().addListener((obs, oldText, newText) -> {
            codeArea.setStyleSpans(0, computeHighlighting(newText));
        });
        Platform.runLater(() -> {
            state.setValue(Worker.State.SUCCEEDED);
        });

        canUndo.bind(codeArea.getUndoManager().undoAvailableProperty());
        canRedo.bind(codeArea.getUndoManager().redoAvailableProperty());
        codeArea.fontProperty().set(Font.font("Source Code Pro", 14));
    }
 
开发者ID:finanzer,项目名称:epubfx,代码行数:26,代码来源:AbstractRichTextCodeEditor.java


示例6: start

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
@Override
  public void start(Stage primaryStage) {
      CodeArea codeArea = new CodeArea();
      codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea));

      codeArea.textProperty().addListener((obs, oldText, newText) -> {
          codeArea.setStyleSpans(0, computeHighlighting(newText));
      });
      codeArea.replaceText(0, 0, sampleCode);

Scene scene = new Scene(new StackPane(new VirtualizedScrollPane<>(codeArea)), 600, 400);
      scene.getStylesheets().add(XMLEditor.class.getResource("xml-highlighting.css").toExternalForm());
      primaryStage.setScene(scene);
      primaryStage.setTitle("XML Editor Demo");
      primaryStage.show();
  }
 
开发者ID:FXMisc,项目名称:RichTextFX,代码行数:17,代码来源:XMLEditor.java


示例7: start

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    CodeArea codeArea = new CodeArea();

    IntFunction<Node> numberFactory = LineNumberFactory.get(codeArea);
    IntFunction<Node> arrowFactory = new ArrowFactory(codeArea.currentParagraphProperty());
    IntFunction<Node> graphicFactory = line -> {
        HBox hbox = new HBox(
                numberFactory.apply(line),
                arrowFactory.apply(line));
        hbox.setAlignment(Pos.CENTER_LEFT);
        return hbox;
    };
    codeArea.setParagraphGraphicFactory(graphicFactory);
    codeArea.replaceText("The green arrow will only be on the line where the caret appears.\n\nTry it.");
    codeArea.moveTo(0, 0);

    primaryStage.setScene(new Scene(new StackPane(codeArea), 600, 400));
    primaryStage.show();
}
 
开发者ID:FXMisc,项目名称:RichTextFX,代码行数:21,代码来源:LineIndicatorDemo.java


示例8: start

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    CodeArea codeArea = new CodeArea();
    codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea));

    codeArea.richChanges()
            .filter(ch -> !ch.getInserted().equals(ch.getRemoved())) // XXX
            .subscribe(change -> {
                codeArea.setStyleSpans(0, computeHighlighting(codeArea.getText()));
            });
    codeArea.replaceText(0, 0, sampleCode);

    Scene scene = new Scene(new StackPane(new VirtualizedScrollPane<>(codeArea)), 600, 400);
    scene.getStylesheets().add(JavaKeywordsAsync.class.getResource("java-keywords.css").toExternalForm());
    primaryStage.setScene(scene);
    primaryStage.setTitle("Java Keywords Demo");
    primaryStage.show();
}
 
开发者ID:FXMisc,项目名称:RichTextFX,代码行数:19,代码来源:JavaKeywords.java


示例9: initialize

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    editor.setParagraphGraphicFactory(LineNumberFactory.get(editor));
    documentManager = new FileManager();
    populateExamples();
    initSyntaxHighlighter();
    initUndoRedo();
    initCopyCutPaste();
    openExample();
    editor.getUndoManager().forgetHistory();
    initializeLibrary();
    Platform.runLater(editor::requestFocus);
}
 
开发者ID:aNNiMON,项目名称:HotaruFX,代码行数:14,代码来源:EditorController.java


示例10: CustomCodeArea

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
public CustomCodeArea(String text, Highlight highlight, Syntax syntax, String name) {
    executor = Executors.newSingleThreadExecutor();
    this.highlight = highlight;
    this.syntax = syntax;
    this.lastText = "";
    this.name = name;

    InputMap<Event> prevent = InputMap.consume(
            anyOf(
                    keyPressed(TAB, SHORTCUT_ANY, SHIFT_ANY)
            )
    );
    Nodes.addInputMap(this, prevent);

    this.setOnKeyPressed(event -> {
        if (event.getCode() == KeyCode.TAB) {
            this.insertText(this.getCaretPosition(), "    ");
        }
    });
    caretPosition = CaretPosition.create();
    this.caretPositionProperty().addListener(listener -> caretPosition.compute(this));
    this.setParagraphGraphicFactory(LineNumberFactory.get(this));
    this.richChanges()
            .filter(this::isChangeable)
            .successionEnds(Duration.ofMillis(20))
            .supplyTask(this::computeHighlightingAsync)
            .awaitLatest(this.richChanges())
            .filterMap(this::getOptional)
            .subscribe(this::applyHighlighting);
    this.replaceText(0, 0, text);
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:32,代码来源:CustomCodeArea.java


示例11: CssEditor

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
public CssEditor() {
    getStylesheets().add(StyleController.class.getResource("/styles/code_area.css").toExternalForm());
    setParagraphGraphicFactory(LineNumberFactory.get(this));
    richChanges()
            .filter(ch -> !ch.getInserted().equals(ch.getRemoved())) // XXX
            .subscribe(change -> this.setStyleSpans(0, CSSFormatter.computeHighlighting(this.getText())));
}
 
开发者ID:EricCanull,项目名称:fxexperience2,代码行数:8,代码来源:CssEditor.java


示例12: FXMLTextArea

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
public FXMLTextArea() {
	codeArea = new CodeArea();
	codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea));

	codeArea.richChanges().subscribe(change -> {
		codeArea.setStyleSpans(0, computeHighlighting(codeArea.getText()));
	});

	codeArea.selectionProperty().addListener((oba, oldval, newval) -> {
		int start = newval.getStart();
		int end = newval.getEnd();
		int caretColumn = codeArea.getCaretColumn();

		String format = String.format("line : %d selectionStart : %d selectionEnd : %d column : %d  anchor : %d",
				codeArea.getCurrentParagraph() + 1, start + 1, end + 1, caretColumn + 1, codeArea.getAnchor());

		lblLineInfo.setText(format);
	});

	codeArea.setOnKeyPressed(this::codeAreaKeyClick);
	lblLineInfo.setPrefHeight(USE_COMPUTED_SIZE);
	lblLineInfo.setMinHeight(USE_COMPUTED_SIZE);
	lblLineInfo.setMaxHeight(USE_COMPUTED_SIZE);
	this.setCenter(codeArea);
	this.setBottom(lblLineInfo);
	// this.getChildren().add(codeArea);
	this.getStylesheets().add(FXMLTextArea.class.getResource("java-keywords.css").toExternalForm());

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:30,代码来源:FXMLTextArea.java


示例13: tabContents

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
@Override
public List<KeyNode> tabContents() {
	CodeArea value = new CodeArea();
	value.setParagraphGraphicFactory(LineNumberFactory.get(value));

	WebView webView = new WebView();
	return Arrays.asList(new KeyNode("Text", value), new KeyNode("WebView", webView));
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:9,代码来源:DefaultVelocityBinderComposite.java


示例14: TDDCodeArea

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
public TDDCodeArea(){
    super();
    this.setParagraphGraphicFactory(LineNumberFactory.get(this));

    this.richChanges()
            .filter(ch -> !ch.getInserted().equals(ch.getRemoved()))
            .subscribe(change -> {
                this.setStyleSpans(0, computeHighlighting(this.getText()));
            });

}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-amigos,代码行数:12,代码来源:TDDCodeArea.java


示例15: ScriptEditorView

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
public ScriptEditorView() {
    setParagraphGraphicFactory(LineNumberFactory.get(this));

    richChanges()
            .filter(ch -> !ch.getInserted().equals(ch.getRemoved())) // XXX
            .subscribe(change -> {
                setStyleSpans(0, computeHighlighting(getText()));
            });
}
 
开发者ID:AdrianBZG,项目名称:IEMLS,代码行数:10,代码来源:ScriptEditorView.java


示例16: initialize

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
@Override
    public void initialize(URL location, ResourceBundle resources) {
        executor = Executors.newSingleThreadExecutor();
        codeArea = new CodeArea();
        codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea));
        OkButton.disableProperty().bind(Val.map(codeArea.lengthProperty(), n -> n == 0));
        EventStream<?> richChanges = codeArea.richChanges();
        richChanges
                .successionEnds(Duration.ofMillis(500))
                .supplyTask(this::computeHighlightingAsync)
                .awaitLatest(richChanges)
                .filterMap(t -> {
                    if (t.isSuccess()) {
                        return Optional.of(t.get());
                    } else {
                        t.getFailure().printStackTrace();
                        return Optional.empty();
                    }
                })
                .subscribe(this::applyHighlighting);
        codeArea.replaceText(0, 0, getSampleCode());
        borderPane.setCenter(codeArea);
        borderPane.getStylesheets().add(getClass().getResource("/styles/JavaKeywords.css").toExternalForm());
        JdkFolderLocation.setOnMouseClicked((event) -> {
            if (event.getClickCount() == 2) {
                DirectoryChooser directoryChooser = new DirectoryChooser();
                directoryChooser.setTitle("Select JDK installation folder");
                File file = new File("C:\\Program Files\\Java");
                if (file.isDirectory()) { //check if it exists and a folder
                    directoryChooser.setInitialDirectory(file);
                }
                File directory = directoryChooser.showDialog(primaryStage);
                if (directory != null) {
                    JdkFolderLocation.setText(directory.getAbsolutePath());
                }
            }
        });
//        borderPane.setCenter(new VirtualizedScrollPane<>(codeArea));
    }
 
开发者ID:EMostafaAli,项目名称:HlaListener,代码行数:40,代码来源:ScriptWindowController.java


示例17: initControls

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
private void initControls()
{
    this.setText(this.subject.getAbsolutePath());
    ToolBar actionBar = new ToolBar();
    this.saveButton = Icons.buildIconButton("Save", Icons.ICON_SAVE);
    this.saveButton.getStyleClass().add("small-button");
    this.switchModeButton = new Button("View");
    this.switchModeButton.getStyleClass().add("small-button");
    this.resetButton = Icons.buildIconButton("Reload", Icons.ICON_RELOAD);
    this.resetButton.getStyleClass().add("small-button");
    this.wordWrapCheckBox = new CheckBox("Word Wrap");
    this.wordWrapCheckBox.getStyleClass().add("small-button");
    actionBar.getItems().addAll(this.saveButton, this.resetButton, this.switchModeButton, new HExpander(), this.wordWrapCheckBox);
    VBox.setVgrow(actionBar, Priority.NEVER);

    this.editorArea = new CodeArea();
    this.editorArea.setParagraphGraphicFactory(LineNumberFactory.get(this.editorArea));
    this.editorArea.getStyleClass().add("editor-area-monospaced");
    VBox.setVgrow(this.editorArea, Priority.ALWAYS);

    this.formattedView = new WebView();
    VBox.setVgrow(this.formattedView, Priority.ALWAYS);

    this.layout = new VBox();
    this.layout.getChildren().addAll(actionBar);
    this.setContent(this.layout);

    this.getStyleClass().add("open-file-tab");
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:30,代码来源:MarkdownTab.java


示例18: initControls

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
private void initControls()
{
    this.setText(this.subject.getAbsolutePath());
    ToolBar actionBar = new ToolBar();
    this.saveButton = Icons.buildIconButton("Save", Icons.ICON_SAVE);
    this.saveButton.getStyleClass().add("small-button");
    this.resetButton = Icons.buildIconButton("Reload", Icons.ICON_RELOAD);
    this.resetButton.getStyleClass().add("small-button");
    this.wordWrapCheckBox = new CheckBox("Word Wrap");
    this.wordWrapCheckBox.getStyleClass().add("small-button");
    this.wordWrapCheckBox.selectedProperty().set(true);
    actionBar.getItems().addAll(this.saveButton, this.resetButton, new HExpander(), this.wordWrapCheckBox);
    VBox.setVgrow(actionBar, Priority.NEVER);

    this.editorArea = new CodeArea();
    this.editorArea.setWrapText(true);
    this.editorArea.setParagraphGraphicFactory(LineNumberFactory.get(this.editorArea));
    this.editorArea.getStyleClass().add("editor-area-monospaced");
    VBox.setVgrow(this.editorArea, Priority.ALWAYS);

    VBox layout = new VBox();
    layout.getChildren().addAll(actionBar);
    layout.getChildren().add(this.editorArea);
    this.setContent(layout);

    this.getStyleClass().add("open-file-tab");
}
 
开发者ID:AstromechZA,项目名称:bunkr,代码行数:28,代码来源:TextTab.java


示例19: XMLEditor

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
public XMLEditor() {
    setParagraphGraphicFactory(LineNumberFactory.get(this));

    textProperty().addListener((obs, oldText, newText) -> {
        setStyleSpans(0, computeHighlighting(newText));
    });
}
 
开发者ID:aalmiray,项目名称:bootstrapfx,代码行数:8,代码来源:XMLEditor.java


示例20: initialize

import org.fxmisc.richtext.LineNumberFactory; //导入依赖的package包/类
private void initialize(boolean showLineNumbers) {		
	codeArea = new CodeArea();
	if (showLineNumbers) {
		codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea, digits -> "%"+ (digits < 2 ? 2 : digits) + "d"));
	}
	
	codeArea.textProperty().addListener((obs, oldText, newText) -> {
		codeArea.setStyleSpans(0, computeHighlighting(newText));
	});	
	
	FXUtil.anchor(codeArea);		
	getChildren().add(codeArea);
}
 
开发者ID:aic-sri-international,项目名称:aic-praise,代码行数:14,代码来源:HOGMCodeArea.java



注:本文中的org.fxmisc.richtext.LineNumberFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BinaryPrefixComparator类代码示例发布时间:2022-05-21
下一篇:
Java ObjectIntHashMap类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap