Demo entry 6718725

Calculator

   

Submitted by anonymous on Mar 06, 2018 at 08:31
Language: Java. Code size: 947 Bytes.

package sample;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

public class Main extends Application {
    private Button btn;
    private TextField txf;

    @Override
    public void start(Stage primaryStage) throws Exception{
        Parent root = FXMLLoader.load(getClass().getResource("GUI.fxml"));
        initView(root);
        Scene scene = new Scene(root, 600, 400);
        primaryStage.setTitle("Function Exercise");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    private void initView(Parent parent){
        this.btn = (Button)parent.lookup("#calButton");
        this.txf = (TextField)parent.lookup("#resultOut");
    }

    public static void main(String[] args){
        Application.launch(Main.class, args);
    }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).