inferObjects.getCompundObj().get(“missionID”) == obj0.getId()
)
}
} else {
cell.jl_address_stock.text = “Obj: ” + obj0.getId() + ” empty”
cell.jl_points.setText(“”)
cell.jl_tslot.setText(“”)
cell.jl_candidate.setText(“”)
cell.jl_min.setText(“”)
}
} else {
cell.jl_name.text = "Function Not Available"
cell.jl_price.text = "Price: "
cell.jl_address_stock.text = "Stock: "
cell.jl_points.text = "Points: "
cell.jl_tslot.text = "Time Slot: "
cell.jb_Infoproduit.setStyle("-fx-background-color: #D3D3D3");
} */
if (c != null) {
cell.jl_nomFourn.setText(obj0.getProviderName());
cell.button = this.setObject.getId();
if (updatedParcels != null) {
if (this.parcel == this.table.getPackages().get(cell.row)) {
cell.getStyleClass().add("cell_select");
}
if(!obj0.getStock().equals("-1")) {
cell.getStyleClass().add("stock");
}
}
} else {
cell.jl_name.setText("No delivery");
cell.jl_price.setText("");
cell.jl_address_stock.setText("");
cell.jl_points.setText("");
cell.jl_tslot.setText("");
cell.jb_Infoproduit.disableProperty().unbind();
cell.jb_Infoproduit.setTooltip(null);
cell.jb_Infoproduit.setText("");
}
cell.setAlignment(Pos.CENTER);
}
}
droriftforums 2019-03-04: You can use an `EventHandler<ActionEvent>`. Here's a minimal example:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class App extends Application {
@Override
public void start(Stage primaryStage) {
Label label = new Label("Press Ctrl+P");
Button button = new Button("Click Me");
button.setOnAction(new EventHandler<>() {
private boolean hasPressedControl = false;
private boolean dontBubbleUp = true;
@Override
public void handle(ActionEvent event) {
if (hasPressedControl) {
System.out.println("Button clicked");
}
}
@Override
public void onKeyPressed(KeyEvent event) {
if (event.getCode() == KeyCode.CONTROL) {
hasPressedControl = true;
event.consume();
}
}
@Override
public void onKeyReleased(KeyEvent event) {
if (event.getCode() == KeyCode.CONTROL) {
hasPressedControl = false;
}
}
@Override
public void onInputMethodTextChanged(InputMethodEvent event) {}
@Override
public void onContextMenuRequested(ContextMenuEvent event) {
event.consume();
}
@Override
public void onDragEntered(DragEvent event) {}
@Override
public void onDragOver(DragEvent event) {}
@Override
public void onDragExited(DragEvent event) {}
@Override
public void onDragDropped(DragEvent event) {}
});
VBox root = new VBox(label, button);
primaryStage.setScene(new Scene(root, 400, 200));
primaryStage.setTitle("ReactorApp");
primaryStage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
That will print "Button clicked" to the console when the user clicks the button and has the Control key held down. Note that this uses the static factory method `KeyEvent.getCode()` which returns the key code associated with the given physical key on a keyboard. These codes can be used to determine which key was pressed or released.
If that's not what you're asking for, then consider giving more detail in your question about what you're trying to do. If, after reading this answer, you still have questions, then I would encourage you to ask. But I think I've given you enough information to get started.