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


Java HTMLEditor类代码示例

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


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

示例1: start

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
@Override
public void start(Stage stage) {
    stage.setTitle("HTMLEditor Sample");
    stage.setWidth(650);
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();     
    root.setPadding(new Insets(8, 8, 8, 8));
    root.setSpacing(5);
    root.setAlignment(Pos.BOTTOM_LEFT);
 
    final HTMLEditor htmlEditor = new HTMLEditor();
    htmlEditor.setPrefHeight(245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
           
    final WebView browser = new WebView();
    final WebEngine webEngine = browser.getEngine();
    
 
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setStyle("-fx-background-color: white");
    scrollPane.setContent(browser);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefHeight(180);
 
    Button showHTMLButton = new Button("Load Content in Browser");
    root.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction((ActionEvent arg0) -> {
        webEngine.loadContent(htmlEditor.getHtmlText());
    });
    
    root.getChildren().addAll(htmlEditor, showHTMLButton, scrollPane);
    scene.setRoot(root);
 
    stage.setScene(scene);
    stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:40,代码来源:HTMLEditorSample.java

示例2: select

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
@Test public void select() {
    HTMLEditor htmlEditorNode = (HTMLEditor) getPrimaryStage().getScene().getRoot().lookup(".html-editor");
    Platform.runLater(() -> {
        htmlEditor.marathon_select("This html editor test");
    });
    try {
        new Wait("Waiting for html text to be set.") {
            @Override public boolean until() {
                String htmlText = htmlEditorNode.getHtmlText();
                return htmlText.equals(
                        "<html dir=\"ltr\"><head></head><body contenteditable=\"true\">This html editor test</body></html>");
            }
        };
    } catch (Throwable t) {
    }
    AssertJUnit.assertEquals(
            "<html dir=\"ltr\"><head></head><body contenteditable=\"true\">This html editor test</body></html>",
            htmlEditor.getText());
    AssertJUnit.assertEquals(
            "<html dir=\"ltr\"><head></head><body contenteditable=\"true\">This html editor test</body></html>",
            htmlEditorNode.getHtmlText());
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:JavaFXHTMLEditorTest.java

示例3: getText

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
@Test public void getText() {
    HTMLEditor editor = (HTMLEditor) getPrimaryStage().getScene().getRoot().lookup(".html-editor");
    LoggingRecorder lr = new LoggingRecorder();
    String text = "This is a test text";
    final String htmlText = "<html><font color=\"RED\"><h1><This is also content>" + text + "</h1></html>";
    List<String> attributeText = new ArrayList<>();
    Platform.runLater(() -> {
        RFXHTMLEditor rfxhtmlEditor = new RFXHTMLEditor(editor, null, null, lr);
        editor.setHtmlText(htmlText);
        rfxhtmlEditor.focusLost(null);
        attributeText.add(rfxhtmlEditor.getAttribute("text"));
    });
    new Wait("Waiting for html editor text.") {
        @Override public boolean until() {
            return attributeText.size() > 0;
        }
    };
    AssertJUnit.assertEquals(htmlText, attributeText.get(0));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:RFXHTMLEditorTest.java

示例4: WysiwygDlg

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
private WysiwygDlg(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    try {
        setIconImage(ImageIO
            .read(FAdmin.class
                .getResource("/ru/apertum/qsystem/client/forms/resources/admin.png")));
    } catch (IOException ex) {
        System.err.println(ex);
    }

    panel.removeAll();
    javafxPanel = new JFXPanel();
    Platform.runLater(() -> {
        htmlEditor = new HTMLEditor();
        Scene scene = new Scene(htmlEditor, 750, 500, Color.web("#666970"));
        javafxPanel.setScene(scene);
    });
    final GridLayout gl = new GridLayout(1, 1);
    panel.setLayout(gl);
    panel.add(javafxPanel);
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:24,代码来源:WysiwygDlg.java

示例5: createScene

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
private Scene createScene(String url) {
    view = new WebView();
    htmlEditor =  new HTMLEditor();

    view.getEngine().load(url);

    final VBox box = new VBox();
    view.setMaxHeight(300);
    view.setMinHeight(300);
    htmlEditor.setMaxHeight(300);
    htmlEditor.setMinHeight(300);
    box.getChildren().addAll(view, htmlEditor);

    final Scene scene = new Scene(box);

    scene.setFill(Color.GRAY);
    return scene;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:19,代码来源:RichTextLauncher.java

示例6: createVisualisation

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
@Override
public Node createVisualisation(SimpleObjectProperty<String> attributeValue, boolean readonly) {
    HTMLEditor htmlEditor = new HTMLEditor();

    changeListener = (observable, oldValue, newValue) -> htmlEditor.setHtmlText(newValue);
    attributeValue.addListener(new WeakChangeListener<>(changeListener));
    htmlEditor.setDisable(readonly);


    BorderPane borderPane = new BorderPane();
    borderPane.setCenter(htmlEditor);
    Button save = new Button("save");//strangely workaround HTMLEditor have no bind or change events
    save.setOnAction(event -> attributeValue.set(htmlEditor.getHtmlText()));
    htmlEditor.setHtmlText(attributeValue.get());
    BorderPane.setMargin(save,new Insets(3,0,3,0));
    borderPane.setTop(save);
    return borderPane;
}
 
开发者ID:factoryfx,项目名称:factoryfx,代码行数:19,代码来源:StringHtmlAttributeVisualisation.java

示例7: OwnNoteHTMLEditor

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
public OwnNoteHTMLEditor(final HTMLEditor htmlEditor, final OwnNoteEditor editor) {
    super();
    myHTMLEditor = htmlEditor;
    myEditor = editor;

    mWebView = (WebView) myHTMLEditor.lookup(WEB_VIEW);
    mWebEngine = mWebView.getEngine();
    mWebPage = Accessor.getPageFor(mWebEngine);
    
    rawViewer = new RawViewer();
    
    // delay setup of editor - things are not available at startup...
    Platform.runLater(() -> {
        initHTMLEditor();
    });  
}
 
开发者ID:ThomasDaheim,项目名称:ownNoteEditor,代码行数:17,代码来源:OwnNoteHTMLEditor.java

示例8: showArticle

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
public static void showArticle(String content) {
	AlertDialog alertDialog = new AlertDialog.Builder()
		.view("dialog_article_detail")
		.title("��������")
		.build();
	HTMLEditor htmlEditor = alertDialog.findView("#et_html", HTMLEditor.class);
	htmlEditor.setDisable(true);
	htmlEditor.setHtmlText(content);
	alertDialog.show();
}
 
开发者ID:coding-dream,项目名称:Notebook,代码行数:11,代码来源:DialogHelper.java

示例9: init

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    VBox vRoot = new VBox();

    vRoot.setPadding(new Insets(8, 8, 8, 8));
    vRoot.setSpacing(5);

    htmlEditor = new HTMLEditor();
    htmlEditor.setPrefSize(500, 245);
    htmlEditor.setHtmlText(INITIAL_TEXT);
    vRoot.getChildren().add(htmlEditor);

    final Label htmlLabel = new Label();
    htmlLabel.setMaxWidth(500);
    htmlLabel.setWrapText(true);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.getStyleClass().add("noborder-scroll-pane");
    scrollPane.setContent(htmlLabel);
    scrollPane.setFitToWidth(true);
    scrollPane.setPrefHeight(180);

    Button showHTMLButton = new Button("Show the HTML below");
    vRoot.setAlignment(Pos.CENTER);
    showHTMLButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent arg0) {
            htmlLabel.setText(htmlEditor.getHtmlText());
        }
    });

    vRoot.getChildren().addAll(showHTMLButton, scrollPane);
    root.getChildren().addAll(vRoot);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:HTMLEditorApp.java

示例10: reset

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
public static void reset() {
    add(Node.class, JavaFXElement.class);
    add(TextInputControl.class, JavaFXTextInputControlElement.class);
    add(HTMLEditor.class, JavaFXHTMLEditor.class);
    add(CheckBox.class, JavaFXCheckBoxElement.class);
    add(ToggleButton.class, JavaFXToggleButtonElement.class);
    add(Slider.class, JavaFXSliderElement.class);
    add(Spinner.class, JavaFXSpinnerElement.class);
    add(SplitPane.class, JavaFXSplitPaneElement.class);
    add(ProgressBar.class, JavaFXProgressBarElement.class);
    add(ChoiceBox.class, JavaFXChoiceBoxElement.class);
    add(ColorPicker.class, JavaFXColorPickerElement.class);
    add(ComboBox.class, JavaFXComboBoxElement.class);
    add(DatePicker.class, JavaFXDatePickerElement.class);
    add(TabPane.class, JavaFXTabPaneElement.class);
    add(ListView.class, JavaFXListViewElement.class);
    add(TreeView.class, JavaFXTreeViewElement.class);
    add(TableView.class, JavaFXTableViewElement.class);
    add(TreeTableView.class, JavaFXTreeTableViewElement.class);
    add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class);
    add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class);
    add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class);
    add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
    add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class);
    add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class);
    add(TableCell.class, JavaFXTableViewCellElement.class);
    add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
    add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class);
    add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class);
    add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
    add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
    add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class);
    add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:35,代码来源:JavaFXElementFactory.java

示例11: select

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
@Test public void select() {
    HTMLEditor editor = (HTMLEditor) getPrimaryStage().getScene().getRoot().lookup(".html-editor");
    LoggingRecorder lr = new LoggingRecorder();
    String text = "This is a test text";
    final String htmlText = "<html><font color=\"RED\"><h1><This is also content>" + text + "</h1></html>";
    Platform.runLater(() -> {
        RFXHTMLEditor rfxhtmlEditor = new RFXHTMLEditor(editor, null, null, lr);
        editor.setHtmlText(htmlText);
        rfxhtmlEditor.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals(htmlText, recording.getParameters()[0]);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:RFXHTMLEditorTest.java

示例12: createScene

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
private void createScene(final String toDisplay)
{
    Platform.runLater(new Runnable()
    {
        @Override
        public void run()
        {
            htmlEditor = new HTMLEditor();
            htmlEditor.setPrefHeight(245 * ProjectGoldStarsX.multiplier);
            htmlEditor.setHtmlText(toDisplay);
            jfxPanel.setScene(new Scene(htmlEditor));
        }
    });
}
 
开发者ID:ShakeelAlibhai,项目名称:ProjectGoldStarsX,代码行数:15,代码来源:NotesView.java

示例13: createScene

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
private void createScene()
{
    Platform.runLater(new Runnable()
    {
        @Override
        public void run()
        {
            htmlEditor = new HTMLEditor();
            htmlEditor.setPrefHeight(245 * ProjectGoldStarsX.multiplier);
            jfxPanel.setScene(new Scene(htmlEditor));
        }
    });
}
 
开发者ID:ShakeelAlibhai,项目名称:ProjectGoldStarsX,代码行数:14,代码来源:NotesCreate.java

示例14: getTestNod

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
Node getTestNod() {
	/* [시작] 분석하고자하는 UI구조 */
	BorderPane borderPane = new BorderPane();
	ScrollPane scrollPane2 = new ScrollPane();
	scrollPane2.setContent(new TextArea());
	borderPane.setTop(new HBox(new Button(), new Button(), new HTMLEditor()));
	borderPane.setCenter(new BorderPane(scrollPane2));
	/* [끝] 분석하고자하는 UI구조 */
	return borderPane;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:11,代码来源:FxControlsTreeViewExam.java

示例15: reset

import javafx.scene.web.HTMLEditor; //导入依赖的package包/类
void reset() {
        resetBtn.mouse().click();

        webView = parent.lookup(WebView.class).wrap();
        webView.mouse().click();

        htmlEditor = parent.lookup(HTMLEditor.class).wrap();
        htmlEditorAsParent = htmlEditor.as(Parent.class, Node.class);

        cut = parent.lookup(Button.class).wrap(0);
        copy = parent.lookup(Button.class).wrap(1);
        paste = parent.lookup(Button.class).wrap(2);
//        undo = parent.lookup(Button.class).wrap(3);
//        redo = parent.lookup(Button.class).wrap(4);
        left = parent.lookup(ToggleButton.class).wrap(0);
        center = parent.lookup(ToggleButton.class).wrap(1);
        right = parent.lookup(ToggleButton.class).wrap(2);
        adjust = parent.lookup(ToggleButton.class).wrap(3);
        bullets = parent.lookup(ToggleButton.class).wrap(4);
        numbers = parent.lookup(ToggleButton.class).wrap(5);
        indent = parent.lookup(Button.class).wrap(3);
        removeIndent = parent.lookup(Button.class).wrap(4);
        separator = parent.lookup(Button.class).wrap(5);

        paragraph = parent.lookup(ComboBox.class).wrap(0);
        fontStyle = parent.lookup(ComboBox.class).wrap(1);
        fontSize = parent.lookup(ComboBox.class).wrap(2);

        bold = parent.lookup(ToggleButton.class).wrap(6);
        italic = parent.lookup(ToggleButton.class).wrap(7);
        underline = parent.lookup(ToggleButton.class).wrap(8);
        crossed = parent.lookup(ToggleButton.class).wrap(9);

        foreground = parent.lookup(ColorPicker.class).wrap(0);
        background = parent.lookup(ColorPicker.class).wrap(1);
        setDefaultFont();
    }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:38,代码来源:RichTextEditorTest.java


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