Skip to content

Instantly share code, notes, and snippets.

package org.dejay.javafx.example;
import javafx.animation.Transition;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Region;
import javafx.scene.text.Font;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.chart.*;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fxzoomtest01;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.ScaleTransition;
import javafx.animation.Timeline;
GridPane grid = new GridPane();
grid.setPadding(new Insets(10, 10, 10, 10));
grid.setVgap(8);
grid.setHgap(10);
Label username = new Label("Username");
GridPane.setConstraints(username, 0, 0);
//Name input
TextField nameInput = new TextField();
@ahn94
ahn94 / ValidateInt.java
Created July 12, 2015 01:06
Extract and validate textview input
private boolean isInt(TextField input, String message){
try {
int age = Integer.parseInt(input.getText());
System.out.println("user is: " + age);
return true;
} catch (NumberFormatException e){
System.out.println("Error: " + message + " is not a number");
return false;
}
}
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
public class Main extends Application {
@ahn94
ahn94 / ChoiceBoxListen.java
Created July 12, 2015 02:16
Listens for change in selection of choiebox selection
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
public class Main extends Application {
@ahn94
ahn94 / ComboExample.java
Created July 12, 2015 02:38
ComboBox is useful
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;
public class Main extends Application {
import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;