Created
October 23, 2017 02:15
-
-
Save mik30s/8e500a5306dae27580bbb09d1915001c to your computer and use it in GitHub Desktop.
Lab14 GUI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.tarleton; | |
import javafx.application.Application; | |
import javafx.event.ActionEvent; | |
import javafx.event.EventHandler; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.control.Separator; | |
import javafx.scene.control.TextArea; | |
import javafx.scene.control.ToolBar; | |
import javafx.scene.image.Image; | |
import javafx.scene.image.ImageView; | |
import javafx.scene.layout.StackPane; | |
import javafx.scene.layout.VBox; | |
import javafx.stage.Stage; | |
public class Lab14 extends Application { | |
public static EditorMenu menu = new EditorMenu(); | |
public TextArea txtArea = new TextArea(); | |
@Override | |
public void start(Stage primaryStage) { | |
VBox root = createToolBar(); | |
Scene scene = new Scene(root, 300, 250); | |
menu.setMenuHandler(EditorMenu.format, EditorMenu.FONT, e -> { | |
openFontDialog(txtArea.selectedTextProperty().get()); | |
}); | |
primaryStage.setTitle("Hello World!"); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
} | |
public VBox createToolBar() { | |
ImageView[] imv = new ImageView[]{ | |
new ImageView(new Image(getClass().getResourceAsStream("new.png"))), | |
new ImageView(new Image(getClass().getResourceAsStream("save.png"))), | |
new ImageView(new Image(getClass().getResourceAsStream("cut.png"))), | |
new ImageView(new Image(getClass().getResourceAsStream("copy.png"))), | |
new ImageView(new Image(getClass().getResourceAsStream("paste.png"))), | |
}; | |
Button[] buttons = new Button[]{ | |
new Button(), | |
new Button(), | |
new Button(), | |
new Button(), | |
new Button() | |
}; | |
int i = 0; | |
for (Button bt : buttons) { | |
bt.setGraphic(imv[i]); | |
i++; | |
} | |
return new VBox(new ToolBar((Button[])buttons)); | |
} | |
public void openFontDialog(String text) { | |
} | |
public static void main(String[] args) { | |
launch(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment