本文整理汇总了Java中com.jfoenix.controls.JFXTextArea类的典型用法代码示例。如果您正苦于以下问题:Java JFXTextArea类的具体用法?Java JFXTextArea怎么用?Java JFXTextArea使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JFXTextArea类属于com.jfoenix.controls包,在下文中一共展示了JFXTextArea类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
public void show() {
textArea = new JFXTextArea(bodyText);
JFXDialogLayout content = new JFXDialogLayout();
content.setHeading(new Text(headingText));
content.setBody(textArea);
content.setPrefSize(dialogWidth, dialogHeight);
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton button = new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
dialog.close();
}
});
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
button.setPrefHeight(32);
button.setStyle(dialogBtnStyle);
content.setActions(button);
pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
dialog.show();
}
示例2: addBigString
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
/**
* Add a large String to a wizard step. A TextArea will be used to represent
* it.
*
* @param fieldName
* @param defaultValue
* the default String the textfield will contains.
* @param prompt
* the text to show on the textfield prompt String.
* @return
*/
@SuppressWarnings("unchecked")
public WizardStepBuilder addBigString(final String fieldName, final String defaultValue, final String prompt)
{
final JFXTextArea text = new JFXTextArea();
text.setPromptText(prompt);
text.setText(defaultValue);
this.current.getData().put(fieldName, new SimpleStringProperty());
this.current.getData().get(fieldName).bind(text.textProperty());
text.setMaxWidth(400);
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(text, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
this.current.add(text, 1, this.current.getData().size() - 1);
return this;
}
示例3: handleControlPropertyChanged
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
@Override
protected void handleControlPropertyChanged(String propertyReference) {
if("LABEL_FLOAT".equals(propertyReference)){
boolean isLabelFloat = ((JFXTextArea) getSkinnable()).isLabelFloat();
if (isLabelFloat) {
JFXUtilities.runInFX(this::createFloatingLabel);
} else {
if(promptText!=null){
// remove parent focus listener to prevent editor class cast exception
promptText.visibleProperty().bind(usePromptText);
}
}
// update prompt text position
if(isLabelFloat && getSkinnable().getText() != null)
animateFloatingLabel(!getSkinnable().getText().isEmpty());
} else if ("DISABLE_ANIMATION".equals(propertyReference)) {
// remove error clip if animation is disabled
errorContainer.setClip(((JFXTextArea) getSkinnable()).isDisableAnimation() ?
null : errorContainerClip);
} else {
super.handleControlPropertyChanged(propertyReference);
}
}
示例4: unFocus
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
private void unFocus() {
focusTimer.stop();
scale.setX(initScale);
focusedLine.setOpacity(0);
if (oldPromptTextFill != null && ((JFXTextArea) getSkinnable()).isLabelFloat()) {
animatedPromptTextFill.set(oldPromptTextFill);
if (usePromptText()) {
unfocusTimer.start();
}
}
}
示例5: getTextArea
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
public JFXTextArea getTextArea() {
return textArea;
}
示例6: setTextArea
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
public void setTextArea(JFXTextArea textArea) {
this.textArea = textArea;
}
示例7: custom
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
public custom(JFXTextArea area) {
this.textArea = area;
}
示例8: start
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
@Override
public void start(Stage stage) {
VBox main = new VBox();
main.setSpacing(50);
TextArea javafxTextArea = new TextArea();
javafxTextArea.setPromptText("JavaFX Text Area");
main.getChildren().add(javafxTextArea);
JFXTextArea jfxTextArea = new JFXTextArea();
jfxTextArea.setPromptText("JFoenix Text Area :D");
jfxTextArea.setLabelFloat(true);
RequiredFieldValidator validator = new RequiredFieldValidator();
// NOTE adding error class to text area is causing the cursor to disapper
validator.setMessage("Please type something!");
validator.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class)
.glyph(FontAwesomeIcon.WARNING)
.size("1em")
.styleClass("error")
.build());
jfxTextArea.getValidators().add(validator);
jfxTextArea.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal) {
jfxTextArea.validate();
}
});
main.getChildren().add(jfxTextArea);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(100));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 800, 600);
scene.getStylesheets()
.add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX Button Demo");
stage.setScene(scene);
stage.show();
}
示例9: layoutChildren
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
super.layoutChildren(x, y, w, h);
// change control properties if and only if animations are stopped
if (!focusTimer.isRunning() && !unfocusTimer.isRunning()) {
if (getSkinnable().isFocused() && ((JFXTextArea) getSkinnable()).isLabelFloat()) {
animatedPromptTextFill.set(((JFXTextArea) getSkinnable()).getFocusColor());
}
}
if (invalid) {
invalid = false;
animatedPromptTextFill.set(promptTextFill.get());
// set the default background of text area viewport to white
Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
CornerRadii.EMPTY,
Insets.EMPTY)));
// reapply css of scroll pane in case set by the user
viewPort.applyCss();
// create floating label
focusTimer.setCacheNodes(promptContainer);
unfocusTimer.setCacheNodes(promptContainer);
createFloatingLabel();
// to position the prompt node properly
super.layoutChildren(x, y, w, h);
// update validation container
final ValidatorBase activeValidator = ((JFXTextArea) getSkinnable()).getActiveValidator();
if (activeValidator != null) {
showError(activeValidator);
final double errorContainerWidth = w - errorIcon.prefWidth(-1);
errorContainer.setOpacity(1);
errorContainer.resize(w, computeErrorHeight(errorContainerWidth));
errorContainerClip.setWidth(w);
errorContainerClip.setHeight(errorContainer.getHeight());
errorClipScale.setY(1);
}
// focus
if (getSkinnable().isFocused()) {
focus();
}
}
final double height = h - focusedLine.prefHeight(-1);
focusedLine.resizeRelocate(x, height, w, focusedLine.prefHeight(-1));
line.resizeRelocate(x, height, w, line.prefHeight(-1));
errorContainer.relocate(x, y);
// resize error container if animation is disabled
if (((JFXTextArea) getSkinnable()).isDisableAnimation()) {
errorContainer.resize(w, computeErrorHeight(computeErrorWidth(w)));
}else{
errorContainer.resize(w, errorContainer.getHeight());
errorContainerClip.setWidth(w);
}
errorContainer.setTranslateY(h + focusedLine.getHeight() + 4);
scale.setPivotX(w / 2);
}
示例10: layoutChildren
import com.jfoenix.controls.JFXTextArea; //导入依赖的package包/类
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
super.layoutChildren(x, y, w, h);
// change control properties if and only if animations are stopped
if (!focusTimer.isRunning() && !unfocusTimer.isRunning()) {
if (getSkinnable().isFocused() && ((JFXTextArea) getSkinnable()).isLabelFloat()) {
animatedPromptTextFill.set(((JFXTextArea) getSkinnable()).getFocusColor());
}
}
if (invalid) {
invalid = false;
animatedPromptTextFill.set(promptTextFill.get());
// set the default background of text area viewport to white
Region viewPort = (Region) scrollPane.getChildrenUnmodifiable().get(0);
viewPort.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
CornerRadii.EMPTY,
Insets.EMPTY)));
// reapply css of scroll pane in case set by the user
viewPort.applyCss();
// create floating label
focusTimer.setCacheNodes(promptContainer);
unfocusTimer.setCacheNodes(promptContainer);
createFloatingLabel();
// to position the prompt node properly
super.layoutChildren(x, y, w, h);
// update validation container
final ValidatorBase activeValidator = ((JFXTextArea) getSkinnable()).getActiveValidator();
if (activeValidator != null) {
showError(activeValidator);
final double errorContainerWidth = w - errorIcon.prefWidth(-1);
errorContainer.setOpacity(1);
errorContainer.resize(w, computeErrorHeight(errorContainerWidth));
errorContainerClip.setWidth(w);
errorContainerClip.setHeight(errorContainer.getHeight());
errorClipScale.setY(1);
}
// focus
if (getSkinnable().isFocused()) {
focus();
}
}
final double height = h - focusedLine.prefHeight(-1);
focusedLine.resizeRelocate(x, height, w, focusedLine.prefHeight(-1));
line.resizeRelocate(x, height, w, line.prefHeight(-1));
errorContainer.relocate(x, y);
// resize error container if animation is disabled
if (((JFXTextArea) getSkinnable()).isDisableAnimation()) {
errorContainer.resize(w, computeErrorHeight(computeErrorWidth(w)));
}
errorContainer.setTranslateY(h + focusedLine.getHeight() + 4);
scale.setPivotX(w / 2);
}