JavaFX scenes + drawing stuff 🌄

Поділитися
Вставка
  • Опубліковано 21 сер 2024
  • Javafx scenes tutorial example explained
    #JavaFX #scene #scenes
    package application;
    import javafx.application.Application;
    import javafx.stage.Stage;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Circle;
    import javafx.scene.shape.Line;
    import javafx.scene.shape.Polygon;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.text.Font;
    import javafx.scene.text.Text;
    public class Main extends Application {
    public static void main(String[] args) {
    launch(args);
    }
    @Override
    public void start(Stage primaryStage) throws Exception {
    Group root = new Group();
    Scene scene = new Scene(root,600,600,Color.LIGHTSKYBLUE);
    Stage stage = new Stage();
    Text text = new Text();
    text.setText("WHOOOOOA!!");
    text.setX(50);
    text.setY(50);
    text.setFont(Font.font("Verdana",50));
    text.setFill(Color.LIMEGREEN);
    Line line = new Line();
    line.setStartX(200);
    line.setStartY(200);
    line.setEndX(500);
    line.setEndY(200);
    line.setStrokeWidth(5);
    line.setStroke(Color.RED);
    line.setOpacity(0.5);
    line.setRotate(45);
    Rectangle rectangle = new Rectangle();
    rectangle.setX(100);
    rectangle.setY(100);
    rectangle.setWidth(100);
    rectangle.setHeight(100);
    rectangle.setFill(Color.BLUE);
    rectangle.setStrokeWidth(5);
    rectangle.setStroke(Color.BLACK);
    Polygon triangle = new Polygon();
    triangle.getPoints().setAll(
    200.0,200.0,
    300.0,300.0,
    200.0,300.0
    );
    triangle.setFill(Color.YELLOW);
    Circle circle = new Circle();
    circle.setCenterX(350);
    circle.setCenterY(350);
    circle.setRadius(50);
    circle.setFill(Color.ORANGE);
    Image image = new Image("pizza.png");
    ImageView imageView = new ImageView(image);
    imageView.setX(400);
    imageView.setY(400);
    root.getChildren().add(text);
    root.getChildren().add(line);
    root.getChildren().add(rectangle);
    root.getChildren().add(triangle);
    root.getChildren().add(circle);
    root.getChildren().add(imageView);
    stage.setScene(scene);
    stage.show();
    }
    }
    ------------------------------
    Up In My Jam (All Of A Sudden) by - Kubbi / kubbi
    Creative Commons - Attribution-ShareAlike 3.0 Unported- CC BY-SA 3.0
    Free Download / Stream: bit.ly/2JnDfCE
    Music promoted by Audio Library • Up In My Jam (All Of A...
    ------------------------------

КОМЕНТАРІ • 84

  • @BroCodez
    @BroCodez  3 роки тому +16

    package application;

    import javafx.application.Application;
    import javafx.stage.Stage;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Circle;
    import javafx.scene.shape.Line;
    import javafx.scene.shape.Polygon;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.text.Font;
    import javafx.scene.text.Text;
    public class Main extends Application {

    public static void main(String[] args) {
    launch(args);
    }
    @Override
    public void start(Stage primaryStage) throws Exception {

    Group root = new Group();
    Scene scene = new Scene(root,600,600,Color.LIGHTSKYBLUE);
    Stage stage = new Stage();

    Text text = new Text();
    text.setText("WHOOOOOA!!");
    text.setX(50);
    text.setY(50);
    text.setFont(Font.font("Verdana",50));
    text.setFill(Color.LIMEGREEN);

    Line line = new Line();
    line.setStartX(200);
    line.setStartY(200);
    line.setEndX(500);
    line.setEndY(200);
    line.setStrokeWidth(5);
    line.setStroke(Color.RED);
    line.setOpacity(0.5);
    line.setRotate(45);

    Rectangle rectangle = new Rectangle();
    rectangle.setX(100);
    rectangle.setY(100);
    rectangle.setWidth(100);
    rectangle.setHeight(100);
    rectangle.setFill(Color.BLUE);
    rectangle.setStrokeWidth(5);
    rectangle.setStroke(Color.BLACK);

    Polygon triangle = new Polygon();
    triangle.getPoints().setAll(
    200.0,200.0,
    300.0,300.0,
    200.0,300.0
    );
    triangle.setFill(Color.YELLOW);

    Circle circle = new Circle();
    circle.setCenterX(350);
    circle.setCenterY(350);
    circle.setRadius(50);
    circle.setFill(Color.ORANGE);

    Image image = new Image("pizza.png");
    ImageView imageView = new ImageView(image);
    imageView.setX(400);
    imageView.setY(400);

    root.getChildren().add(text);
    root.getChildren().add(line);
    root.getChildren().add(rectangle);
    root.getChildren().add(triangle);
    root.getChildren().add(circle);
    root.getChildren().add(imageView);
    stage.setScene(scene);
    stage.show();
    }
    }

    • @quantum7693
      @quantum7693 3 роки тому

      I loved the video
      Can you make a video about making a game using javaFX

  • @elypix2720
    @elypix2720 3 роки тому +11

    Your channel is underrated. I've never seen better coding tutorials than yours! PLEASE KEEP GOING!!

    • @xplane7879
      @xplane7879 3 роки тому

      True... i also just found him today. This channel is not only informative but also chill cool... bro...

  • @milo-ur8zp
    @milo-ur8zp 3 роки тому +2

    bro code please never stop uploading these videos, you are a huge help for me in my journey into coding java spigot plugins and saved my butt more than one time, thanks! :D

  • @hemantmishra3727
    @hemantmishra3727 3 роки тому +3

    Thank you so much for all the wonderful videos..

  • @remylebeau9344
    @remylebeau9344 2 місяці тому

    Very awesome stuff!

  • @Randomz0101
    @Randomz0101 3 роки тому +12

    bro you're such a legend. The way you teach us java is never boring and always exciting. You are better than my teacher. I have learned so much from you. I just wanna thank you for all your hardwork. Please never ever stop teaching us java. And I hope someday I could meet you or even repay you from all of the free java vids tutorial ive watch your channel. Anyways bro I also hope you're doing well and always keep being awesome. Then Finally the day will come when we finally defeat the youtube algorithm hahahah
    edit: A quick question bro. Are you planning on teaching java programming for embedded systems? cause I would really love to learn from you

  • @gameGXT
    @gameGXT 2 роки тому

    Super video

  • @percivalgebashe4376
    @percivalgebashe4376 Рік тому

    Nice

  • @sciencejournal8831
    @sciencejournal8831 3 роки тому +1

    I like your channel and I know that It will grow into bigger channel ❤️

  • @jordanlittle8774
    @jordanlittle8774 Рік тому +1

    just you explaining it how you did helped me a bunch

  • @salahSaad-ld8id
    @salahSaad-ld8id 5 місяців тому

    Thanks for this awesome video and other videos in whole list

  • @gameGXT
    @gameGXT 2 роки тому

    super vidéo

  • @tomaszkarolak6179
    @tomaszkarolak6179 3 роки тому +1

    Thumb up, great work! ... as always 😉

  • @catharperfect7036
    @catharperfect7036 4 місяці тому

    Sick program broski

  • @rashakh5059
    @rashakh5059 2 роки тому

    👍🏻😊😊

  • @kienduongngo7549
    @kienduongngo7549 3 роки тому +1

    Great!! I hope you make more videos

  • @SikandarMukhtar
    @SikandarMukhtar Рік тому

    gg

  • @stywenoider7436
    @stywenoider7436 3 роки тому

    amazing chanel

  • @ashkanshakiba9579
    @ashkanshakiba9579 3 роки тому

    Useful 👌👍

  • @Fawrfuwa
    @Fawrfuwa 2 роки тому +1

    50 mins in college class = I don't get any sh!t, 15 mins watching this = I can get my assignment done. You are a God

  • @rapbimsfrienda22
    @rapbimsfrienda22 2 роки тому

    Great explanation 🎉

  • @funcoding1797
    @funcoding1797 3 роки тому

    great

  • @Avel_runner
    @Avel_runner Рік тому

    Excellent info!

  • @anandomia3161
    @anandomia3161 3 роки тому

    awesome

  • @Welcome_to_real_life_
    @Welcome_to_real_life_ Рік тому

    Really good stuff!!

  • @HeavyMetals1969
    @HeavyMetals1969 3 роки тому +2

    This is one tutorial that ranks above most. It is the setup, and the method here that works. Bro Code is solid, and is above the rest. Learn the ways of the code.

  • @once3428
    @once3428 3 роки тому

    "WHOOOOA!!,nice video

  • @omersond4891
    @omersond4891 3 роки тому

    i only learned swing on my oop course. nice to learn javaFX here. very nice video bro

  • @ZX10RArcher
    @ZX10RArcher 3 роки тому +1

    Great tutorial!

  • @bojanjanjic2899
    @bojanjanjic2899 11 місяців тому +1

    Interesting. Thank you!

  • @user-wn1db9fm4o
    @user-wn1db9fm4o 3 роки тому

    Nice video bro

  • @babushaikh6582
    @babushaikh6582 3 роки тому

    🔥🔥

  • @MonsieurCake
    @MonsieurCake 5 місяців тому

    love u bro, thanks for vid

  • @Amangupta-rh7cy
    @Amangupta-rh7cy 3 роки тому

    Thanks for making this video

  • @mehrsadehnavi9387
    @mehrsadehnavi9387 3 роки тому +1

    That was great!
    Thanks !!

  • @wolanus
    @wolanus 3 роки тому

    Great video!

  • @braydenmchan
    @braydenmchan Рік тому

    I love your idea of a sandwich but I've always thought of it as a pizza. The stage is the dough, the scene is the tomato sauce, and the scene graph would be the toppings. Great video though!

  • @dmitryabramov1483
    @dmitryabramov1483 3 роки тому

    Это божественно!

  • @kbkarol2212
    @kbkarol2212 3 роки тому

    thanks you bro please make more of these

  • @user-lc6it9ju5s
    @user-lc6it9ju5s 8 місяців тому

    Thanks for that!

  • @larrysmusics531
    @larrysmusics531 3 роки тому +2

    Please make tutorial on jdbc jsp servlet

  • @safayedbinislam315
    @safayedbinislam315 2 роки тому

    love you man

  • @jayesh1891
    @jayesh1891 2 роки тому

    This is better and more fun than University

  • @bitcoin1532
    @bitcoin1532 3 роки тому

    you are a blessing

  • @MrMaterialsman1
    @MrMaterialsman1 Рік тому

    thanks 👏

  • @xxxxx3221
    @xxxxx3221 2 роки тому

    Thanks a lot!

  • @hasibullahazimi6524
    @hasibullahazimi6524 3 роки тому

    Hi dear bro please make more videos of javafx.

  • @aldolunabueno2634
    @aldolunabueno2634 3 місяці тому

    Adding an image was a little bit different that what I thought. I didn't expect that extra step of ImageView.

  • @SargeanTravis
    @SargeanTravis Рік тому

    Great series so far! It's bit outdated (tho that also might be me using IntelliJ Ultimate. Other than the fact that project creation works differently (and more fluently) the tutorials hold up well!

    • @keldur16
      @keldur16 8 місяців тому

      Same. I’m watching today and I use IntelliJ ultimate. The process to get JavaFX started up is a bit different and it’s hard to find current videos that teach it well

  • @arthurus77
    @arthurus77 3 роки тому

    wow thank's so much man

  • @zucokanarinac9133
    @zucokanarinac9133 2 роки тому

    ily

  • @bendustin7609
    @bendustin7609 Рік тому

    Thanks!

  • @GamingWithMalte
    @GamingWithMalte 3 роки тому

    early :)

  • @ehsanmna8966
    @ehsanmna8966 2 роки тому

    Javafx+ series pls

  • @satestactmathtutor6570
    @satestactmathtutor6570 Рік тому

    thank u broo

  • @livghit
    @livghit 3 роки тому

    thank you man

  • @flyd3146
    @flyd3146 3 роки тому

    your videos are super useful! could you maybe cover some OpenGL?

  • @oswallt06
    @oswallt06 11 місяців тому

    Pizza!

  • @ctluwua7695
    @ctluwua7695 3 роки тому +1

    Pizza

  • @malekmousa1038
    @malekmousa1038 3 роки тому

    Can you make a video about Java streams? Please

  • @mehmetkeskin8118
    @mehmetkeskin8118 Рік тому

    Thank you. we need to create 3d canvas. is it also pssible?

  • @solarbear9741
    @solarbear9741 2 роки тому

    he told me to comment, so i did

  • @oguzhantopaloglu9442
    @oguzhantopaloglu9442 3 роки тому

    text.setText("WHOOOOA"); ✔

  • @jerrykankelborg9943
    @jerrykankelborg9943 3 роки тому

    can you go over how to resize a rectangle in javafx ?

    • @HeavyMetals1969
      @HeavyMetals1969 3 роки тому

      Change the values of the start coordinates (x ,y), and the end coordinates (x ,y) 1,1 to 10,10...it makes a square. 1,1 to 10,20 makes an actual rectangle.

  • @kailan06
    @kailan06 10 місяців тому

    What happened to Bro hes been missing? Where are you Bro?

  • @soda_lime7095
    @soda_lime7095 3 роки тому

    Can we not get a video series on java networking

  • @noah77
    @noah77 3 роки тому +1

    heyyy bro! I wanted you to make a tutorial in which there is a simple dimple square, nothing special in a new window and there's an enemy. We can move the player using W A S D and I want the enemy to follow me.
    Long story short - a red square (enemy) which follows you ( you are a blue Square which is a player)

  • @stephensteve2079
    @stephensteve2079 Рік тому

    Can we print these shapes in the graphics context by calling those objects? But not using these fillRect(), fillPolygon(), etc. in a graphics context?

  • @Angie5264
    @Angie5264 3 роки тому

    hey bro, nice video. but can you please make a video about JavaFX where you explain each methods thoroughly?

  • @diptoacharjee7538
    @diptoacharjee7538 Рік тому

    I wonder! When there was no *you. How ppl used to learn.
    *(UA-cam and you.)

  • @Saudkhan40
    @Saudkhan40 3 місяці тому

    Can someone please tell me, my triangle isnt showing on scene, i write same code😢

  • @williammuller3819
    @williammuller3819 Рік тому

    BROOOOOo help meeeeee! I want to do a transparent colors for a flag in a post card we have to do for school please help me I can't find it I am very new in programming please hit me up!!!!

  • @cookiearu
    @cookiearu 3 роки тому

    THANKS A LOOOT. I WAS PREPARING FOR ENDTERM AND I COULDNT DRAW TRIANGLE. IF IT WASNT FOR YOU :D

  • @-omarabusnineh5174
    @-omarabusnineh5174 2 роки тому

    I have a problem when uploading the image to the code, knowing that I have placed it inside the program file

    • @benjaminlgur
      @benjaminlgur 2 роки тому

      I had this too fixed it by doing Image image = new Image(new File("src/icon.png").toURI().toString());

    • @kingjulie8995
      @kingjulie8995 27 днів тому

      @@benjaminlgur Thank you very much i had the same Problem and with that is works .i dont know what i would have done without your kommend

  • @alperkandemir119
    @alperkandemir119 2 роки тому +1

    Why do we need to create an object named Group of type root at the beginning of the code?

    • @Robbi9over
      @Robbi9over 2 роки тому +1

      The name of the object is root and the type is Group. This group is basically just a container for the drawings.

  • @agny369
    @agny369 3 роки тому

    hey man Ive got this assignment where we need to make a circle with 3 nodes that form an internal triangle in the circle. Anyway I can pick your brain for a few questions ?

  • @maxjustmax521
    @maxjustmax521 2 роки тому

    Hey Legend bro
    my IntelliSense in Eclipse is acting funny, it shows some option and never shows many others, especially when I use Swing or Java FX, any advice for fix