Java 类javafx.scene.control.Button 实例源码
项目:voogasalad-ltub
文件:GameChooser.java
private List<Button> createPresetButtons() {
List<Button> buttons = new ArrayList<>();
for (String gameName : presetGames.keySet()) {
GameMetaData gameMeta = presetGames.get(gameName);
Button button = new Button();
ImageView gameImageView = new ImageView(gameMeta.getImage());
gameImageView.setFitWidth(App.WIDTH / 3);
gameImageView.setPreserveRatio(true);
button.setGraphic(gameImageView);
button.setOnMouseClicked((e) -> {
startGame(gameMeta.getGameFilePath());
});
getRotation(button);
buttons.add(button);
}
return buttons;
}
项目:voogasalad-ltub
文件:SingleStat.java
public void addUpgradeBtn() {
upgradeBtn = new Button();
upgradeBtn.setText("UPGRADE");
upgradeBtn.setOnAction(e -> {
Stage msgStage = new Stage();
VBox root = new VBox();
Scene scene = new Scene(root);
Text text = new Text("Are you sure you want to upgrade " + name + "? It will cost you 10 gold.");
HBox options = new HBox();
Button yes = new Button ("yes");
yes.setOnAction(f -> {
sprite.getComponent(GameBus.TYPE).get().getGameBus().emit(new ChangeWealthEvent
(ChangeWealthEvent.CHANGE, sprite.getComponent(Owner.TYPE).get().player(), WealthType.GOLD, -10));
msgStage.close();
});
Button no = new Button("no");
no.setOnAction(g -> {
msgStage.close();
});
options.getChildren().add(yes);
root.getChildren().addAll(text, options);
msgStage.setScene(scene);
msgStage.show();
});
this.getChildren().add(upgradeBtn);
}
项目:jmonkeybuilder
文件:ResourcePropertyEditorControl.java
@Override
@FXThread
protected void createComponents() {
super.createComponents();
resourceLabel = new Label(NOT_SELECTED);
final Button changeButton = new Button();
changeButton.setGraphic(new ImageView(Icons.ADD_16));
changeButton.setOnAction(event -> processSelect());
final HBox container = new HBox(resourceLabel, changeButton);
container.prefWidthProperty().bind(widthProperty().multiply(DEFAULT_FIELD_W_PERCENT));
resourceLabel.prefWidthProperty().bind(container.widthProperty());
FXUtils.addToPane(container, this);
FXUtils.addClassesTo(container, CSSClasses.DEF_HBOX, CSSClasses.TEXT_INPUT_CONTAINER);
FXUtils.addClassesTo(changeButton, CSSClasses.FLAT_BUTTON, CSSClasses.INPUT_CONTROL_TOOLBAR_BUTTON);
FXUtils.addClassTo(resourceLabel, CSSClasses.ABSTRACT_PARAM_CONTROL_ELEMENT_LABEL);
DynamicIconSupport.addSupport(changeButton);
}
项目:voogasalad-ltub
文件:MessagingView.java
private VBox makeInputBox() {
VBox inputBox = new VBox(10);
Label username = new Label(USERNAME_LABEL);
Label messageName = new Label(MESSAGE_LABEL);
TextField userField = new TextField();
TextField inputField = new TextField();
Button sendButton = new Button("Send");
sendButton.setOnAction(e -> {
String message = inputField.getText();
String sender = userField.getText();
//FIXME: fix connection stuff
myUser.recieveMessage(sender, message);
});
HBox usernameField = new HBox();
usernameField.getChildren().addAll(username, userField);
HBox messageField = new HBox();
messageField.getChildren().addAll(messageName, inputField);
inputBox.getChildren().addAll(usernameField, messageField, sendButton);
return inputBox;
}
项目:Dronology
文件:ButtonGenerator.java
/**
* Initial return to home base command
* @param flightZoneView
* @param btnText
* @param stage
* @return
*/
Button makeReturnHomeButton(final FlightZoneView flightZoneView, String btnText, Stage stage){
Button platoonBtn = createButton(btnText, 120);
platoonBtn.setOnAction(
new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent e) {
try {
flightZoneView.flightManager.getFlights().groundAllFlights();
} catch (FlightZoneException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
return platoonBtn;
}
项目:voogasalad-ltub
文件:MasterDeveloperInterface.java
private void instantiate() {
Button spriteButton = new Button(myResources.getString(CREATE_NEW_SPRITE));
Button screenButton = new Button(myResources.getString(CREATE_NEW_SCREEN));
Button attributeButton = new Button(myResources.getString(CREATE_NEW_ATTRIBUTE));
spriteButton.setOnAction((clicked) -> {
Tab spriteTab = new Tab(myResources.getString(CREATE_NEW_SPRITE),
new SpriteCreationScreen(myModelData));
developerTabs.getTabs().add(spriteTab);
});
// screenButton.setOnAction((clicked) -> {
// Tab screenTab = new Tab(myResources.getString(CREATE_NEW_SCREEN),
// new ScreenModelCreator(myModelData.getScreenSprites(), myGeneralDataCreator, new ScreenModelData()));
// developerTabs.getTabs().add(screenTab);
// });
screenButton.setOnAction((clicked) -> {
// Tab screenTab = new Tab(myResources.getString(CREATE_NEW_SCREEN),
// new ScreenModelCreator(myModelData.getScreenSprites(), myGeneralDataCreator, new ScreenModelData()));
//developerTabs.getTabs().add(screenTab);
});
// attributeButton.setOnAction((clicked) -> {
// Tab attributeTab = new Tab(myResources.getString(CREATE_NEW_ATTRIBUTE), new GroundUpAttributeCreator());
// developerTabs.getTabs().add(attributeTab);
// });
this.getChildren().addAll(//spriteButton,
screenButton);//, attributeButton);
}
项目:Calculadora-JavaFx
文件:Controller.java
@FXML
private void processDot(ActionEvent event) {
//Impede que pontos (vírgula) sejam concatenados como resultado de uma operação
if (start) {
output.setText("");
start = false;
}
//Impede que o ponto (vírgula) seja clicada mais de uma vez
if (dot) {
return;
}
//Impede que inicie um número clicando no ponto (vírgula)
if (!number1Value) {
return;
}
String value = ((Button) event.getSource()).getText();
output.setText(output.getText() + value);
dot = true;
}
项目:Goliath-Overclocking-Utility-FX
文件:NotifyTab.java
public NotifyTab()
{
super();
super.setText("Notification");
super.setClosable(false);
pane = new Pane();
box = new VBox();
header = new Label();
desc = new Label();
okButton = new Button("Ok");
okButton.setPrefWidth(50);
okButton.setOnMouseClicked(new OkButtonHandler());
box.getChildren().addAll(header, desc, okButton);
box.setPadding(new Insets(15, 15, 15, 15));
box.setSpacing(15);
pane.setPrefHeight(AppTabPane.CONTENT_HEIGHT);
pane.setPrefWidth(AppTabPane.CONTENT_WIDTH);
pane.getChildren().add(box);
super.setContent(pane);
}
项目:can4eve
文件:JavaFXDisplay.java
/**
* create the Menu Bar
*
* @param scene
*/
public MenuBar createMenuBar(Scene scene, com.bitplan.gui.App app) {
MenuBar lMenuBar = new MenuBar();
for (com.bitplan.gui.Menu amenu : app.getMainMenu().getSubMenus()) {
Menu menu = new Menu(i18n(amenu.getId()));
lMenuBar.getMenus().add(menu);
for (com.bitplan.gui.MenuItem amenuitem : amenu.getMenuItems()) {
MenuItem menuItem = new MenuItem(i18n(amenuitem.getId()));
menuItem.setOnAction(this);
menuItem.setId(amenuitem.getId());
menu.getItems().add(menuItem);
}
}
hideMenuButton = new Button(I18n.get(I18n.HIDE_MENU));
hideMenuButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
showMenuBar(scene, lMenuBar, !lMenuBar.isVisible());
}
});
return lMenuBar;
}
项目:Notebook
文件:SettingFragment.java
@Override
public void initData(Parent node, Map<String, String> bundle) {
et_download_path = (TextField) node.lookup("#et_download_path");
et_deploy_path = (TextField) node.lookup("#et_deploy_path");
et_secret = (TextField) node.lookup("#et_secret");
et_git_username = (TextField) node.lookup("#et_git_username");
et_git_passwd = (PasswordField) node.lookup("#et_git_passwd");
et_app_password = (PasswordField) node.lookup("#et_app_password");
et_app_password_second = (PasswordField) node.lookup("#et_app_password_second");
btn_submit = (Button) node.lookup("#btn_submit");
readFromProperty();
btn_submit.setOnAction(e->{
String message = "";
if(!et_app_password.getText().trim().equals(et_app_password_second.getText().trim())){
message = "�����������벻һ�£�";
DialogHelper.alert("����", message);
return;
}
if(!"".equals(et_app_password.getText().trim()) && et_app_password.getText().trim().length() < 5){
message = "���볤��̫��,������ȫ��";
DialogHelper.alert("����", message);
return;
}
writeToProperty();
});
}
项目:Mafia-TCoS-CS319-Group2A
文件:CreditsController.java
@FXML
public void buttonPressed(MouseEvent actionEvent) throws IOException {
Button button = (Button)actionEvent.getSource();
if ((button).getText().equals("BACK"))
{
Stage current = (Stage)button.getScene().getWindow();
Parent root = FXMLLoader.load(getClass().getResource("menuSample.fxml"));
current.setMaximized(true);
current.setScene(new Scene(root, screenSize.getWidth(), screenSize.getHeight()));
//current.setFullScreen(true);
current.show();
}
}
项目:GazePlay
文件:GameContext.java
public void createToggleFullScreenButtonInGameScreen(@NonNull GazePlay gazePlay) {
EventHandler<Event> eventHandler = new EventHandler<javafx.event.Event>() {
@Override
public void handle(javafx.event.Event e) {
gazePlay.toggleFullScreen();
}
};
Image buttonGraphics = new Image("data/common/images/fullscreen.png");
Button button = new Button("FullScreen", new ImageView(buttonGraphics));
button.addEventHandler(MouseEvent.MOUSE_CLICKED, eventHandler);
// button.recomputeSizeAndPosition(scene);
menuHBox.getChildren().add(button);
}
项目:marathonv5
文件:FileSelectionStage.java
private HBox createBrowserField() {
HBox browseFieldBox = new HBox(5);
dirField = new TextField();
dirField.setId("DirectoryField");
dirField.textProperty().addListener((observable, oldValue, newValue) -> updateOKButton());
HBox.setHgrow(dirField, Priority.ALWAYS);
Button browseButton = FXUIUtils.createButton("browse", "Browse directory", true, "Browse");
FileSelectionHandler browserListener;
String fileType = fileSelectionInfo.getFileType();
if (fileType != null) {
browserListener = new FileSelectionHandler(this,
new ExtensionFilter(fileType, Arrays.asList(fileSelectionInfo.getExtensionFilters())), this, null,
fileSelectionInfo.getTitle());
} else {
browserListener = new FileSelectionHandler(this, null, this, null, fileSelectionInfo.getTitle());
browserListener.setMode(FileSelectionHandler.DIRECTORY_CHOOSER);
}
browserListener.setPreviousDir(new File(System.getProperty(Constants.PROP_PROJECT_DIR, ProjectLayout.projectDir)));
browseButton.setOnAction(browserListener);
Label label = createLabel("Name: ");
label.setMinWidth(Region.USE_PREF_SIZE);
label.setId("FileSelectedLabel");
browseFieldBox.getChildren().addAll(label, dirField, browseButton);
VBox.setMargin(browseFieldBox, new Insets(5, 5, 5, 5));
return browseFieldBox;
}
项目:marathonv5
文件:RFXButtonBaseTest.java
@Test public void click() {
Button button = (Button) getPrimaryStage().getScene().getRoot().lookup(".button");
LoggingRecorder lr = new LoggingRecorder();
Platform.runLater(new Runnable() {
@Override public void run() {
RFXButtonBase rfxButtonBase = new RFXButtonBase(button, null, null, lr);
Point2D sceneXY = button.localToScene(new Point2D(3, 3));
PickResult pickResult = new PickResult(button, sceneXY.getX(), sceneXY.getY());
Point2D screenXY = button.localToScreen(new Point2D(3, 3));
MouseEvent me = new MouseEvent(button, button, MouseEvent.MOUSE_PRESSED, 3, 3, sceneXY.getX(), screenXY.getY(),
MouseButton.PRIMARY, 1, false, false, false, false, true, false, false, false, false, false, pickResult);
rfxButtonBase.mouseButton1Pressed(me);
}
});
List<Recording> recordings = lr.waitAndGetRecordings(1);
Recording select = recordings.get(0);
AssertJUnit.assertEquals("click", select.getCall());
AssertJUnit.assertEquals("", select.getParameters()[0]);
}
项目:voogasalad-ltub
文件:GameManager.java
private HBox initSystemSettings() {
HBox settingBox = new HBox();
settingBox.setAlignment(Pos.TOP_RIGHT);
settingBox.setSpacing(15);
Button musicButton = new Button();
ImageView musicImageView = new ImageView(
new Image(getClass().getClassLoader().getResourceAsStream(myResources.getString("music"))));
musicImageView.setFitWidth(20);
musicImageView.setPreserveRatio(true);
musicButton.setGraphic(musicImageView);
musicButton.setOnMousePressed(e -> {
// TODO show a menu of several choices of background music
System.out.println("Here should be a menu of background music choices.");
});
settingBox.getChildren().add(musicButton);
return settingBox;
}
项目:vars-annotation
文件:FilterableTreeItemDemo.java
private Node createAddItemPane() {
HBox box = new HBox(6);
TextField firstname = new TextField();
firstname.setPromptText("Enter first name ...");
TextField lastname = new TextField();
lastname.setPromptText("Enter last name ...");
Button addBtn = new Button("Add new actor to \"Folder 1\"");
addBtn.setOnAction(event -> {
FilterableTreeItem<Actor> treeItem = new FilterableTreeItem<>(new Actor(firstname.getText(), lastname.getText()));
folder1.getInternalChildren().add(treeItem);
});
addBtn.disableProperty().bind(Bindings.isEmpty(lastname.textProperty()));
box.getChildren().addAll(firstname, lastname, addBtn);
TitledPane pane = new TitledPane("Add new element", box);
pane.setCollapsible(false);
return pane;
}
项目:Lernkartei_2017
文件:RenameView.java
@Override
public void refreshView ()
{
renameLayout.getChildren().clear();
doorname="";
if(getFXController().getLastViewName().matches("views.StackView.*"))
{
doorname = getMyModel().getDataList("").get(getMyModel().getDataList("").size()-1);
}
oldValue = getMyModel().getString("");
TextField front = new TextField(getMyModel().getString(""));
front.setPromptText("Eingabe erforderlich");
Button saveBtn = new Button("Speichern"); // \u270d \u2055 \u2699 \u270E
saveBtn.setId("small");
saveBtn.setOnAction(e ->
{
saveNameAndExit(oldValue, front.getText(), doorname);
});
saveBtn.setOnKeyReleased(e ->
{
if (e.getCode() == KeyCode.ENTER)
saveNameAndExit(oldValue, front.getText(), doorname);
});
front.setOnKeyReleased(e ->
{
if (e.getCode() == KeyCode.ENTER)
{
saveNameAndExit(oldValue, front.getText(), doorname);
}
});
renameLayout.getChildren().addAll(front, saveBtn);
scroller.setContent(renameLayout);
}
项目:jmonkeybuilder
文件:SettingsDialog.java
/**
* 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);
}
项目:NoMoreOversleeps
文件:JavaFxHelper.java
public static Button createButtonMaxW(String text, double width)
{
Button button = createButton();
button.setText(text);
button.setMaxWidth(width);
return button;
}
项目:LIRE-Lab
文件:CommandTriggerFactory.java
public Button createButton(Command<E> command, CommandArgProvider<E> provider) {
Button button = new Button();
button.setGraphic(command.getIcon());
button.setTooltip(new Tooltip(command.getLabel()));
button.setOnAction(event -> command.execute(provider.provide()));
return button;
}
项目:NoMoreOversleeps
文件:MainDialog.java
private void addIntegrationButtonsToVbox(Integration integration, VBox vbox)
{
for (String buttonKey : integration.getActions().keySet())
{
System.out.println("*" + buttonKey);
final Action clickableButton = integration.getActions().get(buttonKey);
if (clickableButton.isHiddenFromFrontend())
{
continue;
}
final Button jfxButton = new Button(clickableButton.getName());
jfxButton.setPadding(new Insets(2, 4, 2, 4));
jfxButton.setMinWidth(256);
jfxButton.setMaxWidth(256);
jfxButton.setAlignment(Pos.BASELINE_LEFT);
jfxButton.setContentDisplay(ContentDisplay.RIGHT);
jfxButton.setTooltip(new Tooltip(buttonKey + "\n" + clickableButton.getDescription())); // I tried it, but it looks a bit janky
jfxButton.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent arg0)
{
try
{
triggerEvent("<" + clickableButton.getName() + "> from frontend", null);
clickableButton.onAction(null);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
vbox.getChildren().add(jfxButton);
}
}
项目:Socket_Chat
文件:ClientGUI.java
private GridPane initGridPane() {
GridPane gridPane = new GridPane();
//
TextField faddress = new TextField();
faddress.setPromptText("Enter server adders");
faddress.setOnAction(s -> client.makeConnection(faddress.getText()));
//text field init
TextField textField = new TextField();
textField.setPromptText("Enter command");
textField.setOnAction(s -> {
process(textField.getText());
textField.setText("");
});
//btn
Button button = new Button("Connect");
button.setOnAction(s -> client.makeConnection(faddress.getText()));
gridPane.add(button, 0, 0);
gridPane.add(faddress, 1, 0, 1, 1);
gridPane.add(clientConsole.view, 0, 1, 2, 1);
gridPane.add(textField, 0, 2, 2, 1);
gridPane.setAlignment(Pos.CENTER);
//grid settings
gridPane.setHgap(10);
gridPane.setVgap(10);
return gridPane;
}
项目:WebPLP
文件:WatcherWindow.java
private Node createRegisterControlPanel()
{
BorderPane registerPanel = new BorderPane();
Label watchRegisterLabel = new Label("Watch Register: ");
registerPanel.setLeft(watchRegisterLabel);
setAlignment(watchRegisterLabel, Pos.CENTER);
TextField registerNameField = new TextField();
registerPanel.setCenter(registerNameField);
setAlignment(registerNameField, Pos.CENTER);
Button watchRegisterButton = new Button("Add");
watchRegisterButton.setOnAction((event) -> watchRegister(registerNameField
.getText()));
registerPanel.setRight(watchRegisterButton);
setAlignment(watchRegisterButton, Pos.CENTER);
Pair<Node, ComboBox<String>> optionsRowPair = createDisplayOptionsRow();
Node displayOptions = optionsRowPair.getKey();
ComboBox<String> displayDropdown = optionsRowPair.getValue();
displayDropdown.setOnAction((event) -> {
String selection = displayDropdown.getSelectionModel().getSelectedItem();
Function<Long, String> function = valueDisplayOptions.get(selection);
registerDisplayFunction.set(function);
});
VBox controlPanel = new VBox();
controlPanel.getChildren().add(registerPanel);
controlPanel.getChildren().add(displayOptions);
controlPanel.setAlignment(Pos.CENTER);
setAlignment(controlPanel, Pos.CENTER);
controlPanel.setPadding(new Insets(CP_PADDING));
controlPanel.setSpacing(CP_SPACING);
return controlPanel;
}
项目:voogasalad-ltub
文件:SpawnerLevelEditorHolder.java
private void createSpawnerButton(){
Button spawnerButton = new Button("Add Spawner to all levels");
// spawnerButton.setOnAction(action -> getLevelData().stream().forEach(level -> {
// level.addSpawner(myCreationSpawner.getSpawner());
// }));
// addNode(spawnerButton);
}
项目:main_carauto_board
文件:ApplicationSettingsController.java
public static void initSettings(final ComboBox<StyleList> listStylesBox, final ComboBox<LanguageList> listLanguages,
TextField txtFieldPathToVideo, final Button btnApplySettings) {
LOGGER.info("Application settings tab is initialising ...");
populateComboBoxWithStyles(listStylesBox);
populateComboBoxWithLanguages(listLanguages);
// TODO: 11/29/2017 pop-up window or suggest to reload map (routes will be erased if reloaded)
//it retrieves all settings from all fields and boxes and write them into EXTERNAL file only.
btnApplySettings.setOnAction(action -> {
final String styleValueFromComboBox = listStylesBox.getValue().toString(); // TODO: 12/29/2017 check NULL listStylesBox.getValue()
final String languagesValueFromComboBox = listLanguages.getValue().toString(); // TODO: 12/29/2017 check NULL listLanguages.getValue()
final String pathToVideoFolder = txtFieldPathToVideo.getText();
if (styleValueFromComboBox != null) {
PropertiesHelper.setProperty(PropertyList.STYLE, styleValueFromComboBox);
}
if (languagesValueFromComboBox != null) {
PropertiesHelper.setProperty(PropertyList.LANGUAGE, languagesValueFromComboBox);
}
if (pathToVideoFolder != null) {
PropertiesHelper.setProperty(PropertyList.VIDEO_FOLDER, pathToVideoFolder);
}
});
LOGGER.info("Application settings tab initialised");
}
项目:Goliath-Overclocking-Utility-FX
文件:TitlePane.java
public TitlePane(String name, Stage appStage)
{
super();
super.getStyleClass().add("title-pane");
super.setPadding(new Insets(0,0,0,0));
super.setOnMousePressed(new AppMovementHandler());
super.setOnMouseDragged(new AppDragHandler());
stage = appStage;
titleLabel = new Label(name);
HBox buttonBox = new HBox();
exit = new Button("Exit");
exit.getStyleClass().add("close");
//exit.setGraphic(new ImageView(new Image(new File("src/images/x.png").toURI().toString())));
exit.setOnMouseClicked(new ExitHandler());
minimize = new Button("Minimize");
minimize.getStyleClass().add("minimize");
//minimize.setGraphic(new ImageView(new Image(new File("src/images/minus.png").toURI().toString())));
minimize.setOnMouseClicked(new MinimizeHandler());
buttonBox.getChildren().addAll(minimize, exit);
super.setLeft(titleLabel);
super.setRight(buttonBox);
}
项目:GameAuthoringEnvironment
文件:BasicUIFactory.java
public Button createImageButton (Node imgview,
EventHandler<ActionEvent> action) {
Button newButton = new Button();
newButton.setGraphic(imgview);
newButton.setOnAction(action);
return newButton;
}
项目:EasyFXML
文件:BaseEasyFxmlTest.java
@Test
public void load_with_stylesheet() {
final Button testButton = this.assertSuccessAndGet(
this.easyFxml.loadNode(TEST_NODES.BUTTON, Button.class)
);
this.assertAppliedStyle(testButton, TEST_NODES.BUTTON.getStylesheet().getStyle());
}
项目:jmonkeybuilder
文件:NodeSelectorDialog.java
/**
* Handle a selected object.
*/
@FXThread
private void processSelect(@Nullable final Object object) {
final Object result = object instanceof TreeNode ? ((TreeNode) object).getElement() : object;
final Class<T> type = getType();
final Button okButton = getOkButton();
okButton.setDisable(!type.isInstance(result));
selected = type.isInstance(result) ? type.cast(result) : null;
}
项目:jmonkeybuilder
文件:ExternalFileEditorDialog.java
/**
* Handle selected element in the tree.
*/
@FXThread
private void processSelected(@Nullable final TreeItem<ResourceElement> newValue) {
final ResourceElement element = newValue == null ? null : newValue.getValue();
final Path file = element == null ? null : element.getFile();
final Button okButton = notNull(getOkButton());
okButton.setDisable(file == null || !Files.isWritable(file));
}
项目:jmonkeybuilder
文件:FilterList.java
/**
* Create components of this component.
*/
private void createComponents() {
listView = new ListView<>();
listView.setCellFactory(param -> new FilterListCell(this));
listView.setEditable(false);
listView.setFocusTraversable(true);
listView.prefHeightProperty().bind(heightProperty());
listView.prefWidthProperty().bind(widthProperty());
listView.setFixedCellSize(FXConstants.LIST_CELL_HEIGHT);
final MultipleSelectionModel<EditableSceneFilter> selectionModel = listView.getSelectionModel();
selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) ->
selectHandler.accept(newValue));
final Button addButton = new Button();
addButton.setGraphic(new ImageView(Icons.ADD_12));
addButton.setOnAction(event -> addFilter());
final Button removeButton = new Button();
removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
removeButton.setOnAction(event -> removeFilter());
removeButton.disableProperty().bind(selectionModel.selectedItemProperty().isNull());
final HBox buttonContainer = new HBox(addButton, removeButton);
FXUtils.addToPane(listView, this);
FXUtils.addToPane(buttonContainer, this);
FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);
FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
FXUtils.addClassTo(listView, CSSClasses.TRANSPARENT_LIST_VIEW);
DynamicIconSupport.addSupport(addButton, removeButton);
}
项目:marathonv5
文件:AbstractSimpleAction.java
public Button getButtonWithText() {
String cmd = commandName;
if (cmd == null) {
cmd = expand(name);
}
Button button = FXUIUtils.createButton(name, description, true, cmd);
button.setOnAction(this);
buttons.add(button);
return button;
}
项目:PSE
文件:VMenuItemIcon.java
/**
* VMenuItem constructor.
* @param iconName iconName
* @param myParent VMenuItem parent.
* @param workspace Workspace.
*/
public VMenuItemIcon(String iconName,VMenuItem myParent,Workspace workspace){
this.workspace = workspace;
setMyParent(myParent);
setIconName(iconName);
setItemIcon(new ImageView( sample.Main.class.getResource(PATH + iconName + EXTENSION).toString() ) );
setItemButton(new Button());
setPaneIndicator(new Pane());
createComponent();
}
项目:Dronology
文件:ButtonGenerator.java
/**
* Load last flight plan
* @param flightZoneView
* @param btnText
* @param stage
* @return
*/
Button makeQuickFlightPickerButton(final FlightZoneView flightZoneView, String btnText, Stage stage){
Button quickLoad = createButton(btnText, 120);
quickLoad.setOnAction(
new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent e) {
flightZoneView.flightManager.loadFlightFromXML();
}
});
return quickLoad;
}
项目:gatepass
文件:Office_Entry.java
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;
}
项目:jmonkeybuilder
文件:AppStateList.java
/**
* Create components of this component.
*/
private void createComponents() {
listView = new ListView<>();
listView.setCellFactory(param -> new AppStateListCell(this));
listView.setEditable(false);
listView.setFocusTraversable(true);
listView.prefHeightProperty().bind(heightProperty());
listView.prefWidthProperty().bind(widthProperty());
listView.setFixedCellSize(FXConstants.LIST_CELL_HEIGHT);
final MultipleSelectionModel<EditableSceneAppState> selectionModel = listView.getSelectionModel();
selectionModel.selectedItemProperty().addListener((observable, oldValue, newValue) ->
selectHandler.accept(newValue));
final Button addButton = new Button();
addButton.setGraphic(new ImageView(Icons.ADD_12));
addButton.setOnAction(event -> addAppState());
final Button removeButton = new Button();
removeButton.setGraphic(new ImageView(Icons.REMOVE_12));
removeButton.setOnAction(event -> removeAppState());
removeButton.disableProperty().bind(selectionModel.selectedItemProperty().isNull());
final HBox buttonContainer = new HBox(addButton, removeButton);
FXUtils.addToPane(listView, this);
FXUtils.addToPane(buttonContainer, this);
FXUtils.addClassTo(buttonContainer, CSSClasses.DEF_HBOX);
FXUtils.addClassTo(addButton, CSSClasses.BUTTON_WITHOUT_RIGHT_BORDER);
FXUtils.addClassTo(removeButton, CSSClasses.BUTTON_WITHOUT_LEFT_BORDER);
FXUtils.addClassTo(listView, CSSClasses.TRANSPARENT_LIST_VIEW);
DynamicIconSupport.addSupport(addButton, removeButton);
}
项目:GameAuthoringEnvironment
文件:MainUserInterface.java
private Node createLogin () {
HBox box = new HBox(Integer.parseInt(mySpecs.getString(SPACING_KEY)));
box.setAlignment(Pos.CENTER);
Button fbButton =
createButton(myLabels.getString("splashloginfb"), e -> loginWithFacebook());
fbButton.setId(mySpecs.getString("fbbutton"));
box.getChildren()
.add(fbButton);
return box;
}
项目:jedai-ui
文件:Step1Controller.java
/**
* Show the advanced configuration window for the pressed button
*
* @param actionEvent Button action event
*/
public void configBtnHandler(ActionEvent actionEvent) {
if (actionEvent.getSource() instanceof Button) {
// Get button ID
String id = ((Button) actionEvent.getSource()).getId();
// Get the required parameters to give to configuration modal
ListProperty<JPair<String, Object>> modelProperty = null;
String readerType = null;
boolean groundTruth = false;
IDocumentation reader;
switch (id) {
case "entitiesD1ConfigBtn":
readerType = model.getEntityProfilesD1Type();
modelProperty = model.entityProfilesD1ParametersProperty();
break;
case "entitiesD2ConfigBtn":
readerType = model.getEntityProfilesD2Type();
modelProperty = model.entityProfilesD2ParametersProperty();
break;
case "gTruthConfigBtn":
readerType = model.getGroundTruthType();
modelProperty = model.groundTruthParametersProperty();
groundTruth = true;
break;
}
reader = MethodConfiguration.getDataReader(groundTruth, readerType);
// Now that we have all required parameters, show the configuration window
MethodConfiguration.displayModal(getClass(), injector, reader, modelProperty);
}
}
项目:voogasalad-ltub
文件:GridPaneManager.java
private Node getAllSpritesButton() {
GridPane buttonPane = new GridPane();
for(int i = 0; i < NUMER_OF_COLUMN_SPRITE; i ++){
for(int j = 0; j < NUMER_OF_COLUMN_SPRITE; j++){
Button button = new Button();
spriteButtonMap.put(new Pair<Integer, Integer>(i, j ), button);
}
}
return buttonPane;
}