JavaFX ImageView 🖼️

Поделиться
HTML-код
  • Опубликовано: 28 июн 2024
  • JavaFX ImageView node tutorial example explained
    #JavaFX #ImageView #node
    // ******************* Controller.java *******************
    package application;
    import javafx.fxml.FXML;
    import javafx.scene.control.Button;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    public class Controller {
    //ImageView is a Node used for painting images loaded with Images
    // Image = picture
    // ImageView = picture frame
    @FXML
    ImageView myImageView;
    Button myButton;
    Image myImage = new Image(getClass().getResourceAsStream("shrek2.jpg"));
    public void displayImage() {
    myImageView.setImage(myImage);
    }
    }
    // ********************************************************
    Bro Code merch store 👟 :
    ===========================================================
    teespring.com/stores/bro-code-5
    ===========================================================
  • НаукаНаука

Комментарии • 52

  • @BroCodez
    @BroCodez  3 года назад +12

    // ******************** Controller.java ********************
    package application;
    import javafx.fxml.FXML;
    import javafx.scene.control.Button;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    public class Controller {
    //ImageView is a Node used for painting images loaded with Images
    // Image = picture
    // ImageView = picture frame

    @FXML

    ImageView myImageView;
    Button myButton;

    Image myImage = new Image(getClass().getResourceAsStream("shrek2.jpg"));

    public void displayImage() {
    myImageView.setImage(myImage);
    }
    }
    // ********************************************************

    • @sofbreez6987
      @sofbreez6987 2 года назад +1

      What about main class, what we gonna type there 🤔

    • @andreacb5062
      @andreacb5062 2 года назад

      @@sofbreez6987 do you have it?

    • @MO-R-70-23
      @MO-R-70-23 9 месяцев назад

      ​@@sofbreez6987The usual

  • @bigmarshmellow2502
    @bigmarshmellow2502 Год назад +9

    this applies to all of ur JavaFX videos but you've singlehandedly saved my CS project. your videos have given me a proper understanding of most fundamental JavaFX concepts and take me through using its features in a way that's slow enough for me to understand but fast enough to not bore me to death like other tutorials.
    you're one of the best in the game, keep it up

  • @jegor06
    @jegor06 3 года назад +10

    Bro.. Praying for the RUclips algorithm

  • @softwaretanq5889
    @softwaretanq5889 2 года назад +1

    You make Java so fun to learn ! Keep up the gr8 work!

  • @Patty13558
    @Patty13558 3 года назад +3

    Great video thanks bro

  • @aether7159
    @aether7159 2 года назад +2

    I have to use JavaFX for my assignments this week and I'm glad I found your videos! Shrek is very inspirational, good choice! 😎

    • @ChopperCheeks
      @ChopperCheeks 8 месяцев назад +1

      yep... doin it right now 2 days before its due

  • @vtome4165
    @vtome4165 3 года назад

    Great videos, perfect tempo for me, upload more of this, please, :)

  • @filipraso135
    @filipraso135 3 года назад +2

    You are the best man....

  • @halcyon-s
    @halcyon-s Год назад +3

    if u have a problems with mouse entered, change the event from action to mouse, like this:
    "public void displayAvatar(MouseEvent)", but its important to use for button action event

  • @younesssgh8586
    @younesssgh8586 3 года назад

    thanks Broo i learnt a lot from your tutos

  • @inkkouttritue6142
    @inkkouttritue6142 11 месяцев назад

    you literally saved my life bro

  • @susianasunjaya1886
    @susianasunjaya1886 2 года назад

    Thankyou so much bro, i owe you :'D

  • @ihorvolkov5600
    @ihorvolkov5600 2 года назад

    I like it!

  • @Remolhunter97
    @Remolhunter97 3 года назад

    Love your content !

  • @splintergaming822
    @splintergaming822 3 года назад

    Hey Bro xD i really like your content and your way of explaining things Keep up !!
    And please do a Javascript Course I'm really needing that thnx..

  • @vasilizaitsev7246
    @vasilizaitsev7246 3 года назад

    Great job bro.

  • @alexanderzharkov6953
    @alexanderzharkov6953 2 года назад

    Bro, you are awesome!!!!!!!!!

  • @ctluwua7695
    @ctluwua7695 3 года назад

    NICE IMAGES

  • @aleprominecraft25
    @aleprominecraft25 Год назад

    Bruh you´ve save my whole Data Structure curse haha

  • @john9497
    @john9497 3 года назад +1

    nice 👍

  • @andrewkerr7697
    @andrewkerr7697 Год назад

    Dude you are the man

  • @glorysonhorace3265
    @glorysonhorace3265 2 года назад

    Nice content broh

  • @abeer5252
    @abeer5252 2 года назад

    Thanks!

  • @vedantdeshmukh1549
    @vedantdeshmukh1549 3 года назад

    Bro post more stuff
    I am addicted to your channel

  • @csbmstyles4431
    @csbmstyles4431 2 года назад

    Nice

  • @xXEkoLogikoXx
    @xXEkoLogikoXx 2 года назад

    Thx bro

  • @halcyon-s
    @halcyon-s Год назад

    thanks!!!

  • @MarianoGrande1
    @MarianoGrande1 3 года назад

    Shrek is love, Shrek is life.

  • @chocodonuts3644
    @chocodonuts3644 7 месяцев назад

    please make more javafx videos

  • @serdaryildiz1992
    @serdaryildiz1992 3 года назад +1

    bro can you make a video about spring freamwork?

  • @junaidjaved7478
    @junaidjaved7478 7 месяцев назад

  • @alexandru-vladpal522
    @alexandru-vladpal522 3 года назад +1

    😁😁😁😁😁😁😁😁😁😁

  • @eriktim82
    @eriktim82 2 года назад

    Was watching your video a I noticed you never showed your main class. Do you mind posting?

  • @ivancaccia9023
    @ivancaccia9023 2 года назад

    Hi bro, What If I want to Show/Hide the picture using the button? How can I do that?

  • @alyssacowen5564
    @alyssacowen5564 8 месяцев назад

    How can I make it so a user can upload a profile picture from their saved pictures in their files?

  • @chemso_1
    @chemso_1 2 месяца назад

    dabest

  • @userpiero5359
    @userpiero5359 3 года назад

    Guys is good using a gui designer or writing the code

  • @alanoliver1816
    @alanoliver1816 2 года назад

    Alright video overall, the only thing I did not like is that you did not show how to get scenebuilder downloaded and configuring the path. Other than that good video

  • @kingpin9999
    @kingpin9999 2 года назад

    I cracked myself at 00:02

  • @compteteach1369
    @compteteach1369 3 года назад

    you insisted on us for comment, i could not reject you

  • @khalilzouhir5862
    @khalilzouhir5862 Год назад

    it doesnt work for me gives me error i followed every step is it jst me guys ?

    • @remylebeau9344
      @remylebeau9344 18 дней назад

      I had the same issue and finally got it to work... The issue seems to be with the version of JavaFX and/or openJDK in the lesson vs. what I'm using and probably what you used. I'm using v22 for both but below are my notes including the last line which resolved it.
      // This is the lesson example but won't work. Some issue w/ the stream which results in null
      // Image myImage = new Image(getClass().getResourceAsStream("/images/image2.png"));
      // This version works but it's not JavaFX i.e. it's a work around to some stream issue.
      // Image myImage = new Image(String.valueOf(new File("/images/image2.png")));
      // OK This actually works! AS:LKDAS:DJKH!@#!@(&*#!@#
      Image myImage = new Image( getClass().getResource( "/images/image2.png").toExternalForm());

  • @so20l
    @so20l 2 года назад

    Great job bro.