the code will show you what im trying to do, I hope you understand

im new to programming but know the basics of java and im trying to add Object Oriented Programming to my apps so its not procedural
thanks , if you need more info to understand just ask me.

   package myApp;

    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.VBox;
    import javafx.stage.Stage;
    public class Main extends Application {

        public void start(Stage myStage) throws Exception


            VBox root = new VBox();

            Scene scene = new Scene(root);



            Button btn = new Button("Click Me");


            bank yo = new bank();

            btn.setOnAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {




        public static void main(String[] args) {


package myApp;

import javafx.scene.control.Button;

public class bank


    public static void customer()





Edited by Keven_1

9 Months
Discussion Span
Last Post by JamesCherrill

In OO each object has a public interface and a private implementation. No object has access to any other object's private implementation. This massively simplifies the overall architecture by restricting the number of ways that objects can interact. What you are doing here violates that; the bank object is trying to fiddle with part of the GUI's implementation.

The standard architectural solution to this is called MVC. There's loads of stuff on the web about it, but here's a good starting explanation. Google for more.

When you've read that, note that in JavaFX the model and the controller are very often combined in one class, but the model is always separate and independent.

Edited by JamesCherrill

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.