Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
55fcd3b
JavaFX tutorials 1 through 3, branch teamwork
ivyrodriguez Jul 2, 2016
cfc3fe3
JavaFX tutorials 1 through 3, branch teamwork
ivyrodriguez Jul 2, 2016
d06cb7b
Merge branch 'teamwork' of https://github.com/OpenSourceJavaProject/J…
ivyrodriguez Jul 2, 2016
3985bb0
Tutorial 1, creating a basic window added
RonyAlvarez Jul 3, 2016
895b841
Tutorial 2, handling user events added
RonyAlvarez Jul 3, 2016
449aac1
JavaFX Tutorials
Jul 4, 2016
9020219
Merge branch 'teamwork' of https://github.com/OpenSourceJavaProject/J…
Jul 4, 2016
bc886fe
Added 4 FX Tutorials - Clossing Windows Properly, Communication Betwe…
kazoo135 Jul 5, 2016
3b1309c
Tutorials 4 through 6
ivyrodriguez Jul 6, 2016
d52884c
Merge branch 'teamwork' of https://github.com/OpenSourceJavaProject/J…
ivyrodriguez Jul 6, 2016
e27fbde
Added FX Tutorial Extracting and Validating Input
kazoo135 Jul 6, 2016
e34213f
Merge branch 'teamwork' of https://github.com/OpenSourceJavaProject/J…
kazoo135 Jul 6, 2016
4040e00
Added two FX Tutorials - CheckBox and ChoiceBox
kazoo135 Jul 6, 2016
189fd3b
Added two FX Tutorials, ComboBox and TreeView
kazoo135 Jul 7, 2016
94571ae
Added two FX Studies Tutorials. Completed ListView Tutorial, conflate…
kazoo135 Jul 9, 2016
c08a47d
Finished JavaFX Tutorial
Jul 11, 2016
8b0f0ae
Added FX_Menus project which contains all tutorials related to build …
kazoo135 Jul 11, 2016
4a23c37
Merge branch 'teamwork' of https://github.com/OpenSourceJavaProject/J…
kazoo135 Jul 11, 2016
17c3b1c
Tutorials 7-9
ivyrodriguez Jul 11, 2016
076fb56
Tutorials 10-12
ivyrodriguez Jul 13, 2016
20e4bfa
first test on JavaFxStudies, branch teamwork
Chent03 Jul 13, 2016
992f732
Added FX Tutorial - working with CSS
kazoo135 Jul 14, 2016
1e79c74
Added FX Tutorial on working with Properties of objects
kazoo135 Jul 14, 2016
119be31
Added FX Tutorial on Binding Properties
kazoo135 Jul 14, 2016
d537b34
Add two FXML tutorials. Basci FXML example and one demonstrating Bin…
kazoo135 Jul 14, 2016
289a422
Added FX Tutorial 35. Working with Scene Builder
kazoo135 Jul 14, 2016
8a89dd8
Added tutorials 4 and 5
RonyAlvarez Jul 15, 2016
8c486d7
Added tutorial 5
RonyAlvarez Jul 15, 2016
5ce488b
JavaFxTutorials
Chent03 Jul 17, 2016
fce1d1a
others
Chent03 Jul 17, 2016
2d82118
Added tutorials 6 to 18
RonyAlvarez Jul 18, 2016
4aa526c
Added tutorials 19 and 20
RonyAlvarez Jul 18, 2016
da5ff1f
Tutorials 13-16
ivyrodriguez Jul 18, 2016
6d9eb33
Added tutorials 21 to 24
RonyAlvarez Jul 18, 2016
4bc515c
Merge branch 'teamwork' of https://github.com/OpenSourceJavaProject/J…
RonyAlvarez Jul 18, 2016
8864292
Added tutorials 24 to 27
RonyAlvarez Jul 18, 2016
fe34f1e
Added tutorials 28 to 30
RonyAlvarez Jul 19, 2016
28e4a0f
Tutorials 17 - 20
ivyrodriguez Jul 19, 2016
95635ba
Added FXML tutorials
RonyAlvarez Jul 19, 2016
171c5db
Tutorials 21-30
ivyrodriguez Jul 20, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions chentony/JavaFxTutorial1-3/EventHandlerTutorial1-3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package sample;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application{

Button button;

@Override
public void start(Stage primaryStage) throws Exception{
primaryStage.setTitle("Title of the Window");

button = new Button();
button.setText("Click me");
button.setOnAction(e -> {
System.out.println("hey now brown cow");
System.out.println("PokemonGo");
});

StackPane layout = new StackPane();
layout.getChildren().add(button);

Scene scene = new Scene(layout, 300, 250);
primaryStage.setScene(scene);
primaryStage.show();
}



public static void main(String[] args) {
launch(args);
}
}
68 changes: 68 additions & 0 deletions chentony/JavaFxTutorial10/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;


public class Main extends Application {

Stage window;
Button button;

@Override
public void start(Stage primaryStage) throws Exception{
window = primaryStage;
window.setTitle("Tony Chen");

GridPane gridPane = new GridPane();
gridPane.setPadding(new Insets(10, 10, 10, 10));
gridPane.setVgap(8);
gridPane.setHgap(10);

//Form
TextField nameInput = new TextField();
button = new Button("Click me");
button.setOnAction(e -> isInt(nameInput, nameInput.getText()) );



//Layout
VBox layout = new VBox();
layout.setPadding(new Insets(20, 20, 20, 20));
layout.getChildren().addAll(nameInput, button);

Scene scene = new Scene(layout, 300, 250);
window.setScene(scene);
window.show();


}


public static void main(String[] args) {

launch(args);
}

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;

}
}

}
72 changes: 72 additions & 0 deletions chentony/JavaFxTutorial11/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;


public class Main extends Application {

Stage window;
Button button;

@Override
public void start(Stage primaryStage) throws Exception{
window = primaryStage;
window.setTitle("Subways");


//Checkboxes
CheckBox box1 = new CheckBox("Bacon");
CheckBox box2 = new CheckBox("Tuna");
box2.setSelected(true);


//Button
button = new Button("Order Now");
button.setOnAction(e -> handleOptions(box1, box2));





//Layout
VBox layout = new VBox();
layout.setPadding(new Insets(20, 20, 20, 20));
layout.getChildren().addAll(box1, box2, button);

Scene scene = new Scene(layout, 300, 250);
window.setScene(scene);
window.show();


}



public static void main(String[] args) {

launch(args);
}

private void handleOptions(CheckBox box1, CheckBox box2){
String message = "Users order:\n";

if(box1.isSelected())
message += "Bacon\n";
if(box2.isSelected())
message += "Tuna\n";

System.out.println(message);
}

}
63 changes: 63 additions & 0 deletions chentony/JavaFxTutorial12/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;


public class Main extends Application {

Stage window;
Button button;

@Override
public void start(Stage primaryStage) throws Exception{
window = primaryStage;
window.setTitle("Subways");



//Button
button = new Button("Order Now");

ChoiceBox<String> choiceBox = new ChoiceBox<>();
//getItems returns the ObserableList object which oyu can add items to
choiceBox.getItems().add("Apples");
choiceBox.getItems().add("Bananas");
choiceBox.getItems().addAll("Bacon", "Ham", "Meatballs");

choiceBox.setValue("Apples");

button.setOnAction(e -> getChoice(choiceBox));

//Layout
VBox layout = new VBox();
layout.setPadding(new Insets(20, 20, 20, 20));
layout.getChildren().addAll(choiceBox, button);

Scene scene = new Scene(layout, 300, 250);
window.setScene(scene);
window.show();


}



public static void main(String[] args) {

launch(args);
}

private void getChoice(ChoiceBox<String> choiceBox){
String food = choiceBox.getValue();
System.out.println(food);
}

}
62 changes: 62 additions & 0 deletions chentony/JavaFxTutorial13/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;


public class Main extends Application {

Stage window;
Button button;

@Override
public void start(Stage primaryStage) throws Exception{
window = primaryStage;
window.setTitle("Subways");



//Button
button = new Button("Order Now");

ChoiceBox<String> choiceBox = new ChoiceBox<>();
//getItems returns the ObserableList object which you can add items to
choiceBox.getItems().add("Apples");
choiceBox.getItems().add("Bananas");
choiceBox.getItems().addAll("Bacon", "Ham", "Meatballs");
choiceBox.setValue("Apples");

//Listen for selection changes
choiceBox.getSelectionModel().selectedItemProperty().addListener( (v, oldValue, newValue) -> System.out.println(newValue));



//Layout
VBox layout = new VBox();
layout.setPadding(new Insets(20, 20, 20, 20));
layout.getChildren().addAll(choiceBox, button);

Scene scene = new Scene(layout, 300, 250);
window.setScene(scene);
window.show();


}



public static void main(String[] args) {

launch(args);
}



}
66 changes: 66 additions & 0 deletions chentony/JavaFxTutorial14 - ComboBox/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;


public class Main extends Application {

Stage window;
Button button;
ComboBox<String> comboBox;

@Override
public void start(Stage primaryStage) throws Exception{
window = primaryStage;
window.setTitle("Subways");
button = new Button("Submit");

comboBox = new ComboBox<>();
comboBox.getItems().addAll(
"Good Will Hunting",
"St. Vincent",
"Blackhat"
);

comboBox.setPromptText("What is your favorite movie?");

comboBox.setEditable(true);
button.setOnAction(e -> printMovie());

comboBox.setOnAction(e -> System.out.println("User selected: " + comboBox.getValue()));


//Layout
VBox layout = new VBox();
layout.setPadding(new Insets(20, 20, 20, 20));
layout.getChildren().addAll(comboBox, button);

Scene scene = new Scene(layout, 300, 250);
window.setScene(scene);
window.show();


}

private void printMovie(){
System.out.println(comboBox.getValue());
}



public static void main(String[] args) {

launch(args);
}



}
Loading