本文整理汇总了Java中javafx.scene.control.ChoiceBox.setPrefHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ChoiceBox.setPrefHeight方法的具体用法?Java ChoiceBox.setPrefHeight怎么用?Java ChoiceBox.setPrefHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ChoiceBox
的用法示例。
在下文中一共展示了ChoiceBox.setPrefHeight方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildEyeTrackerConfigChooser
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
private static ChoiceBox<EyeTracker> buildEyeTrackerConfigChooser(Configuration configuration,
ConfigurationContext configurationContext) {
ChoiceBox<EyeTracker> choiceBox = new ChoiceBox<>();
choiceBox.getItems().addAll(EyeTracker.values());
EyeTracker selectedEyeTracker = findSelectedEyeTracker(configuration);
choiceBox.getSelectionModel().select(selectedEyeTracker);
choiceBox.setPrefWidth(prefWidth);
choiceBox.setPrefHeight(prefHeight);
choiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<EyeTracker>() {
@Override
public void changed(ObservableValue<? extends EyeTracker> observable, EyeTracker oldValue,
EyeTracker newValue) {
final String newPropertyValue = newValue.name();
ConfigurationBuilder.createFromPropertiesResource().withEyeTracker(newPropertyValue)
.saveConfigIgnoringExceptions();
}
});
return choiceBox;
}
示例2: buildFixLengthChooserMenu
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
private static ChoiceBox<Double> buildFixLengthChooserMenu(Configuration configuration,
ConfigurationContext configurationContext) {
ChoiceBox<Double> choiceBox = new ChoiceBox<>();
int i = 300;
choiceBox.getItems().add((double) configuration.getFixationlength() / 1000);
while (i <= 30000) {
choiceBox.getItems().add(((double) i) / 1000);
i = i + 100;
}
choiceBox.getSelectionModel().select(0);
choiceBox.setPrefWidth(prefWidth);
choiceBox.setPrefHeight(prefHeight);
choiceBox.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
final int newPropertyValue = (int) (1000
* (double) choiceBox.getItems().get(Integer.parseInt(newValue.intValue() + "")));
ConfigurationBuilder.createFromPropertiesResource().withFixationLength(newPropertyValue)
.saveConfigIgnoringExceptions();
}
});
return choiceBox;
}
示例3: buildQuestionLengthChooserMenu
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
private static ChoiceBox<Double> buildQuestionLengthChooserMenu(Configuration configuration,
ConfigurationContext configurationContext) {
ChoiceBox<Double> choiceBox = new ChoiceBox<>();
int i = 500;
choiceBox.getItems().add((double) configuration.getQuestionLength() / 1000);
while (i <= 20000) {
choiceBox.getItems().add(((double) i) / 1000);
i = i + 500;
}
choiceBox.getSelectionModel().select(0);
choiceBox.setPrefWidth(prefWidth);
choiceBox.setPrefHeight(prefHeight);
choiceBox.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
final int newPropertyValue = (int) (1000
* (double) choiceBox.getItems().get(Integer.parseInt(newValue.intValue() + "")));
ConfigurationBuilder.createFromPropertiesResource().withQuestionLength(newPropertyValue)
.saveConfigIgnoringExceptions();
}
});
return choiceBox;
}
示例4: buildLanguageChooser
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
private static ChoiceBox<Languages> buildLanguageChooser(Configuration configuration,
ConfigurationContext configurationContext) {
Languages currentLanguage = null;
if (configuration.getLanguage() != null) {
currentLanguage = Languages.valueOf(configuration.getLanguage());
}
ChoiceBox<Languages> choiceBox = new ChoiceBox<>();
choiceBox.getItems().addAll(Languages.values());
choiceBox.getSelectionModel().select(currentLanguage);
choiceBox.setPrefWidth(prefWidth);
choiceBox.setPrefHeight(prefHeight);
choiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Languages>() {
@Override
public void changed(ObservableValue<? extends Languages> observable, Languages oldValue,
Languages newValue) {
ConfigurationBuilder.createFromPropertiesResource().withLanguage(newValue.name())
.saveConfigIgnoringExceptions();
configurationContext.getGazePlay().getHomeMenuScreen().onLanguageChanged();
GridPane gridPane = buildConfigGridPane(configurationContext);
configurationContext.getRoot().setCenter(null);
configurationContext.getRoot().setCenter(gridPane);
}
});
return choiceBox;
}
示例5: buildStyleThemeChooser
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
/**
* Fonction to use to permit to user to select between several theme
*/
private static ChoiceBox<Themes> buildStyleThemeChooser(Configuration configuration,
ConfigurationContext configurationContext) {
ChoiceBox<Themes> themesBox = new ChoiceBox<>();
Themes[] TThemes = Themes.values();
int firstPos = 1;
for (int i = 0; i < TThemes.length; i++) {
themesBox.getItems().add(TThemes[i]);
}
final String cssfile = configuration.getCssfile();
if (cssfile.indexOf("orange") > 0) {
themesBox.getSelectionModel().select(0);
} else if (cssfile.indexOf("green") > 0) {
themesBox.getSelectionModel().select(1);
} else if (cssfile.indexOf("light-blue") > 0) {
themesBox.getSelectionModel().select(2);
} else
themesBox.getSelectionModel().select(3);
themesBox.setPrefWidth(prefWidth);
themesBox.setPrefHeight(prefHeight);
themesBox.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
log.info(newValue + "");
String newPropertyValue;
if (TThemes[newValue.intValue()].toString().equals("green"))
newPropertyValue = "data/stylesheets/main-green.css";
else if (TThemes[newValue.intValue()].toString().equals("blue"))
newPropertyValue = "data/stylesheets/main-blue.css";
else if (TThemes[newValue.intValue()].toString().equals("light_blue"))
newPropertyValue = "data/stylesheets/main-light-blue.css";
else
newPropertyValue = "data/stylesheets/main-orange.css";
ConfigurationBuilder.createFromPropertiesResource().withCssFile(newPropertyValue)
.saveConfigIgnoringExceptions();
Scene scene = configurationContext.getScene();
scene.getStylesheets().remove(0);
scene.getStylesheets().add(newPropertyValue);
log.info(scene.getStylesheets().toString());
}
});
return themesBox;
}
示例6: start
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) {
final TextArea testText = TextAreaBuilder.create()
.text("Test")
.prefHeight(50)
.prefWidth(500)
.build();
final ChoiceBox<Interpolator> interpolatorChoiceBox = new ChoiceBox<Interpolator>();
interpolatorChoiceBox.getItems().addAll(FXCollections.observableArrayList(
Interpolator.LINEAR,
Interpolator.DISCRETE,
Interpolator.EASE_BOTH,
Interpolator.EASE_IN,
Interpolator.EASE_OUT
));
interpolatorChoiceBox.setPrefHeight(25);
interpolatorChoiceBox.setPrefWidth(500);
interpolatorChoiceBox.getSelectionModel().selectFirst();
final Text lcdText = TextBuilder.create()
.x(100)
.y(100)
.fontSmoothingType(FontSmoothingType.LCD)
.build();
lcdText.textProperty().bind(testText.textProperty());
final Circle point = CircleBuilder.create()
.centerX(100)
.centerY(100)
.radius(2)
.fill(Color.RED)
.build();
Pane root = VBoxBuilder.create()
.children(
PaneBuilder.create()
.minWidth(500)
.minHeight(500)
.children(
lcdText,
point)
.onMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
point.setCenterX(event.getX());
point.setCenterY(event.getY());
TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.seconds(5),
new KeyValue(lcdText.xProperty(), event.getX(),
interpolatorChoiceBox.getSelectionModel().getSelectedItem())),
new KeyFrame(Duration.seconds(5),
new KeyValue(lcdText.yProperty(), event.getY(),
interpolatorChoiceBox.getSelectionModel().getSelectedItem()))
)
.build()
.play();
}
})
.build(),
testText,
interpolatorChoiceBox)
.build();
Scene scene = new Scene(root, 500, 575);
primaryStage.setTitle("Test Animnation LCD Text");
primaryStage.setResizable(false);
primaryStage.setScene(scene);
primaryStage.show();
}