Created
March 7, 2018 09:15
-
-
Save chaule97/0f23280ccf50e7810f0e84b7db067822 to your computer and use it in GitHub Desktop.
Source Code JavaFX for HowKteam
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
<component name="ArtifactManager"> | |
<artifact type="javafx" name="JavaFXApp"> | |
<output-path>$PROJECT_DIR$/out/artifacts/JavaFXApp</output-path> | |
<properties id="javafx-properties"> | |
<options> | |
<option name="appClass" value="sample.Main" /> | |
</options> | |
</properties> | |
<root id="root"> | |
<element id="archive" name="JavaFXApp.jar"> | |
<element id="module-output" name="JavaFXTutorials" /> | |
</element> | |
</root> | |
</artifact> | |
</component> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="CompilerConfiguration"> | |
<option name="DEFAULT_COMPILER" value="Javac" /> | |
<resourceExtensions /> | |
<wildcardResourcePatterns> | |
<entry name="!?*.java" /> | |
<entry name="!?*.form" /> | |
<entry name="!?*.class" /> | |
<entry name="!?*.groovy" /> | |
<entry name="!?*.scala" /> | |
<entry name="!?*.flex" /> | |
<entry name="!?*.kt" /> | |
<entry name="!?*.clj" /> | |
</wildcardResourcePatterns> | |
<annotationProcessing> | |
<profile default="true" name="Default" enabled="false"> | |
<processorPath useClasspath="true" /> | |
</profile> | |
</annotationProcessing> | |
</component> | |
</project> | |
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
<html>Simple <b>JavaFX 2.0</b> application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided. | |
</html> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> | |
</project> | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="GradleSettings"> | |
<option name="gradleHome" value="C:/Program Files (x86)/Gradle/gradle-1.0-rc-3" /> | |
</component> | |
</project> | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="EntryPointsManager"> | |
<entry_points version="2.0" /> | |
</component> | |
<component name="ProjectKey"> | |
<option name="state" value="project://e79810c8-c5c8-43b1-b19c-90c1f4095425" /> | |
</component> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_9" project-jdk-name="9.0" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/JavaFXTutorials.iml" filepath="$PROJECT_DIR$/JavaFXTutorials.iml" /> | |
</modules> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="Palette2"> | |
<group name="Swing"> | |
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> | |
</item> | |
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> | |
</item> | |
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> | |
</item> | |
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> | |
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> | |
</item> | |
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> | |
<initial-values> | |
<property name="text" value="Button" /> | |
</initial-values> | |
</item> | |
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> | |
<initial-values> | |
<property name="text" value="RadioButton" /> | |
</initial-values> | |
</item> | |
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> | |
<initial-values> | |
<property name="text" value="CheckBox" /> | |
</initial-values> | |
</item> | |
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> | |
<initial-values> | |
<property name="text" value="Label" /> | |
</initial-values> | |
</item> | |
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |
<preferred-size width="150" height="-1" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |
<preferred-size width="150" height="-1" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |
<preferred-size width="150" height="-1" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> | |
</item> | |
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> | |
<preferred-size width="200" height="200" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> | |
<preferred-size width="200" height="200" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> | |
</item> | |
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> | |
</item> | |
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> | |
</item> | |
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> | |
</item> | |
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> | |
<preferred-size width="-1" height="20" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> | |
</item> | |
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> | |
</item> | |
</group> | |
</component> | |
</project> | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="VcsDirectoryMappings"> | |
<mapping directory="" vcs="" /> | |
</component> | |
</project> | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |
<exclude-output /> | |
<content url="file://$MODULE_DIR$"> | |
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> | |
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 sample; | |
import javafx.application.Application; | |
import javafx.event.ActionEvent; | |
import javafx.event.EventHandler; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.layout.StackPane; | |
import javafx.stage.Stage; | |
public class Main1 extends Application{ | |
Button button; | |
public static void main(String[] args) { | |
launch(args); | |
} | |
@Override | |
public void start(Stage primaryStage) { | |
primaryStage.setTitle("Hello World"); | |
button = new Button(); | |
button.setText("Say Hello World"); | |
button.setOnAction(new EventHandler<ActionEvent>() { | |
@Override | |
public void handle(ActionEvent event) { | |
System.out.println("Hello Howkteam"); | |
} | |
}); | |
StackPane layout = new StackPane(); | |
layout.getChildren().add(button); | |
Scene scene = new Scene(layout, 300, 250); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
} | |
} |
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 sample; | |
import javafx.application.Application; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.control.Label; | |
import javafx.scene.layout.StackPane; | |
import javafx.scene.layout.VBox; | |
import javafx.stage.Stage; | |
public class Main2 extends Application { | |
Stage window; | |
Scene scene1, scene2; | |
public static void main(String[] args) { | |
launch(args); | |
} | |
@Override | |
public void start(Stage primaryStage) { | |
window = primaryStage; | |
//Scene1 | |
Label label = new Label("Welcome to Howkteam"); | |
Button button1 = new Button("Go to course"); | |
button1.setOnAction(event -> { | |
window.setScene(scene2); | |
}); | |
VBox layout1 = new VBox(); | |
layout1.getChildren().addAll(label, button1); | |
scene1 = new Scene(layout1, 300, 200); | |
//Scene2 | |
Button button2 = new Button("Go back"); | |
button2.setOnAction(event -> { | |
window.setScene(scene1); | |
}); | |
StackPane layout2 = new StackPane(); | |
layout2.getChildren().add(button2); | |
scene2 = new Scene(layout2, 200, 300); | |
window.setScene(scene1); | |
window.show(); | |
} | |
} |
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 sample; | |
import javafx.application.Application; | |
import javafx.event.ActionEvent; | |
import javafx.event.EventHandler; | |
import javafx.scene.Scene; | |
import javafx.scene.control.*; | |
import javafx.scene.layout.StackPane; | |
import javafx.stage.Stage; | |
import java.util.Optional; | |
public class Main3 extends Application { | |
Button button; | |
public static void main(String[] args) { | |
launch(args); | |
} | |
@Override | |
public void start(Stage primaryStage) { | |
primaryStage.setTitle("Alert Example"); | |
button = new Button(); | |
button.setText("Close"); | |
button.setOnAction(e -> { | |
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); | |
alert.setTitle("Cofirmation"); | |
alert.setHeaderText("Alert Information"); | |
alert.setContentText("choose your option"); | |
ButtonType buttonTypeYes = new ButtonType("Yes", ButtonBar.ButtonData.YES); | |
ButtonType buttonTypeNo = new ButtonType("No", ButtonBar.ButtonData.NO); | |
ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE); | |
alert.getButtonTypes().setAll(buttonTypeYes, buttonTypeNo, buttonTypeCancel); | |
Optional<ButtonType> result = alert.showAndWait(); | |
if (result.get()== buttonTypeYes) | |
System.out.println("Code for yes"); | |
else if (result.get().getButtonData() == ButtonBar.ButtonData.NO) | |
System.out.println("Code for no"); | |
else | |
System.out.println("Code for cancel"); | |
String message = result.get().getText(); | |
Alert alert1 = new Alert(Alert.AlertType.INFORMATION); | |
alert1.setTitle("Information"); | |
alert1.setHeaderText("Notification"); | |
alert1.setContentText(message); | |
alert1.show(); | |
}); | |
StackPane layout = new StackPane(); | |
layout.getChildren().add(button); | |
Scene scene = new Scene(layout, 300, 250); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
} | |
} |
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 sample; | |
import javafx.application.Application; | |
import javafx.geometry.Insets; | |
import javafx.scene.Node; | |
import javafx.scene.control.*; | |
import javafx.scene.layout.GridPane; | |
import javafx.stage.Stage; | |
import javafx.util.Pair; | |
import java.util.Optional; | |
public class Main4 extends Application { | |
public static void main(String[] args) { | |
launch(args); | |
} | |
@Override | |
public void start(Stage primaryStage) { | |
Dialog<Pair<String, String>> dialog = new Dialog<>(); | |
dialog.setTitle("login Dialog"); | |
dialog.setHeaderText("Sign Up"); | |
ButtonType loginButtonType = new ButtonType("login", ButtonBar.ButtonData.OK_DONE); | |
dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); | |
GridPane grid = new GridPane(); | |
grid.setHgap(10); | |
grid.setVgap(10); | |
grid.setPadding(new Insets(20, 150, 10, 10)); | |
TextField userName = new TextField(); | |
userName.setPromptText("Username"); | |
PasswordField password = new PasswordField(); | |
password.setPromptText("Password"); | |
grid.add(new Label("Username:"), 0, 0); | |
grid.add(userName, 1, 0); | |
grid.add(new Label("Password:"), 0, 1); | |
grid.add(password, 1, 1); | |
Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType); | |
loginButton.setDisable(true); | |
userName.textProperty().addListener((observable, oldValue, newValue) -> { | |
loginButton.setDisable(newValue.trim().isEmpty()); | |
}); | |
dialog.getDialogPane().setContent(grid); | |
dialog.setResultConverter(dialogButton -> { | |
if (dialogButton == loginButtonType){ | |
return new Pair<>(userName.getText(), password.getText()); | |
} | |
return null; | |
} ); | |
Optional<Pair<String, String>> result = dialog.showAndWait(); | |
result.ifPresent(userNamepassword -> { | |
System.out.println("Username="+userNamepassword.getKey()+", Password="+userNamepassword.getValue()); | |
}); | |
} | |
} |
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 sample; | |
import javafx.application.Application; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Button; | |
import javafx.scene.control.CheckBox; | |
import javafx.scene.control.Label; | |
import javafx.scene.layout.HBox; | |
import javafx.scene.layout.VBox; | |
import javafx.stage.Stage; | |
public class Main5 extends Application { | |
public static void main(String[] args) { | |
launch(args); | |
} | |
@Override | |
public void start(Stage primaryStage) { | |
Label label = new Label("Programming Language"); | |
CheckBox box1 = new CheckBox("Java"); | |
CheckBox box2 = new CheckBox("C#"); | |
CheckBox box3 = new CheckBox("Python"); | |
box1.setSelected(true); | |
Button button = new Button("Submit"); | |
button.setOnAction(e -> { | |
String message = "Your language:"; | |
if (box1.isSelected()) | |
message += box1.getText(); | |
if (box2.isSelected()) | |
message += box2.getText(); | |
if (box3.isSelected()) | |
message += box3.getText(); | |
System.out.println(message); | |
}); | |
HBox layoutH = new HBox(10); | |
layoutH.getChildren().addAll(box1, box2, box3); | |
VBox layoutV = new VBox(10); | |
layoutV.getChildren().addAll(label, layoutH, button); | |
Scene scene = new Scene(layoutV, 300, 200); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
} | |
} |
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 sample; | |
public class Main6 { | |
public static void main(String[] args) { | |
MyNumber example = new MyNumber(); | |
example.numberProperty().addListener((observable, oldValue, newValue) -> { | |
System.out.println(observable); | |
System.out.println(oldValue); | |
System.out.println(newValue); | |
}); | |
example.setNumber(10); | |
example.setNumber(11); | |
} | |
} |
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 sample; | |
import javafx.beans.property.IntegerProperty; | |
import javafx.beans.property.SimpleIntegerProperty; | |
public class Main7 { | |
public static void main(String[] args) { | |
IntegerProperty a = new SimpleIntegerProperty(4); | |
IntegerProperty b = new SimpleIntegerProperty(); | |
System.out.println(b.getValue()); | |
b.bind(a.add(3)); | |
a.setValue(12); | |
System.out.println(b.getValue()); | |
a.setValue(10); | |
System.out.println(b.getValue()); | |
} | |
} |
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 sample.Main8; | |
public class Controller { | |
} |
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 sample.Main8; | |
import javafx.application.Application; | |
import javafx.fxml.FXMLLoader; | |
import javafx.scene.Parent; | |
import javafx.scene.Scene; | |
import javafx.stage.Stage; | |
public class Main8 extends Application { | |
@Override | |
public void start(Stage primaryStage) throws Exception{ | |
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); | |
primaryStage.setTitle("Hello World"); | |
primaryStage.setScene(new Scene(root, 851, 640)); | |
primaryStage.show(); | |
} | |
public static void main(String[] args) { | |
launch(args); | |
} | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?import javafx.scene.control.*?> | |
<?import java.lang.*?> | |
<?import javafx.scene.layout.*?> | |
<?import javafx.geometry.Insets?> | |
<?import javafx.scene.layout.GridPane?> | |
<?import javafx.scene.control.Button?> | |
<?import javafx.scene.control.Label?> | |
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="640.0" prefWidth="851.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> | |
<top> | |
<MenuBar BorderPane.alignment="CENTER"> | |
<menus> | |
<Menu mnemonicParsing="false" text="File"> | |
<items> | |
<MenuItem mnemonicParsing="false" text="Close" /> | |
</items> | |
</Menu> | |
<Menu mnemonicParsing="false" text="Edit"> | |
<items> | |
<MenuItem mnemonicParsing="false" text="Delete" /> | |
</items> | |
</Menu> | |
<Menu mnemonicParsing="false" text="Help"> | |
<items> | |
<MenuItem mnemonicParsing="false" text="About" /> | |
</items> | |
</Menu> | |
</menus> | |
</MenuBar> | |
</top> | |
<center> | |
<TableView prefHeight="608.0" prefWidth="556.0" BorderPane.alignment="CENTER"> | |
<columns> | |
<TableColumn prefWidth="75.0" text="C1" /> | |
<TableColumn prefWidth="75.0" text="C2" /> | |
</columns> | |
</TableView> | |
</center> | |
<right> | |
<VBox prefHeight="200.0" prefWidth="100.0" BorderPane.alignment="CENTER"> | |
<children> | |
<GridPane> | |
<columnConstraints> | |
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | |
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> | |
</columnConstraints> | |
<rowConstraints> | |
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | |
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | |
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> | |
</rowConstraints> | |
<children> | |
<Label text="Label" /> | |
<Button mnemonicParsing="false" text="Button" GridPane.columnIndex="1" /> | |
<Label text="Label" GridPane.rowIndex="1" /> | |
<TextField GridPane.columnIndex="1" GridPane.rowIndex="1" /> | |
</children> | |
</GridPane> | |
</children> | |
</VBox> | |
</right> | |
<left> | |
<TreeView prefHeight="556.0" prefWidth="166.0" BorderPane.alignment="CENTER" /> | |
</left> | |
</BorderPane> |
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 sample.Main9; | |
import javafx.event.ActionEvent; | |
import javafx.fxml.FXML; | |
import javafx.scene.control.Alert; | |
import javafx.scene.control.TextField; | |
public class Controller { | |
@FXML | |
private TextField Height; | |
public void Submit (ActionEvent event){ | |
String height = Height.getText(); | |
Alert alert = new Alert(Alert.AlertType.INFORMATION); | |
alert.setContentText("Chiều cao của bạn:"+height+"cm"); | |
alert.show(); | |
} | |
} |
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 sample.Main9; | |
import javafx.application.Application; | |
import javafx.fxml.FXMLLoader; | |
import javafx.scene.Parent; | |
import javafx.scene.Scene; | |
import javafx.stage.Stage; | |
public class Main9 extends Application { | |
public static void main(String[] args) { | |
launch(args); | |
} | |
@Override | |
public void start(Stage primaryStage) { | |
try{ | |
Parent root = FXMLLoader.load(this.getClass().getResource("sample.fxml")); | |
Scene scene = new Scene(root); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
}catch (Exception e){ | |
System.out.println(e.getMessage()); | |
} | |
} | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?import javafx.scene.control.Button?> | |
<?import javafx.scene.control.Label?> | |
<?import javafx.scene.control.TextField?> | |
<?import javafx.scene.layout.AnchorPane?> | |
<?import javafx.scene.text.Font?> | |
<AnchorPane prefHeight="345.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/9" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Main9.Controller"> | |
<children> | |
<Label layoutX="188.0" layoutY="75.0" text="Nhập chiều cao của bạn:"> | |
<font> | |
<Font size="18.0" /> | |
</font> | |
</Label> | |
<TextField fx:id="Height" layoutX="223.0" layoutY="114.0" /> | |
<Button layoutX="269.0" layoutY="200.0" mnemonicParsing="false" onAction="#Submit" text="Nhập" /> | |
</children> | |
</AnchorPane> |
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 sample; | |
import javafx.beans.property.*; | |
public class MyNumber { | |
private DoubleProperty number = new SimpleDoubleProperty(); | |
public double getNumber() { | |
return number.get(); | |
} | |
public DoubleProperty numberProperty() { | |
return number; | |
} | |
public void setNumber(double number) { | |
this.number.set(number); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment