本文整理汇总了Java中javafx.scene.control.TextField.setEditable方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setEditable方法的具体用法?Java TextField.setEditable怎么用?Java TextField.setEditable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TextField
的用法示例。
在下文中一共展示了TextField.setEditable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createField
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void createField() {
field = new TextField(getString());
field.setEditable(false);
field.addEventFilter(KeyEvent.KEY_PRESSED, e -> {
if (e.getCode() == KeyCode.ENTER) {
try {
commitEdit(KeyCombination.valueOf(field.getText()));
} catch (Exception ee) {
cancelEdit();
}
} else if (e.getCode() == KeyCode.ESCAPE) {
cancelEdit();
} else {
field.setText(convert(e).toString());
}
e.consume();
});
}
示例2: getActionPane
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private VBox getActionPane(){
progress= new Text("Office\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");
Image iconf= new Image(Office_Entry.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);
Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);
txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");
txtsearch= new TextField();
initFilter();
Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");
Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
setAddAttendance();
});
btnView.setOnAction(e -> {
timelineDown.play();
});
btnCloseView.setOnAction(e -> {
timelineUp.play();
});
VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);
HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);
VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));
HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
}
示例3: createNameField
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private VBox createNameField() {
VBox nameFieldBox = new VBox();
TextField nameField = new TextField();
nameField.textProperty().addListener((observable, oldValue, newValue) -> {
fireContentChanged();
checkList.setName(nameField.getText());
});
nameField.setEditable(mode.isSelectable());
nameFieldBox.getChildren().addAll(new Label("Name"), nameField);
HBox.setHgrow(nameField, Priority.ALWAYS);
VBox.setMargin(nameFieldBox, new Insets(5, 10, 0, 5));
nameField.setText(checkList.getName());
HBox.setHgrow(nameFieldBox, Priority.ALWAYS);
return nameFieldBox;
}
示例4: setFieldStyle
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void setFieldStyle(TextField aTextField, FieldType aType) {
switch (aType) {
case READ_ONLY:
aTextField.setEditable(false);
aTextField.setStyle(FxStyle.READ_ONLY);
break;
case ERRONEOUS:
aTextField.setEditable(false);
aTextField.setStyle(FxStyle.READ_ONLY_ERROR);
break;
default:
aTextField.setEditable(true);
break;
}
}
示例5: createLibrariesFolderControl
import javafx.scene.control.TextField; //导入方法依赖的package包/类
/**
* Create the libraries folder control.
*/
@FXThread
private void createLibrariesFolderControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_USER_LIBRARIES_FOLDER_LABEL + ":");
final HBox fieldContainer = new HBox();
librariesFolderField = new TextField();
librariesFolderField.setEditable(false);
librariesFolderField.prefWidthProperty().bind(root.widthProperty());
final Button addButton = new Button();
addButton.setGraphic(new ImageView(Icons.ADD_12));
addButton.setOnAction(event -> processAddLibrariesFolder());
final Button removeButton = new Button();
removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
removeButton.setOnAction(event -> processRemoveLibrariesFolder());
removeButton.disableProperty().bind(librariesFolderField.textProperty().isEmpty());
FXUtils.addToPane(label, fieldContainer, container);
FXUtils.addToPane(librariesFolderField, addButton, removeButton, fieldContainer);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(librariesFolderField, CSSClasses.TRANSPARENT_TEXT_FIELD);
FXUtils.addClassTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(librariesFolderField, fieldContainer, CSSClasses.SETTINGS_DIALOG_FIELD);
FXUtils.addClassesTo(addButton, removeButton, CSSClasses.FLAT_BUTTON,
CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);
DynamicIconSupport.addSupport(addButton, removeButton);
}
示例6: createClassesFolderControl
import javafx.scene.control.TextField; //导入方法依赖的package包/类
/**
* Create the classes folder control.
*/
@FXThread
private void createClassesFolderControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_USER_CLASSES_FOLDER_LABEL + ":");
final HBox fieldContainer = new HBox();
classesFolderField = new TextField();
classesFolderField.setEditable(false);
classesFolderField.prefWidthProperty().bind(root.widthProperty());
final Button addButton = new Button();
addButton.setGraphic(new ImageView(Icons.ADD_12));
addButton.setOnAction(event -> processAddClassesFolder());
final Button removeButton = new Button();
removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
removeButton.setOnAction(event -> processRemoveClassesFolder());
removeButton.disableProperty().bind(classesFolderField.textProperty().isEmpty());
FXUtils.addToPane(label, fieldContainer, container);
FXUtils.addToPane(classesFolderField, addButton, removeButton, fieldContainer);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(classesFolderField, CSSClasses.TRANSPARENT_TEXT_FIELD);
FXUtils.addClassTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(classesFolderField, fieldContainer, CSSClasses.SETTINGS_DIALOG_FIELD);
FXUtils.addClassesTo(addButton, removeButton, CSSClasses.FLAT_BUTTON,
CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);
DynamicIconSupport.addSupport(addButton, removeButton);
}
示例7: createAdditionalEnvsControl
import javafx.scene.control.TextField; //导入方法依赖的package包/类
/**
* Create the additional envs control.
*/
@FXThread
private void createAdditionalEnvsControl(@NotNull final VBox root) {
final HBox container = new HBox();
container.setAlignment(Pos.CENTER_LEFT);
final Label label = new Label(Messages.SETTINGS_DIALOG_ENVS_FOLDER_LABEL + ":");
final HBox fieldContainer = new HBox();
additionalEnvsField = new TextField();
additionalEnvsField.setEditable(false);
additionalEnvsField.prefWidthProperty().bind(root.widthProperty());
final Button addButton = new Button();
addButton.setGraphic(new ImageView(Icons.ADD_12));
addButton.setOnAction(event -> processAddEF());
final Button removeButton = new Button();
removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
removeButton.setOnAction(event -> processRemoveEF());
removeButton.disableProperty().bind(additionalEnvsField.textProperty().isEmpty());
FXUtils.addToPane(label, fieldContainer, container);
FXUtils.addToPane(additionalEnvsField, addButton, removeButton, fieldContainer);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(additionalEnvsField, CSSClasses.TRANSPARENT_TEXT_FIELD);
FXUtils.addClassTo(fieldContainer, CSSClasses.TEXT_INPUT_CONTAINER);
FXUtils.addClassTo(label, CSSClasses.SETTINGS_DIALOG_LABEL);
FXUtils.addClassTo(additionalEnvsField, fieldContainer, CSSClasses.SETTINGS_DIALOG_FIELD);
FXUtils.addClassesTo(addButton, removeButton, CSSClasses.FLAT_BUTTON,
CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);
DynamicIconSupport.addSupport(addButton, removeButton);
}
示例8: initComponents
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private void initComponents() {
setStyle("-fx-padding: 10px; -fx-spacing: 10px");
lblName = new Label("Name");
lblLecture = new Label("Lecture");
lblSemester = new Label("Semester");
lblDescription = new Label("Description");
lblSum = new Label("Maximal Points");
tfName = new TextField();
tfName.setEditable(false);
tfLecture = new TextField();
tfLecture.setEditable(false);
tfSemester = new TextField();
tfSemester.setEditable(false);
tfSum = new TextField();
tfSum.setEditable(false);
taDesc = new TextArea();
taDesc.setEditable(false);
int rowIndex = 0;
root.add(lblName, 0, rowIndex);
GridPane.setHgrow(lblName, Priority.ALWAYS);
root.add(tfName, 1, rowIndex++);
root.add(lblLecture, 0, rowIndex);
GridPane.setHgrow(lblLecture, Priority.ALWAYS);
root.add(tfLecture, 1, rowIndex++);
root.add(lblSemester, 0, rowIndex);
GridPane.setHgrow(lblSemester, Priority.ALWAYS);
root.add(tfSemester, 1, rowIndex++);
root.add(lblSum, 0, rowIndex);
GridPane.setHgrow(lblSum, Priority.ALWAYS);
root.add(tfSum, 1, rowIndex++);
root.add(lblDescription, 0, rowIndex);
GridPane.setHgrow(lblDescription, Priority.ALWAYS);
root.add(taDesc, 1, rowIndex++);
ColumnConstraints col1 = new ColumnConstraints();
col1.setPercentWidth(40);
ColumnConstraints col2 = new ColumnConstraints();
col2.setPercentWidth(60);
root.getColumnConstraints().addAll(col1, col2);
}
示例9: EntryHeaderView
import javafx.scene.control.TextField; //导入方法依赖的package包/类
public EntryHeaderView(Entry<?> entry, List<Calendar> calendars) {
this.entry = requireNonNull(entry);
requireNonNull(calendars);
getStylesheets().add(CalendarView.class.getResource("calendar.css").toExternalForm());
TextField titleField = new TextField(entry.getTitle());
Bindings.bindBidirectional(titleField.textProperty(), entry.titleProperty());
titleField.disableProperty().bind(entry.getCalendar().readOnlyProperty());
TextField locationField = new TextField(entry.getLocation());
Bindings.bindBidirectional(locationField.textProperty(), entry.locationProperty());
locationField.getStyleClass().add("location"); //$NON-NLS-1$
locationField.setEditable(true);
locationField.setPromptText(Messages.getString("EntryHeaderView.PROMPT_LOCATION")); //$NON-NLS-1$
locationField.setMaxWidth(500);
locationField.disableProperty().bind(entry.getCalendar().readOnlyProperty());
calendarSelector = new CalendarSelector();
calendarSelector.disableProperty().bind(entry.getCalendar().readOnlyProperty());
calendarSelector.getCalendars().setAll(calendars);
calendarSelector.setCalendar(entry.getCalendar());
Bindings.bindBidirectional(calendarSelector.calendarProperty(), entry.calendarProperty());
titleField.getStyleClass().add("default-style-entry-popover-title"); //$NON-NLS-1$
add(titleField, 0, 0);
add(calendarSelector, 1, 0, 1, 2);
add(locationField, 0, 1);
RowConstraints row1 = new RowConstraints();
row1.setValignment(VPos.TOP);
row1.setFillHeight(true);
RowConstraints row2 = new RowConstraints();
row2.setValignment(VPos.TOP);
row2.setFillHeight(true);
getRowConstraints().addAll(row1, row2);
ColumnConstraints col1 = new ColumnConstraints();
col1.setFillWidth(true);
col1.setHgrow(Priority.ALWAYS);
ColumnConstraints col2 = new ColumnConstraints();
col2.setFillWidth(true);
col2.setHgrow(Priority.NEVER);
getColumnConstraints().addAll(col1, col2);
getStyleClass().add("popover-header"); //$NON-NLS-1$
titleField.getStyleClass().add("title"); //$NON-NLS-1$
titleField.setPromptText(Messages.getString("EntryHeaderView.PROMPT_TITLE")); //$NON-NLS-1$
titleField.setMaxWidth(500);
Calendar calendar = entry.getCalendar();
titleField.getStyleClass().add(calendar.getStyle() + "-entry-popover-title"); //$NON-NLS-1$
entry.calendarProperty()
.addListener((observable, oldCalendar, newCalendar) -> {
if (oldCalendar != null) {
titleField.getStyleClass().remove(oldCalendar.getStyle() + "-entry-popover-title"); //$NON-NLS-1$
}
if (newCalendar != null) {
titleField.getStyleClass().add(newCalendar.getStyle() + "-entry-popover-title"); //$NON-NLS-1$
}
});
}
示例10: getActionPane
import javafx.scene.control.TextField; //导入方法依赖的package包/类
private VBox getActionPane(){
progress= new Text("Gate\nEntry Progress");
progress.setTextAlignment(TextAlignment.CENTER);
progress.setFont(Font.font("Times New Roman", 35));
lname= new Label("-Your Name here-");
Image iconf= new Image(AllAttendance.class.getResourceAsStream("/pic/finger.png"));
ImageView ivconf= new ImageView(iconf);
lpic= new Label();
lpic.setGraphic(ivconf);
Image img1= new Image(PersonalReports.class.getResourceAsStream("/pic/cross.png"));
ImageView imagvw= new ImageView(img1);
imagvw.setFitHeight(70);
imagvw.setFitWidth(70);
lnotexist= new Label("",imagvw);
lnotexist.setText("\n\n\n\n\nN/A");
lnotexist.setFont(Font.font("Cooper Black", 15));
lnotexist.setVisible(false);
txtfinger= new TextField();
txtfinger.setEditable(false);
txtfinger.setMaxWidth(160);
txtfinger.setStyle("-fx-background-radius:10; -fx-background-color:#9CD777;");
txtsearch= new TextField();
initFilter();
Button btnadd= new Button("save");
btnadd.setOnAction(e -> {
setAddAttendance();
});
Button btnView= new Button("View Records");
Button btnCloseView= new Button("Hide Records");
btnView.setOnAction(e -> {
timelineDown.play();
});
btnCloseView.setOnAction(e -> {
timelineUp.play();
});
VBox laywrong= new VBox();
laywrong.getChildren().addAll(lnotexist);
laywrong.setPadding(new Insets(0,0,0,0));
laywrong.setAlignment(Pos.CENTER);
HBox laytest= new HBox(5);
laytest.getChildren().addAll(txtfinger /* btnadd*/);
laytest.setAlignment(Pos.CENTER);
//btnadd was beside txtfinger
VBox laybtnsearch= new VBox();
laybtnsearch.getChildren().addAll(txtsearch);
laybtnsearch.setAlignment(Pos.CENTER);
laybtnsearch.setPadding(new Insets(20,0,0,0));
HBox laybtn= new HBox(5);
laybtn.getChildren().addAll(btnView, btnCloseView);
laybtn.setAlignment(Pos.CENTER);
VBox lay1= new VBox(10);
lay1.getChildren().addAll(progress, lpic, lname, laytest);
lay1.setAlignment(Pos.CENTER);
VBox layside= new VBox(25);
layside.getChildren().addAll(lay1, laybtn, laybtnsearch, laywrong);
layside.setAlignment(Pos.TOP_CENTER);
layside.setMinWidth(230);
layside.setPadding(new Insets(20,0,10,0));
return layside;
}
示例11: setToEdit
import javafx.scene.control.TextField; //导入方法依赖的package包/类
public void setToEdit()
{
window= new Stage();
window.setTitle("Edit User");
window.initModality(Modality.APPLICATION_MODAL);
window.getIcons().add(new Image("/pic/slogo.png"));
window.setResizable(false);
lusername= new Label("Username");
txtname= new TextField();
txtname.setPromptText("Username");
txtname.setEditable(false);
txtname.setText(Users.txtname.getText());
llevel= new Label("User Level");
cuser= new ComboBox<>();
cuser.getItems().addAll("Super User","Gate Admin", "Office Admin","User");
cuser.setEditable(true);
cuser.setValue(Users.txtlevel.getText());
btnsave=new Button("Save");
btnsave.setOnAction(e ->{
setEdited();
});
btnclose=new Button("Close");
btnclose.setOnAction( e -> {
window.close();
});
HBox lay= new HBox(10);
lay.getChildren().addAll(lusername, txtname);
HBox lay1= new HBox(10);
lay1.getChildren().addAll(llevel, cuser);
HBox laybtn= new HBox(10);
laybtn.getChildren().addAll(btnsave, btnclose);
laybtn.setPadding(new Insets(0,10,0,10));
laybtn.setAlignment(Pos.CENTER_RIGHT);
VBox layall= new VBox(15);
layall.setPadding(new Insets(15,15,5,15));
layall.getChildren().addAll(lay,lay1, laybtn);
layall.setStyle("-fx-background-color: linear-gradient(#E4E9A9, #9CD777);");
scene= new Scene(layall);
scene.getStylesheets().add(EditingClass.class.getResource("users.css").toExternalForm());
window.setScene(scene);
window.show();
}
示例12: showUsers
import javafx.scene.control.TextField; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void showUsers()
{
primaryStage = new Stage();
primaryStage.setTitle("e-Tracker Users");
primaryStage.setResizable(false);
primaryStage.initModality(Modality.APPLICATION_MODAL);
primaryStage.getIcons().add(new Image("/pic/slogo.png"));
//name
namecol = new TableColumn<>("Username");
namecol.setMinWidth(250);
namecol.setCellValueFactory(new PropertyValueFactory<>("name"));//has to be the same as in the UserCreation class
//level
levelcol = new TableColumn<>("User Level");
levelcol.setMinWidth(250);
levelcol.setCellValueFactory(new PropertyValueFactory<>("level"));
table= new TableView<>();
table.setItems(getProduct());
table.getColumns().addAll(namecol, levelcol);
table.getSelectionModel().selectedItemProperty().addListener(
(observable, oldValue, newValue) -> showPersonDetails(newValue));
txtname= new TextField();
txtname.setEditable(false);
txtname.setPromptText("Username");
txtlevel= new TextField();
txtlevel.setEditable(false);
txtlevel.setPromptText("User Level e.g. Admin");
badd= new Button("Add...");
badd.setOnAction(e ->{
addClicked();
});
bdel= new Button("Delete");
bdel.setOnAction(e ->{
deleteClicked();
});
bedit= new Button("Edit...");
bedit.setOnAction( e ->{
setPressbEdit();
});
HBox layout2= new HBox();
layout2.setSpacing(10); //similar to that 10
//layout2.setPadding(new Insets(20,20,20,20));
layout2.getChildren().addAll(txtname, txtlevel, bedit, badd, bdel);
layout2.setAlignment(Pos.CENTER_RIGHT);
VBox layout = new VBox(12);
layout.getChildren().addAll(table, layout2);
layout.setPadding(new Insets(20,20,20,20));
layout.setStyle("-fx-background-color: linear-gradient(#E4E9A9, #9CD777);");
Scene scene= new Scene(layout);
scene.getStylesheets().add(Users.class.getResource("users.css").toExternalForm());
primaryStage.setScene(scene);
if(MainWindow.ladmins.getText().equals("User") || MainWindow.ladmins.getText().equals("Office Admin") ||
MainWindow.ladmins.getText().equals("Gate Admin"))
{
badd.setDisable(true);
bdel.setDisable(true);
bedit.setDisable(true);
}
}
示例13: showChangedPassword
import javafx.scene.control.TextField; //导入方法依赖的package包/类
public void showChangedPassword()
{
changepass= new Stage();
changepass.setTitle("Change Password");
changepass.initModality(Modality.APPLICATION_MODAL);
changepass.getIcons().add(new Image("/pic/slogo.png"));
lname= new Label("Username");
txtusername= new TextField();
txtusername.setText(MainWindow.lname.getText());
txtusername.setEditable(false);
txtusername.setMaxSize(250, 100);
lnew= new Label("New Password");
newpass= new PasswordField();
newpass.setPromptText("new password");
newpass.setMaxSize(250, 100);
btnsave= new Button("Save");
btnsave.setOnAction(e ->{
setChangePass();
});
btnclose= new Button("Close");
btnclose.setOnAction(e ->{
changepass.close();
});
VBox lay1= new VBox(23);
lay1.getChildren().addAll(lname, lnew);
VBox lay2= new VBox(10);
lay2.getChildren().addAll(txtusername, newpass);
HBox laydet= new HBox(10);
laydet.setAlignment(Pos.CENTER);
laydet.setPadding(new Insets(10,10,10,10));
laydet.setBorder(new Border(new BorderStroke(Color.LIGHTGREY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
laydet.getChildren().addAll(lay1, lay2);
HBox laybtn= new HBox(10);
laybtn.setAlignment(Pos.CENTER_RIGHT);
laybtn.getChildren().addAll(btnsave, btnclose);
VBox layall= new VBox(10);
layall.setPadding(new Insets(10,10,10,10));
layall.getChildren().addAll(laydet, laybtn);
layall.setStyle("-fx-background-color: linear-gradient(#E4E9A9, #9CD777);");
scene1= new Scene(layall);
scene1.getStylesheets().add(ChangePassword.class.getResource("users.css").toExternalForm());
changepass.setScene(scene1);
changepass.setResizable(false);
changepass.show();
}
示例14: SimulatorPane
import javafx.scene.control.TextField; //导入方法依赖的package包/类
/**
* construct me
*
* @param logPlayer
* @param javaFXDisplay
* @param e
* @param d
*/
public SimulatorPane(LogPlayer logPlayer, MonitorControl monitorControl) {
this.monitorControl = monitorControl;
this.logPlayer = logPlayer;
logPlayer.addListener(this);
fileField = new TextField();
fileField.setEditable(false);
slider = new Slider();
playTime = new Label();
fontAwesome = GlyphFontRegistry.font("FontAwesome");
pause = fontAwesome.create(FontAwesome.Glyph.PAUSE);
play = fontAwesome.create(FontAwesome.Glyph.PLAY);
playButton = new Button("", play);
this.add(fileField, 0, 0);
this.add(playButton, 1, 0);
this.add(slider, 2, 0);
this.add(playTime, 3, 0);
super.fixColumnSizes(5, 25, 5, 55, 15);
super.fixRowSizes(0, 100);
slider.valueChangingProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observableValue,
Boolean wasChanging, Boolean changing) {
if (changing) {
if (!computerChange) {
humanSliderMovement = true;
}
} else {
if (humanSliderMovement) {
onSliderNewHumanValue();
humanSliderMovement = false;
}
}
}
});
playButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
play();
}
});
}
示例15: createContent
import javafx.scene.control.TextField; //导入方法依赖的package包/类
@Override
@FXThread
protected void createContent(@NotNull final VBox root) {
final Label durationLabel = new Label(Messages.AUDIO_VIEWER_EDITOR_DURATION_LABEL + ":");
final Label bitsPerSampleLabel = new Label(Messages.AUDIO_VIEWER_EDITOR_BITS_PER_SAMPLE_LABEL + ":");
final Label channelsLabel = new Label(Messages.AUDIO_VIEWER_EDITOR_CHANNELS_LABEL + ":");
final Label dataTypeLabel = new Label(Messages.AUDIO_VIEWER_EDITOR_DATA_TYPE_LABEL + ":");
final Label sampleRateLabel = new Label(Messages.AUDIO_VIEWER_EDITOR_SAMPLE_RATE_LABEL + ":");
durationField = new TextField();
durationField.setEditable(false);
bitsPerSampleField = new TextField();
bitsPerSampleField.setEditable(false);
channelsField = new TextField();
channelsField.setEditable(false);
dataTypeField = new TextField();
dataTypeField.setEditable(false);
sampleRateField = new TextField();
sampleRateField.setEditable(false);
final GridPane gridPane = new GridPane();
gridPane.add(durationLabel, 0, 0);
gridPane.add(bitsPerSampleLabel, 0, 1);
gridPane.add(channelsLabel, 0, 2);
gridPane.add(dataTypeLabel, 0, 3);
gridPane.add(sampleRateLabel, 0, 4);
gridPane.add(durationField, 1, 0);
gridPane.add(bitsPerSampleField, 1, 1);
gridPane.add(channelsField, 1, 2);
gridPane.add(dataTypeField, 1, 3);
gridPane.add(sampleRateField, 1, 4);
playButton = new Button();
playButton.setGraphic(new ImageView(Icons.PLAY_128));
playButton.setOnAction(event -> processPlay());
stopButton = new Button();
stopButton.setGraphic(new ImageView(Icons.STOP_128));
stopButton.setOnAction(event -> processStop());
stopButton.setDisable(true);
final HBox container = new HBox();
FXUtils.addToPane(gridPane, container);
FXUtils.addToPane(playButton, container);
FXUtils.addToPane(stopButton, container);
FXUtils.addToPane(container, root);
FXUtils.addClassTo(playButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
FXUtils.addClassTo(stopButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
FXUtils.addClassTo(container, CSSClasses.DEF_HBOX);
FXUtils.addClassTo(gridPane, CSSClasses.DEF_GRID_PANE);
FXUtils.addClassesTo(root, CSSClasses.DEF_VBOX, CSSClasses.AUDIO_VIEW_EDITOR_CONTAINER);
DynamicIconSupport.addSupport(playButton, stopButton);
}