use of javafx.scene.control.TextField in project phoenicis by PhoenicisOrg.
the class GitRepositoryDetailsPanel method populate.
/**
* Populates the repository details step for the git repository
*/
private void populate() {
this.urlField = new TextField();
this.branchField = new TextField("master");
Label urlLabel = new Label(tr("Git-Url:"));
urlLabel.setLabelFor(urlField);
Label branchLabel = new Label(tr("Branch:"));
branchLabel.setLabelFor(branchField);
GridPane grid = new GridPane();
grid.getStyleClass().add("grid");
grid.add(urlLabel, 0, 0);
grid.add(urlField, 1, 0);
grid.add(branchLabel, 0, 1);
grid.add(branchField, 1, 1);
this.setCenter(grid);
}
use of javafx.scene.control.TextField in project phoenicis by PhoenicisOrg.
the class SearchBox method populate.
/**
* Populates the searchbox
*/
private void populate() {
this.getStyleClass().add("searchBox");
this.searchField = new TextField();
this.searchField.getStyleClass().add("searchBar");
this.searchField.prefHeightProperty().bind(this.prefHeightProperty());
this.searchField.prefWidthProperty().bind(this.prefWidthProperty());
this.searchField.textProperty().addListener(event -> this.onSearch.ifPresent(onSearch -> onSearch.accept(getText())));
AnchorPane.setLeftAnchor(searchField, 0.0);
AnchorPane.setRightAnchor(searchField, 0.0);
this.clearButton = new Button();
this.clearButton.getStyleClass().add("searchCleanButton");
this.clearButton.setOnMouseClicked(event -> {
this.searchField.clear();
this.onClear.ifPresent(Runnable::run);
});
AnchorPane.setRightAnchor(clearButton, 0.0);
this.getChildren().addAll(searchField, clearButton);
}
use of javafx.scene.control.TextField in project jvarkit by lindenb.
the class JfxNgs method start.
/*
private void showPreferenceDialoge(Window parentStage)
{
Stage dialog = new Stage();
dialog.setTitle("Preferences");
dialog.initOwner(parentStage);
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.showAndWait();
}*/
@Override
public void start(final Stage primaryStage) throws Exception {
final Parameters params = this.getParameters();
primaryStage.setTitle(getClass().getSimpleName());
Menu menu = new Menu("File");
menu.getItems().addAll(createCommonMenuItems(primaryStage));
menu.getItems().add(new SeparatorMenuItem());
MenuItem menuItem = new MenuItem("Quit...");
menuItem.setOnAction(AE -> doMenuQuit());
menu.getItems().add(menuItem);
MenuBar bar = new MenuBar(menu);
FlowPane flow = new FlowPane(5, 5);
flow.setPadding(new Insets(10));
flow.getChildren().add(new Label("Set Location of all frames to:"));
final TextField textField = new TextField();
textField.setPrefColumnCount(25);
textField.setPromptText("Location. e:g '2:1234-5678'");
flow.getChildren().add(textField);
Button button = new Button("Go");
flow.getChildren().add(button);
textField.setTooltip(new Tooltip("set genomic location can be: empty, 'contig', 'contig:pos', 'contig:start-end' and (\"unmapped\" for bam)"));
final EventHandler<ActionEvent> handler = new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent event) {
final String loc = textField.getText().trim();
LOG.info("moveTo all to " + loc);
for (final NgsStage<?, ?> sc : all_opened_stages) {
LOG.info("moveTo " + sc.getTitle() + " to " + loc);
sc.moveTo(loc);
}
}
};
button.setOnAction(handler);
button.setTooltip(new Tooltip("Go the specified genomic location."));
textField.setOnAction(handler);
BorderPane pane = new BorderPane();
pane.setPadding(new Insets(5));
pane.setBottom(new Label("Author: Pierre Lindenbaum PhD."));
VBox vbox1 = new VBox(bar, flow, pane);
final Scene scene = new Scene(vbox1, 500, 300);
primaryStage.setScene(scene);
Exception lastException = null;
primaryStage.addEventHandler(WindowEvent.WINDOW_SHOWING, new EventHandler<WindowEvent>() {
@Override
public void handle(final WindowEvent event) {
final List<String> unnamedParams = new ArrayList<>(params.getUnnamed());
String startPos = "";
int optind = 0;
while (optind + 1 < unnamedParams.size()) {
if (unnamedParams.get(optind).equals("-h") || unnamedParams.get(optind).equals("--help")) {
unnamedParams.remove(optind);
System.out.println("JfxNgs : Pierre Lindenbaum PhD 2017");
System.out.println("Options:");
System.out.println(" -h|--help this screen.");
System.out.println(" -p|--position (string) the starting position");
Platform.exit();
} else if (unnamedParams.get(optind).equals("-p") || unnamedParams.get(optind).equals("--position")) {
startPos = unnamedParams.get(optind + 1);
unnamedParams.remove(optind + 1);
unnamedParams.remove(optind);
} else {
optind++;
}
}
for (final String arg : unnamedParams) {
VcfFile vcfin = null;
BamFile bamin = null;
try {
if (IOUtil.isUrl(arg)) {
if (arg.endsWith(".bam")) {
bamin = BamFile.newInstance(arg);
} else if (arg.endsWith(".vcf.gz")) {
vcfin = VcfFile.newInstance(arg);
}
} else {
final File f = new File(arg);
if (fileMatchExtensionFilter(f.getName(), BamStage.EXTENSION_FILTERS)) {
bamin = BamFile.newInstance(f);
} else if (fileMatchExtensionFilter(f.getName(), VcfStage.EXTENSION_FILTERS)) {
vcfin = VcfFile.newInstance(f);
} else {
JfxNgs.showExceptionDialog(primaryStage, "Cannot open " + f);
}
}
if (vcfin != null) {
new VcfStage(JfxNgs.this, vcfin).setLocationOnOpen(startPos).show();
} else if (bamin != null) {
new BamStage(JfxNgs.this, bamin).show();
}
} catch (Exception e) {
CloserUtil.close(vcfin);
CloserUtil.close(bamin);
showExceptionDialog(primaryStage, e);
}
}
}
});
primaryStage.show();
}
use of javafx.scene.control.TextField in project TestFX by TestFX.
the class NodeMatchersTest method isNotFocused.
@Test
public void isNotFocused() throws Exception {
// given:
FxToolkit.setupSceneRoot(() -> {
textField = new TextField("foo");
textField2 = new TextField("bar");
return new StackPane(textField, textField2);
});
Platform.runLater(() -> textField2.requestFocus());
WaitForAsyncUtils.waitForFxEvents();
// then:
assertThat(textField, NodeMatchers.isNotFocused());
}
use of javafx.scene.control.TextField in project TestFX by TestFX.
the class TextInputControlMatchersTest method setup.
@Before
public void setup() throws Exception {
FxToolkit.setupFixture(() -> {
foobarTextField = new TextField("foobar");
quuxTextField = new TextField("quux");
});
}
Aggregations