Skip to content
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added tutorials 21 to 24
  • Loading branch information
RonyAlvarez committed Jul 18, 2016
commit 6d9eb33ee609036f037732a56bab1e6d140dd282
87 changes: 87 additions & 0 deletions ronyalvarez/MyJavaFXStudies/21_22_23_24_Menus/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import com.intellij.codeInsight.intention.impl.ConcatenationToMessageFormatAction;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.*;
import javafx.stage.Stage;

public class Main extends Application {

Stage window;
BorderPane layout;

public static void main(String[] args) {
launch(args);
}

@Override
public void start(Stage primaryStage) throws Exception {
window = primaryStage;
window.setTitle("JavaFX - Rony Alvarez");

//File menu
Menu fileMenu = new Menu("File");
MenuItem newFile = new MenuItem("New...");
newFile.setOnAction(e -> System.out.println("Create a new file..."));
fileMenu.getItems().add(newFile);
fileMenu.getItems().add(new MenuItem("Open..."));
fileMenu.getItems().add(new MenuItem("Save..."));
fileMenu.getItems().add(new SeparatorMenuItem());
fileMenu.getItems().add(new MenuItem("Settings..."));
fileMenu.getItems().add(new SeparatorMenuItem());
fileMenu.getItems().add(new MenuItem("Exit..."));

//Edit menu
Menu editMenu = new Menu("_Edit");
editMenu.getItems().add(new MenuItem("Cut"));
editMenu.getItems().add(new MenuItem("Copy"));
MenuItem paste = new MenuItem("Paste");
paste.setOnAction(e -> System.out.println("Pasting some crap"));
paste.setDisable(true);
editMenu.getItems().add(paste);

//Help menu
Menu helpMenu = new Menu("Help");
CheckMenuItem showLines = new CheckMenuItem("Show Line Numbers");
showLines.setOnAction(e -> {
if(showLines.isSelected())
System.out.println("Program will now display line numbers");
else
System.out.println("Hiding line number");
});
CheckMenuItem autoSave = new CheckMenuItem("Enable Autosave");
autoSave.setSelected(true);
helpMenu.getItems().addAll(showLines, autoSave);

//Difficulty RadioMenuItems
Menu difficultyMenu = new Menu("Difficulty");
ToggleGroup difficultyToggle = new ToggleGroup();

RadioMenuItem easy = new RadioMenuItem("Easy");
RadioMenuItem medium = new RadioMenuItem("Medium");
RadioMenuItem hard = new RadioMenuItem("Hard");

easy.setToggleGroup(difficultyToggle);
medium.setToggleGroup(difficultyToggle);
hard.setToggleGroup(difficultyToggle);

difficultyMenu.getItems().addAll(easy, medium, hard);

//Main menu bar
MenuBar menuBar = new MenuBar();
menuBar.getMenus().addAll(fileMenu, editMenu, helpMenu, difficultyMenu);

layout = new BorderPane();
layout.setTop(menuBar);
Scene scene = new Scene(layout, 400, 300);
window.setScene(scene);
window.show();
}

}