Java radio buttons 🔘

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

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

  • @julianep3shen
    @julianep3shen 4 ปีที่แล้ว +17

    Bro, I've been going through your Java GUI series. Your explanations are easy to understand and I appreciate the creative tips. It's just enough to launch your imagination in implementation rather than resulting in dated looking GUIs. Thank you

  • @Buebito-con-Bigote
    @Buebito-con-Bigote หลายเดือนก่อน

    i was stuck in a problem 1 hour and a half in a single line of code and within 5 minutes you solved it, thanks man

  • @aquate9637
    @aquate9637 4 ปีที่แล้ว +12

    Thanks bro! I feel these videos are the type where they get recommend to everyone in like 10 years from now.

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

    It's nice to have such an amazing people that share their knowledge. Thanks a lot!

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

    This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro

  • @rickr.a2806
    @rickr.a2806 4 ปีที่แล้ว +5

    You're a savior man. Never stop making videos

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

      thank you for watching Rick! I don't plan on stopping 👍

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

    its just funny how I haven't had hiccups since I started this series, almost 8 hours in

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

    OMG, I am so grateful I found your channel! Thank you!

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

    So far, this course is amazing

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

    good job, Bro! it's really simple to understand your tutorials.

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

    I was sitting here hopeless thinking I’m failing my exam today this man just saved me and my cousin

  • @BroCodez
    @BroCodez  4 ปีที่แล้ว +15

    // ***********************************************************************
    public class Main{
    public static void main(String[] args) {

    // JRadioButton = One or more buttons in a grouping in which only 1 may be selected per group

    new MyFrame();
    }
    }
    // ***********************************************************************
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MyFrame extends JFrame implements ActionListener{
    JRadioButton pizzaButton;
    JRadioButton hamburgerButton;
    JRadioButton hotdogButton;
    //ImageIcon pizzaIcon;
    //ImageIcon hamburgerIcon;
    //ImageIcon hotdogIcon;

    MyFrame(){
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setLayout(new FlowLayout());

    //pizzaIcon = new ImageIcon("pizza.png");
    //hamburgerIcon = new ImageIcon("hamburger.png");
    //hotdogIcon = new ImageIcon("hotdog.png");

    pizzaButton = new JRadioButton("pizza");
    hamburgerButton = new JRadioButton("hamburger");
    hotdogButton = new JRadioButton("hotdog");

    ButtonGroup group = new ButtonGroup();
    group.add(pizzaButton);
    group.add(hamburgerButton);
    group.add(hotdogButton);

    pizzaButton.addActionListener(this);
    hamburgerButton.addActionListener(this);
    hotdogButton.addActionListener(this);

    //pizzaButton.setIcon(pizzaIcon);
    //hamburgerButton.setIcon(hamburgerIcon);
    //hotdogButton.setIcon(hotdogIcon);

    this.add(pizzaButton);
    this.add(hamburgerButton);
    this.add(hotdogButton);
    this.pack();
    this.setVisible(true);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
    if(e.getSource()==pizzaButton) {
    System.out.println("You ordered pizza!");
    }
    else if(e.getSource()==hamburgerButton) {
    System.out.println("You ordered a hamburger!");
    }
    else if(e.getSource()==hotdogButton) {
    System.out.println("You ordered a hotdog!");
    }
    }
    }

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

    Nice video

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

    Thanks bro! this course is easy to learn.

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

    Okay! Cool, it helps me/ Thanks

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

    Bro I'm having a problem with icons.
    Can you please tell me from where do you download icon.
    My downloaded icon sizes are too large so they don't fit with my text

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

    What about resizing the radio buttons, I know you can resize the text with setfont but if you do so, the radio buttons would stay the same size originally

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

    Liked commemted subscribed

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

    Cool and clear Tutorial!

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

    very good video

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

    thanks bro. man this channel helps me so much

  • @kk-gs1dc
    @kk-gs1dc ปีที่แล้ว

    nice

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

    BRO, I add the images just as you did, I made them small enough (40x40) and they for some reason just don't show... this is driving me crazy!!

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

    Can I use all types of images in java like jpg, jpeg, png, etc?

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

      These 3 are supported ones, yeah (I think you already figured it out, so sorry for the late response).

  • @Faz.76
    @Faz.76 หลายเดือนก่อน

    thank you i have a midterm exam tomorrow 😭😭😭

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

    🔥🙌

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

    I have problem set RadioIcon. Would it be possible to share your image icon in here. So I can test if it's related to image size issue.

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

    you are a legend bro

  • @eugenezuev7349
    @eugenezuev7349 6 หลายเดือนก่อน

    Thanks, Bro

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

    Hi have one question suppose u have to enter some field after clicking radio btn exa:if u click female radio btn u enter name but now u change ur mind and select other btn now the value entered in the female btn i. e., name is not cleared which causes form to not submit so how to clear radio btn field values once u select other btn please please try to clear my question
    Hoping positive response🙂

  • @x_.rimina._.chan._x5244
    @x_.rimina._.chan._x5244 3 ปีที่แล้ว

    it wont work to me ; and how i wright the same code but all in the main !!
    i really hope u answer me soon bc i have an exem in that and i can't wright my project conversion programme

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

    im trynna wherein sum text just only gonna pop up in the console if you click the submit button(JButton) after you choose an item in a JRadioButton form. is it possible? i dont seem to know.

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

    another great vid

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

    thank you for the content

  • @Man-daragat
    @Man-daragat ปีที่แล้ว

    pls help my activity
    Using JFrame and 3 RadioButton.Create a java application that will allow user to draw and choose the color they want to use.
    😥

    • @Man-daragat
      @Man-daragat ปีที่แล้ว

      im first year student

  • @MrLoser-ks2xn
    @MrLoser-ks2xn 2 ปีที่แล้ว

    Thanks

  • @DistrectionUsonov
    @DistrectionUsonov 3 หลายเดือนก่อน

    How i can change gap between radio buttons, does somebody know?

  • @Famelton
    @Famelton 3 หลายเดือนก่อน

    Where do you get the images from?

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

    I am watching

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

    thanks bro

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

    i ordered them all

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

    thank you!

  • @x_.rimina._.chan._x5244
    @x_.rimina._.chan._x5244 3 ปีที่แล้ว

    it wont work to me
    and how i wright the same code but all in the main !!
    i really hope u answer me soon bc i have an exem in that and i can't wright my project conversion programme

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

      in the main function you cannot use "this" for the JFrame. You need to create a new JFrame ("JFrame myFrame"), ("myFrame=new JFrame"). Then instead of "this", you write "myFrame".

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

    Thank you bro

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

    Bro how to indent the button?

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

    Oh my god “bro code” I get it

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

    can i get a source code ?

  • @winterSweet-k4m
    @winterSweet-k4m 4 ปีที่แล้ว +1

    1.9K ...🐌 2K

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

    youtube algorithm comment

  • @MariaGonzalez-c2l
    @MariaGonzalez-c2l ปีที่แล้ว

    Hi ;(} parent ; don't laugh at me:(). I c u ll why the hate child where I am you were, where you are I will be. (Hint) we all bleed red. Do not let knowledge consume u pray for crk

  • @dhanushetty2908
    @dhanushetty2908 หลายเดือนก่อน

    Hey just a request i think it would be helpful if u create a project with included All these gui elements plzzzzzzzzzzzz @BroCodez

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

    Practicing...
    public class Main{
    public static void main(String[] args){
    new MyFrame();
    }
    }
    **********************************
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MyFrame extends JFrame implements ActionListener
    {
    JRadioButton funkButton;
    JRadioButton soulButton;
    JRadioButton reggaeButton;
    ImageIcon funkIcon;
    ImageIcon soulIcon;
    ImageIcon reggaeIcon;
    MyFrame ()
    {
    this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    this.setLayout (new FlowLayout ());
    funkIcon = new ImageIcon("funk.png");
    soulIcon = new ImageIcon("soul.png");
    reggaeIcon = new ImageIcon("reggae.png");
    funkButton = new JRadioButton("funk");
    soulButton = new JRadioButton("soul");
    reggaeButton = new JRadioButton("reggae");
    ButtonGroup group = new ButtonGroup();
    group.add(funkButton);
    group.add(soulButton);
    group.add(reggaeButton);
    funkButton.addActionListener(this);
    soulButton.addActionListener(this);
    reggaeButton.addActionListener(this);
    funkButton.setIcon(funkIcon);
    soulButton.setIcon(soulIcon);
    reggaeButton.setIcon(reggaeIcon);
    this.add(funkButton);
    this.add(soulButton);
    this.add(reggaeButton);
    this.pack ();
    this.setVisible (true);
    }
    @Override
    public void actionPerformed (ActionEvent e){
    if(e.getSource()==funkButton){
    System.out.println("Play me some funk music.");
    }
    else if(e.getSource()==soulButton){
    System.out.println("Play me some soul music.");
    }
    else if (e.getSource()==reggaeButton){
    System.out.println("Play me some reggae music.");
    }
    }
    }

  • @antoinealam6531
    @antoinealam6531 2 หลายเดือนก่อน