Java Code Examples for javafx.event.ActionEvent#getSource()

The following examples show how to use javafx.event.ActionEvent#getSource() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: dashController.java    From gramophy with GNU General Public License v3.0 6 votes vote down vote up
@FXML
public void selectMusicLibraryFolderButtonClicked(ActionEvent event)
{
    Node e = (Node) event.getSource();
    Window ps = e.getScene().getWindow();
    DirectoryChooser directoryChooser = new DirectoryChooser();
    File newMusicFolder = directoryChooser.showDialog(ps);
    File presentFolder = new File(config.get("music_lib_path"));

    if(newMusicFolder == null) return;

    if(!newMusicFolder.getAbsolutePath().equals(presentFolder.getAbsolutePath()))
    {
        selectMusicLibraryField.setText(newMusicFolder.getAbsolutePath());
    }
}
 
Example 2
Source File: SidePanelController.java    From JavaFX-Tutorial-Codes with Apache License 2.0 6 votes vote down vote up
@FXML
private void changeColor(ActionEvent event) {
    JFXButton btn = (JFXButton) event.getSource();
    System.out.println(btn.getText());
    switch (btn.getText()) {
        case "Color 1":
            callback.updateColor("#00FF00");
            break;
        case "Color 2":
            callback.updateColor("#0000FF");
            break;
        case "Color 3":
            callback.updateColor("#FF0000");
            break;
    }
}
 
Example 3
Source File: ServiceQueryController.java    From dctb-utfpr-2018-1 with Apache License 2.0 5 votes vote down vote up
@FXML
private void showMainActionM(ActionEvent evt) {
    MenuItem btn = (MenuItem) (evt.getSource());
    String actionType;

    if (btn.getText().equals("Registro de Vendas")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 4
Source File: SimulationModeConfigView.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handle(ActionEvent actionEvent) {
	if (actionEvent.getSource() == startButton) {
		GameConfig gameConfig = new GameConfig();
		gameConfig.setNumberOfGames(numberOfGamesBox.getSelectionModel().getSelectedItem());
		gameConfig.setPlayerConfig1(player1Config.getPlayerConfig());
		gameConfig.setPlayerConfig2(player2Config.getPlayerConfig());
		gameConfig.setDeckFormat(formatBox.getValue());
		NotificationProxy.sendNotification(GameNotification.COMMIT_SIMULATIONMODE_CONFIG, gameConfig);
	} else if (actionEvent.getSource() == backButton) {
		NotificationProxy.sendNotification(GameNotification.MAIN_MENU);
	}
}
 
Example 5
Source File: StockQueryController.java    From dctb-utfpr-2018-1 with Apache License 2.0 5 votes vote down vote up
@FXML
private void showMainActionM(ActionEvent evt) {
    MenuItem btn = (MenuItem) (evt.getSource());
    String actionType;

    if (btn.getText().equals("Registro de Vendas")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 6
Source File: IndexController.java    From dctb-utfpr-2018-1 with Apache License 2.0 5 votes vote down vote up
@FXML
private void showMainActionM(ActionEvent evt) {
    MenuItem btn = (MenuItem) (evt.getSource());
    String actionType;

    if (btn.getText().equals("Registro de Vendas")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 7
Source File: IndexController.java    From dctb-utfpr-2018-1 with Apache License 2.0 5 votes vote down vote up
@FXML
private void showMainAction(ActionEvent evt) {
    Button btn = (Button) (evt.getSource());
    String actionType;

    if (btn.getText().equals("VENDA")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 8
Source File: ApplicationController.java    From AsciidocFX with Apache License 2.0 5 votes vote down vote up
@FXML
public void toggleConfigurationView(ActionEvent actionEvent) {
    final ToggleButton source = (ToggleButton) actionEvent.getSource();
    splitPane.setDividerPosition(1, source.isSelected() ? 0.59 : 1);
    if (source.isSelected()) {
        rightShowerHider.showNode(configBox);
    }

}
 
Example 9
Source File: RFXMenuItem.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public void record(ActionEvent event) {
    MenuItem source = (MenuItem) event.getSource();
    String tagForMenu = getTagForMenu(source);
    String menuPath = getSelectedMenuPath(source);
    if (!(ownerNode instanceof ChoiceBox<?>) && ownerNode != null) {
        recorder.recordSelectMenu(new RFXUnknownComponent(ownerNode, oMapConfig, null, recorder), tagForMenu, menuPath);
    }
}
 
Example 10
Source File: ServiceQueryController.java    From dctb-utfpr-2018-1 with Apache License 2.0 5 votes vote down vote up
@FXML
private void showMainActionM(ActionEvent evt) {
    MenuItem btn = (MenuItem) (evt.getSource());
    String actionType;

    if (btn.getText().equals("Registro de Vendas")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 11
Source File: StockQueryController.java    From dctb-utfpr-2018-1 with Apache License 2.0 5 votes vote down vote up
@FXML
private void showMainActionM(ActionEvent evt) {
    MenuItem btn = (MenuItem) (evt.getSource());
    String actionType;

    if (btn.getText().equals("Registro de Vendas")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 12
Source File: BrandQueryController.java    From dctb-utfpr-2018-1 with Apache License 2.0 5 votes vote down vote up
@FXML
private void showMainActionM(ActionEvent evt) {
    MenuItem btn = (MenuItem) (evt.getSource());
    String actionType;

    if (btn.getText().equals("Registro de Vendas")) {
        actionType = "Venda";
    } else {
        actionType = "Compra";
    }

    GUIController.getInstance().showMainActionScreen(actionType, false);
}
 
Example 13
Source File: PluginsStage.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
private void itemSelected (ActionEvent e)
{
  CheckMenuItem menuItem = ((CheckMenuItem) e.getSource ());
  PluginEntry pluginEntry = (PluginEntry) menuItem.getUserData ();
  pluginEntry.select (menuItem.isSelected ());
  rebuildMenu ();
}
 
Example 14
Source File: OptionStage.java    From dm3270 with Apache License 2.0 4 votes vote down vote up
private void switchMode (ActionEvent e)
{
  CheckMenuItem menuItem = (CheckMenuItem) e.getSource ();
  setMode (menuItem.isSelected () ? Mode.RELEASE : Mode.DEBUG);
}
 
Example 15
Source File: IndexController.java    From dctb-utfpr-2018-1 with Apache License 2.0 4 votes vote down vote up
@FXML
private void showGenericTransaction(ActionEvent evt) {
    MenuItem itemName = (MenuItem) (evt.getSource());

    GUIController.getInstance().showGenericTransationQuery(itemName.getText());
}
 
Example 16
Source File: FilesController.java    From AudioBookConverter with GNU General Public License v2.0 4 votes vote down vote up
@FXML
protected void addFiles(ActionEvent event) {
    Button node = (Button) event.getSource();
    contextMenu.show(node, Side.RIGHT, 0, 0);
}
 
Example 17
Source File: BrandQueryController.java    From dctb-utfpr-2018-1 with Apache License 2.0 4 votes vote down vote up
@FXML
private void showGenericTransaction(ActionEvent evt) {
    MenuItem itemName = (MenuItem) (evt.getSource());

    GUIController.getInstance().showGenericTransationQuery(itemName.getText());
}
 
Example 18
Source File: InterpolatingLookupPaintScaleSetupDialogController.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
public void actionPerformed(ActionEvent event) {
    Object src = event.getSource();

    if (src == colorPicker) {
        javafx.scene.paint.Color color = colorPicker.getValue();
        bColor = color;
    }

    if (src == buttonAdd) {
        String tempString = fieldValue.getText();

        if (tempString == null || tempString.isEmpty()) {
            MZmineCore.getDesktop().displayMessage("Please enter value first.");
            return;
        }
        if (!isDouble(tempString)) {
            MZmineCore.getDesktop().displayMessage("Value should be double or integral.");
            return;
        }
        Double d = Double.parseDouble(fieldValue.getText());

        lookupTable.put(d,bColor);
        updateOBList(lookupTable);
    }

    if (src == buttonDelete) {
        InterpolatingLookupPaintScaleRow selected = tableLookupValues.getSelectionModel().getSelectedItem();
        if (selected != null) {
            observableTableList.remove(selected);
            lookupTable.remove(selected.getKey());

        }
    }

    if (src == buttonOK) {
        exitCode = ExitCode.OK;
        dispose();
    }
    if (src == buttonCancel) {
        exitCode = ExitCode.CANCEL;
        dispose();
    }
}
 
Example 19
Source File: ServiceQueryController.java    From dctb-utfpr-2018-1 with Apache License 2.0 4 votes vote down vote up
@FXML
private void showPersonQuery(ActionEvent evt) {
    MenuItem itemName = (MenuItem) (evt.getSource());

    GUIController.getInstance().showPersonQuery(itemName.getText());
}
 
Example 20
Source File: EmployeeRegisterController.java    From dctb-utfpr-2018-1 with Apache License 2.0 4 votes vote down vote up
@FXML
private void showPersonQuery(ActionEvent evt) {
    MenuItem itemName = (MenuItem) (evt.getSource());

    GUIController.getInstance().showPersonQuery(itemName.getText());
}