Skip to content

Instantly share code, notes, and snippets.

Andy Till andytill

Block or report user

Report or block andytill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andytill
andytill / FXUtils.java
Last active Jun 8, 2019
Utility for for finding a JavaFX node by it's ID
View FXUtils.java
package test;
import javafx.scene.*;
import javafx.scene.control.*;
public class FXUtils {
/**
* Find a {@link Node} within a {@link Parent} by it's ID.
* <p>
@andytill
andytill / GuiceControllerFactory.java
Created Jul 1, 2012
Creating JavaFX Controllers using Guice
View GuiceControllerFactory.java
/**
* A JavaFX controller factory for constructing controllers via Guice DI. To
* install this in the {@link FXMLLoader}, pass it as a parameter to
* {@link FXMLLoader#setControllerFactory(Callback)}.
* <p>
* Once set, make sure you do <b>not</b> use the static methods on
* {@link FXMLLoader} when creating your JavaFX node.
*/
class GuiceControllerFactory implements Callback<Class<?>, Object> {
@andytill
andytill / TestApp2.java
Created Jul 15, 2012
Getting observable collections working with an extractor callback
View TestApp2.java
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.util.Callback;
import java.util.ArrayList;
@andytill
andytill / ListViewIndexChangesWhenItemUpdated .java
Created Jul 15, 2012
Example application showing how changing an item in a ListView changes its index
View ListViewIndexChangesWhenItemUpdated .java
import java.io.IOException;
import java.util.Arrays;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.Observable;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@andytill
andytill / ListBuilderController.java
Created Jul 29, 2012
JavaFX controller implementing IdentifiableController
View ListBuilderController.java
import javafx.fxml.FXML;
import javafx.scene.Parent;
@FXMLLoadingScoped
public class ListBuilderController<T> implements IdentifiableController {
@FXML
private Parent root;
@andytill
andytill / embedListBuilder.fxml
Created Jul 29, 2012
AnchorPane with embedded FXML control, in this case ListBuilder.fxml
View embedListBuilder.fxml
<AnchorPane fx:id="factorsList" minHeight="138.0" prefHeight="138.0" prefWidth="418.0">
<children>
<fx:include source="listBuilder.fxml" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
<VBox.margin>
<Insets left="2.0" right="2.0" />
</VBox.margin>
</AnchorPane>
View IdentifiableController.java
public interface IdentifiableController {
String getId();
}
@andytill
andytill / brume.css
Created Aug 20, 2012
JavaFX Light Grey Brume Theme
View brume.css
/**
* JavaFX CSS light grey/white 'brume' theme.
*/
.titled-pane {
-fx-effect: dropshadow(three-pass-box, #9F9F9F, 15, 0, 0, 0);
-fx-animated: true;
-fx-text-fill: #505050;
}
View ControllerLookup.java
import java.util.List;
public class ControllerLookup {
private final List<IdentifiableController> identifiables;
public ControllerLookup(List<IdentifiableController> identifiables) {
this.identifiables = identifiables;
}
@SuppressWarnings("unchecked")
You can’t perform that action at this time.