JavaFX Java GUI Tutorial - 9 - GridPane

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ธ.ค. 2024

ความคิดเห็น • 93

  • @danyyilbun6736
    @danyyilbun6736 5 ปีที่แล้ว +15

    Dude, these tutorials are basically saving me from failing college

  • @delphi8333
    @delphi8333 3 ปีที่แล้ว +1

    as someone from New England, transplanted to CA, really enjoying the humor and accent from home. The learning coding process is so much more fun cause you throw in the jokes and stories and funny messages and titles etc. Thank you very much!

  • @MrJzlavallee
    @MrJzlavallee 8 ปีที่แล้ว +66

    Upvoted for "Easy, breezy, beautiful, cover girl."

    • @dayday8421
      @dayday8421 6 ปีที่แล้ว

      The fact it was just before 4:20 earned a subscribe!

  • @willorwig1824
    @willorwig1824 3 ปีที่แล้ว +4

    Bro i gotta say You are good af at this. I'm a python programmer. I've been doing java for about 2 weeks. I've learned more watching these videos and making apps than i have watching my Udemy course. Ty bro. Much apprieciated. I'm about to go back through and make sure i liked all em

  • @Rowgun254
    @Rowgun254 9 ปีที่แล้ว +19

    These Javafx tutorials are awesome! I hope you make around 200 of them!

  • @fireflies15
    @fireflies15 6 ปีที่แล้ว +5

    the prompt text is so interesting. Java final tomorrow and let me tell you boi you're helping a lot of us poor collage students so thanks a lot. needless to say you're known for being "the one with the tuna class"

  • @zacksai9955
    @zacksai9955 3 ปีที่แล้ว

    Thank you wow this was super helpful! I really liked how you explained WHY we need to write each line and WHAT the h it means. Carry on lad

  • @dylanpusilo8029
    @dylanpusilo8029 3 ปีที่แล้ว +3

    In a newer version of JavaFx, the one I'm using, the addConstraints() method and the getChildren().addAll() method are in a simple add() method

  • @dppjos
    @dppjos 4 ปีที่แล้ว +2

    Thank you, for your wonderful tutorials, Mr. FunnyAccent-TunaClass-LaundryBasket :D :D

  • @kennyPAGC
    @kennyPAGC 8 ปีที่แล้ว +18

    I think it's soo weird that setConstraints is a static method. Why?? And how does it even hook to the instantiated grid?

    • @TopherTalks
      @TopherTalks 8 ปีที่แล้ว +14

      Totally just looked this up, the constraints are actually set to the Node element (i.e. the object you'll be adding to the gridpane) so it doesn't actually have any relevance to the instantiated grid at all, all the settings are saved inside the component instead (and presumably get pulled back out by the gridpane later)... I assume it's done this way so components can be reused and therefore added to different gridpanes while still remembering their position and ensuring the same layout each time.

    • @TopherTalks
      @TopherTalks 8 ปีที่แล้ว +1

      It also guarantees that you fit everything into the grid, rather than defining a grid then trying to add a component to a cell that doesn't exist the number of cells can be calculated once everything is added, rather then being defined before.

    • @mariusmeiners7496
      @mariusmeiners7496 6 ปีที่แล้ว +1

      i think it makes no sense to use that method anyway... you can also just call gridpane.add(node, rowindex, colindex)
      and then you save yourself the .addall line aswell..

  • @SenseiEli
    @SenseiEli 4 ปีที่แล้ว +7

    if you have an error with "grid.setPadding(new Insets(10,10,10,10));" Just check that you imported import javafx.geometry.Insets;
    (if you imported java.awt.Insets; you will get an error);

    • @aissaeldjouzi5333
      @aissaeldjouzi5333 4 ปีที่แล้ว +1

      thank u so much

    • @SenseiEli
      @SenseiEli 4 ปีที่แล้ว +2

      @@aissaeldjouzi5333 Happy to help!

    • @EliGoldfish
      @EliGoldfish 3 ปีที่แล้ว +1

      Thank you so much!

  • @pepsrunhell3399
    @pepsrunhell3399 3 ปีที่แล้ว

    Another tutorial 9 out of 9, thanks amigo

  • @SenseiEli
    @SenseiEli 4 ปีที่แล้ว

    Thank you very good and actually fun to learn this way!!!

  • @GabrielHasbun
    @GabrielHasbun 9 ปีที่แล้ว

    Good to see you are back.

  • @mohammadmahdifarrokhy260
    @mohammadmahdifarrokhy260 2 ปีที่แล้ว

    such an useful course it was. Thank you for making it

  • @herbert-kenumera960
    @herbert-kenumera960 5 ปีที่แล้ว +1

    I love this guy.

  • @hackoffz
    @hackoffz 3 ปีที่แล้ว

    Thank you very much for your tutorial! It was awesome for beginners.

  • @jerrygord3131
    @jerrygord3131 2 ปีที่แล้ว

    Very helpful, thank you!

  • @cptpackage
    @cptpackage 9 ปีที่แล้ว +1

    Best Bucky ever!

  • @TheWombatGuru
    @TheWombatGuru 9 ปีที่แล้ว +1

    Finally a new video :) Thank you Bucky

  • @shreekarshetti1406
    @shreekarshetti1406 4 ปีที่แล้ว

    This is the first video without "alright..." introduction from him lol

  • @DiaborMagics
    @DiaborMagics 8 ปีที่แล้ว

    How can I make the gridpane fill the entire window? They're all cramped up together in the upper left corner. I found Column/RowConstraints, but those didnt work. I set them all to 100%, but no visual changes whatsoever?

  • @tornuptom
    @tornuptom 9 ปีที่แล้ว +1

    Bucky, Could you dig deep into JavaFX/Java and do a series of tutorials on abstracting out business logic and Database stuff into different classes and show how a commercial application would be created... Iv come from a Winform C# background and im really interested in getting into Java, my problem(in both java and C#) is that i bulk out the form/scene classes(code behind) with too much business logic instead of abstracting it out so only UI code is in the class handing the Stage/Form... would be an amazing series to watch you develop a to-do list application or something small like that but laying the code out so its reusable and loosely coupled!!
    Keep up the tutorials!!

  • @APa98
    @APa98 4 ปีที่แล้ว

    Amazing tutorials !

  • @2002budokan
    @2002budokan 9 ปีที่แล้ว +1

    GridPane.setConstraints() method is static, how the instance access the parameters we send this method. Does this method change the state of the child-node? If so how? If it does not effect the child node, how the actual gridPane instance access these parameters that we set?

    • @backup_hdd
      @backup_hdd 8 ปีที่แล้ว

      I'm having the same question right now. Do you have an answer?

    • @2002budokan
      @2002budokan 8 ปีที่แล้ว

      +Samuel Kaiser No! I have reexamined the javadocs after your question, and still have no answer.

    • @backup_hdd
      @backup_hdd 8 ปีที่แล้ว

      +2002budokan Mh.... Meh. Thanks for your response!

  • @ethanwasme4307
    @ethanwasme4307 7 ปีที่แล้ว

    If we are creating a new GridPane object, why can't we use our user created object to call the Set Constraints function?

  • @brianoh99
    @brianoh99 9 ปีที่แล้ว

    Thanks. Keep practicing the Chinese accent! Is definition of widgets in code the better way to define them rather than fxml? I see that Oracle is not distributing the executable of Scene Builder. Is there a message there?

    • @OpenGL4ever
      @OpenGL4ever 9 ปีที่แล้ว

      Brian Oh No, defining their Look&feel via CSS is better because you can pass the CSS file to a designer who can't programme.

  • @ab9mamun
    @ab9mamun 9 ปีที่แล้ว +1

    why we always call getchildren() method? what it does actually?

  • @sunn1melon
    @sunn1melon 4 ปีที่แล้ว

    Why are you not using a PasswordField that is designated to be used for passwords instead of wrongly using a TextField?

  • @antonioquadrado734
    @antonioquadrado734 9 ปีที่แล้ว +1

    I can't call setPromptText method it appears to be in java.lang.String, what can i do?

    • @felipeaumann7404
      @felipeaumann7404 9 ปีที่แล้ว

      +António Quadrado sry bra i have no idea that what u can do, but ill be good to info you, java.lang.String is a class destinated to ''answer'' program properties, if u go to simple java console and write System.out.print, u can get the same problem with the same class, so your problem maybe hame some relation with this.'

  • @ap-pv7ug
    @ap-pv7ug 4 ปีที่แล้ว

    It's a little annoying that the setConstraints() method takes the row column parameters in the opposite order that 2D arrays do. That will take some getting used to.

  • @levenileon7423
    @levenileon7423 7 ปีที่แล้ว

    Excuse me sir! What about anchorPane? Do u have videos about it?

  • @cozycorner988
    @cozycorner988 3 ปีที่แล้ว

    i want to change the grid background color how to do it please

  • @thefelipefreitas
    @thefelipefreitas 3 ปีที่แล้ว

    Awesome!

  • @fcurcic
    @fcurcic 7 ปีที่แล้ว

    When i try to add textfields to the gridpane it gives me this error
    The method setConstraints(Node, int, int) in the type GridPane is not applicable for the arguments (TextField, int, int)

    • @fcurcic
      @fcurcic 7 ปีที่แล้ว

      Yeah, that was the problem

  • @ruochenli5574
    @ruochenli5574 6 ปีที่แล้ว

    love you bro!

  • @shahiruroshen837
    @shahiruroshen837 4 ปีที่แล้ว

    Very useful ❤️

  • @nicholascousar4306
    @nicholascousar4306 4 ปีที่แล้ว

    I find it annoying that every method for adding a node to a gridpane specifies the column index BEFORE the row index.

  • @aniskadri140
    @aniskadri140 2 ปีที่แล้ว

    Hello, why using Gridpane.setConstraints instead of grid.setConstraints ?

    • @Abma-gv2bj
      @Abma-gv2bj 2 ปีที่แล้ว

      setConstraints is a static method. grid is an instance

  • @mirsahib596
    @mirsahib596 7 ปีที่แล้ว

    where is the github code i can't find the repository

  • @yagzyalcntas553
    @yagzyalcntas553 7 ปีที่แล้ว

    but what if we have 2 different gridpanes and set 2 different constraints??

  • @mistermiyagi6073
    @mistermiyagi6073 6 ปีที่แล้ว

    I'd rather do object.add instead of class.setConstraints , that's why my prof taught me

  • @dominikotocan1348
    @dominikotocan1348 9 ปีที่แล้ว

    thenewboston Bucky, what happened to the android tutorials? There's still a lot to be covered. Maybe you can make tutorial series on building a fully functional application, covering topics like having a database on the server where you can store users who login/register, making some animations, sending data between users and so on...

  • @rizanamatya9191
    @rizanamatya9191 8 ปีที่แล้ว +1

    Awesome

  • @vanguelisk
    @vanguelisk 9 ปีที่แล้ว

    Why do not you use the Scene Builder?

    • @lukebrown2597
      @lukebrown2597 9 ปีที่แล้ว +1

      vanguelisk Because he's bucky. But he will show how to add controls manually then switch to scene builder just for better understanding.

    • @groberti
      @groberti 9 ปีที่แล้ว

      vanguelisk Scene Builder is horrible sadly

    • @groberti
      @groberti 9 ปีที่แล้ว

      vanguelisk It is just so much worse than WPF's GUI Builder which is integrated into Visual Studio. But I'd like to have a nice GUI Builder for JavaFX it could be really cool.

    • @groberti
      @groberti 9 ปีที่แล้ว

      vanguelisk but he could have used fxml definitions

    • @evandertorressaavedra
      @evandertorressaavedra 9 ปีที่แล้ว

      the question is why do not use fxml ? is fxml really helpful at large scale?

  • @cubingunlocked1812
    @cubingunlocked1812 7 ปีที่แล้ว +1

    hey can someone tell how can I change the password to dots or *??

    • @TheFuckel
      @TheFuckel 6 ปีที่แล้ว

      There is a PasswordField for that purposes.

  • @rohan_ray
    @rohan_ray 6 ปีที่แล้ว

    advanced form of this program with action for close and login button :D
    public class Main extends Application{
    static String ans;
    public static void main(String[] args) {
    launch(args);
    }
    @Override
    public void start(Stage primaryStage) {
    Stage sg = new Stage();
    sg.setTitle("Welcome to Facebook");
    TextField tf = new TextField();
    tf.setPromptText("Username");
    TextField tf1 = new TextField();
    tf1.setPromptText("Password");
    GridPane gp = new GridPane();
    gp.setPadding(new Insets(30 ,10 ,30 ,10));
    gp.setHgap(8);
    gp.setVgap(10);
    gp.add(new Label("Username: ") , 0 ,0);
    gp.setConstraints(tf , 1, 0);
    gp.add(new Label("Password"), 0 , 1);
    gp.setConstraints(tf1 , 1 ,1 );
    Button bt = new Button("Login");
    gp.setConstraints(bt , 1 ,2);
    gp.getChildren().addAll(tf , tf1 ,bt);
    Scene sc = new Scene(gp , 300 ,200);
    sg.setScene(sc);
    sg.show();
    bt.setOnAction(e-> cls("Are You sure You Want to Login?(will close the program)"));
    sg.setOnCloseRequest(e->{
    e.consume();
    cls("Are you sure you want to exit?");
    });
    }
    private void cls(String a) {
    Stage sg = new Stage();
    sg.setTitle("Confirmation");
    Button bt = new Button("Yes");
    Button bt2 = new Button("No");
    Label lb = new Label(a);
    sg.initModality(Modality.APPLICATION_MODAL);
    VBox vx = new VBox(20);
    sg.setMinWidth(250);
    vx.getChildren().addAll(lb , bt , bt2 );
    vx.setAlignment(Pos.CENTER);
    Scene sc =new Scene(vx , 300 ,110);
    sg.setScene(sc);
    sg.show();
    bt.setOnAction(e-> Platform.exit());
    bt2.setOnAction(e-> sg.close());
    }
    }

  • @mimizdani8194
    @mimizdani8194 5 ปีที่แล้ว +1

    setVgap seems more pervert than Vbox, its like the Gspot for Java :DDD

  • @mikekhourey521
    @mikekhourey521 9 ปีที่แล้ว

    THANK YOU!

  • @BtXFWkyZBtXFWkyZ
    @BtXFWkyZBtXFWkyZ 4 ปีที่แล้ว +1

    you could have user PasswordField for the password, it masks an input with dots :V

  • @rubickon
    @rubickon 9 ปีที่แล้ว

    thanks bucky!

  • @matiu7276
    @matiu7276 7 ปีที่แล้ว

    Now there is something like PasswordField. I found it.

  • @rimantasri4578
    @rimantasri4578 4 ปีที่แล้ว

    10:57 Click login, nothing happens - beautiful xd.

  • @saliadel5238
    @saliadel5238 4 ปีที่แล้ว +1

    I love you bucky more than my girlfriend❤ although I don't have one😭

  • @dfmrrd
    @dfmrrd 9 ปีที่แล้ว +1

    can you go In depth in a language
    But you vids are cool

  • @DoubleDbababoi
    @DoubleDbababoi ปีที่แล้ว

    I still dont understand the logic of using Gridpane.setConstrains() and not grid.setConstrains()

  • @Redmile2006
    @Redmile2006 5 ปีที่แล้ว +2

    Just change:
    TextField passInput = new TextField();
    to:
    PasswordField passInput = new PasswordField();
    for the password to be hidden with ********. And obviously, at the beginning of the file
    import javafx.scene.control.PasswordField;

  • @pavlensk1
    @pavlensk1 6 ปีที่แล้ว

    *grid pain*

  • @leat6093
    @leat6093 3 ปีที่แล้ว

    ngu
    ngu
    ngu
    ngu
    ngu
    ngu
    ngu
    ngu
    non
    non
    non
    non
    non