当前位置: 首页>>代码示例>>Java>>正文


Java VirtualizedScrollPane类代码示例

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


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

示例1: addObjectToTab

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
public void addObjectToTab(CustomTreeItem item) {
    String text = getText(item.getValue());
    CustomCodeArea customCodeArea = new CustomCodeArea(text, highlight, syntax, item.getValue().getFileName().toString());

    Tab tab = new Tab();
    tab.setText(item.getValue().getFileName().toString());
    CustomIcons customIcons = new CustomIcons();
    tab.setGraphic(new ImageView(customIcons.getFileImage()));
    tab.setUserData(item.getValue());

    VirtualizedScrollPane scrollPane = new VirtualizedScrollPane<>(customCodeArea);
    tab.setContent(scrollPane);

    tabPane.getTabs().add(tab);

    focusToTab();

    scheduleHighlight();
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:20,代码来源:TabUpdater.java

示例2: updateTabs

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
void updateTabs(Path newPath, Path toRename) {
    ObservableList<Tab> tabs = tabPane.getTabs();

    for (Tab tab : tabs) {
        Path path = (Path) tab.getUserData();

        if (Files.isDirectory(newPath) && path.startsWith(newPath.getParent())) {
            Path newPathRecord = mergeDifferences(path, newPath);
            tab.setUserData(newPathRecord);
        } else if (!Files.isDirectory(newPath) && path.equals(toRename)) {
            Platform.runLater(() -> tab.setText(newPath.getFileName().toString()));
            tab.setUserData(newPath);

            ((CustomCodeArea) ((VirtualizedScrollPane) tab.getContent()).getContent()).setName(newPath.getFileName().toString());
        }
    }
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:18,代码来源:TabUpdater.java

示例3: start

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的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

示例4: start

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    StyleClassedTextArea area = new StyleClassedTextArea();
    area.setWrapText(true);
    for(int i = 0; i < 10; ++i) {
        area.appendText("Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n");
    }

    HBox panel = new HBox();
    for(int size: new int[]{8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72}) {
        Button b = new Button(Integer.toString(size));
        b.setOnAction(ae -> area.setStyle("-fx-font-size:" + size));
        panel.getChildren().add(b);
    }

    VBox vbox = new VBox();
    VirtualizedScrollPane<StyleClassedTextArea> vsPane = new VirtualizedScrollPane<>(area);
    VBox.setVgrow(vsPane, Priority.ALWAYS);
    vbox.getChildren().addAll(panel, vsPane);

    Scene scene = new Scene(vbox, 600, 400);
    primaryStage.setScene(scene);
    area.requestFocus();
    primaryStage.setTitle("Font Size Switching Test");
    primaryStage.show();
}
 
开发者ID:FXMisc,项目名称:RichTextFX,代码行数:27,代码来源:FontSizeSwitcher.java

示例5: start

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    Consumer<String> showLink = (string) -> {
        try
        {
            Desktop.getDesktop().browse(new URI(string));
        }
        catch (IOException | URISyntaxException e)
        {
            throw new RuntimeException(e);
        }
    };
    TextHyperlinkArea area = new TextHyperlinkArea(showLink);

    area.appendText("Some text in the area\n");
    area.appendWithLink("Google.com", "http://www.google.com");

    VirtualizedScrollPane<TextHyperlinkArea> vsPane = new VirtualizedScrollPane<>(area);

    Scene scene = new Scene(vsPane, 500, 500);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:FXMisc,项目名称:RichTextFX,代码行数:24,代码来源:HyperlinkDemo.java

示例6: start

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    Button red = createColorButton(Color.RED, "red");
    Button green = createColorButton(Color.GREEN, "green");
    Button blue = createColorButton(Color.BLUE, "blue");
    Button bold = createBoldButton("bold");
    HBox panel = new HBox(red, green, blue, bold);

    VirtualizedScrollPane<StyleClassedTextArea> vsPane = new VirtualizedScrollPane<>(area);
    VBox.setVgrow(vsPane, Priority.ALWAYS);
    area.setWrapText(true);
    VBox vbox = new VBox(panel, vsPane);

    Scene scene = new Scene(vbox, 600, 400);
    scene.getStylesheets().add(ManualHighlighting.class.getResource("manual-highlighting.css").toExternalForm());
    primaryStage.setScene(scene);
    primaryStage.setTitle("Manual Highlighting Demo");
    primaryStage.show();

    area.requestFocus();
}
 
开发者ID:FXMisc,项目名称:RichTextFX,代码行数:22,代码来源:ManualHighlighting.java

示例7: start

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的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

示例8: run

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
public void run() {
    tabs.stream()
            .map(tab -> {
                Path path = (Path) tab.getUserData();

                VirtualizedScrollPane scrollPane = (VirtualizedScrollPane) tab.getContent();
                CodeArea codeArea = (CodeArea) scrollPane.getContent();
                String lines = codeArea.getText();

                return new ExistFileToSave(lines, path);
            })
            .forEach(ExistFileToSave::save);
}
 
开发者ID:MrChebik,项目名称:Coconut-IDE,代码行数:15,代码来源:SaveTabs.java

示例9: initialize

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
    choiceCollectionAlgorithm.setItems(FXCollections.observableArrayList(Algorithm.getCollectionAlgorithms()));
    choiceCollectionAlgorithm.getSelectionModel().selectFirst();

    choiceSpecie.setItems(FXCollections.observableArrayList(Specie.getSpecies()));
    choiceSpecie.getSelectionModel().selectFirst();

    VirtualizedScrollPane virtualizedScrollPane = new VirtualizedScrollPane<>(new ScriptEditorView());
    VBox.setVgrow(virtualizedScrollPane, Priority.ALWAYS);
   // vBoxScript.getChildren().add(virtualizedScrollPane);
}
 
开发者ID:AdrianBZG,项目名称:IEMLS,代码行数:13,代码来源:CollectorConfigurationController.java

示例10: initialize

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
    choiceExplorationAlgorithm.setItems(FXCollections.observableArrayList(Algorithm.getExplorationAlgorithms()));
    choiceExplorationAlgorithm.getSelectionModel().selectFirst();

    choiceSpecie.setItems(FXCollections.observableArrayList(Specie.getSpecies()));
    choiceSpecie.getSelectionModel().selectFirst();

    VirtualizedScrollPane virtualizedScrollPane = new VirtualizedScrollPane<>(new ScriptEditorView());
    VBox.setVgrow(virtualizedScrollPane, Priority.ALWAYS);
 //   vBoxScript.getChildren().add(virtualizedScrollPane);
}
 
开发者ID:AdrianBZG,项目名称:IEMLS,代码行数:13,代码来源:ExplorerConfigurationController.java

示例11: createNodes

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
private void createNodes() {
	textArea = new PreviewStyledTextArea();
	textArea.setWrapText(true);
	textArea.getStylesheets().add("org/markdownwriterfx/prism.css");

	scrollPane = new VirtualizedScrollPane<>(textArea);
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:8,代码来源:HtmlSourcePreview.java

示例12: createNodes

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
private void createNodes() {
	textArea = new PreviewStyledTextArea();
	textArea.getStyleClass().add("ast-preview");
	textArea.getStylesheets().add("org/markdownwriterfx/prism.css");

	scrollPane = new VirtualizedScrollPane<>(textArea);
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:8,代码来源:ASTPreview.java

示例13: bindToEntry

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
protected void bindToEntry(BibEntry entry) {
    CodeArea codeArea = createSourceEditor();
    VirtualizedScrollPane<CodeArea> node = new VirtualizedScrollPane<>(codeArea);
    NotificationPane notificationPane = new NotificationPane(node);
    notificationPane.setShowFromTop(false);
    sourceValidator.getValidationStatus().getMessages().addListener((ListChangeListener<ValidationMessage>) c -> {
        if (sourceValidator.getValidationStatus().isValid()) {
            notificationPane.hide();
        } else {
            sourceValidator.getValidationStatus().getHighestMessage().ifPresent(validationMessage -> notificationPane.show(validationMessage.getMessage()));
        }
    });
    this.setContent(codeArea);

    // Store source for every change in the source code
    // and update source code for every change of entry field values
    BindingsHelper.bindContentBidirectional(entry.getFieldsObservable(), codeArea.textProperty(), this::storeSource, fields -> {
        DefaultTaskExecutor.runInJavaFXThread(() -> {
            codeArea.clear();
            try {
                codeArea.appendText(getSourceString(entry, mode, fieldFormatterPreferences));
            } catch (IOException ex) {
                codeArea.setEditable(false);
                codeArea.appendText(ex.getMessage() + "\n\n" +
                        Localization.lang("Correct the entry, and reopen editor to display/edit source."));
                LOGGER.debug("Incorrect entry", ex);
            }
        });
    });
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:32,代码来源:SourceTab.java

示例14: start

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    executor = Executors.newSingleThreadExecutor();
    codeArea = new CodeArea();
    codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea));
    codeArea.richChanges()
            .filter(ch -> !ch.getInserted().equals(ch.getRemoved())) // XXX
            .successionEnds(Duration.ofMillis(500))
            .supplyTask(this::computeHighlightingAsync)
            .awaitLatest(codeArea.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, 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 Async Demo");
    primaryStage.show();
}
 
开发者ID:FXMisc,项目名称:RichTextFX,代码行数:28,代码来源:JavaKeywordsAsync.java

示例15: start

import org.fxmisc.flowless.VirtualizedScrollPane; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    StyleClassedTextArea textArea = new StyleClassedTextArea();
    textArea.setWrapText(true);

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

    // load the dictionary
    try (InputStream input = getClass().getResourceAsStream("spellchecking.dict");
         BufferedReader br = new BufferedReader(new InputStreamReader(input))) {
        String line;
        while ((line = br.readLine()) != null) {
            dictionary.add(line);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    // load the sample document
    InputStream input2 = getClass().getResourceAsStream("spellchecking.txt");
    try(java.util.Scanner s = new java.util.Scanner(input2)) { 
        String document = s.useDelimiter("\\A").hasNext() ? s.next() : "";
        textArea.replaceText(0, 0, document);
    }

    Scene scene = new Scene(new StackPane(new VirtualizedScrollPane<>(textArea)), 600, 400);
    scene.getStylesheets().add(getClass().getResource("spellchecking.css").toExternalForm());
    primaryStage.setScene(scene);
    primaryStage.setTitle("Spell Checking Demo");
    primaryStage.show();
}
 
开发者ID:FXMisc,项目名称:RichTextFX,代码行数:36,代码来源:SpellChecking.java


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