The radio buttons don't really care what you wrote to the user. It only knows from you what to do if the user picks button 1, or 2, or 3, etc.
You should have an array (if you have many questions) to indicate which answer is correct for which question. Then program the messages accordingly.
/* Student Assignment Submission Form
I declare that the attached assignment is wholly my own work in accordance with Sheridan Academic Policy.
No part of this assignment has been copied manually or electronically from any other source (including web sites)
or distributed to other students.
My name is: Gaurav Sharma
public static void main(String args)
JOptionPane.showMessageDialog (null, "Are You Smarter Than a 5th Grader?"); // Creating a welcome Dialog Box.
userName =JOptionPane.showInputDialog (null, "Greetings User. " +"Enter your name:" );
//creating a frame
JFrame frame = new JFrame();
frame.setTitle ("Are you Smarter than a 5th Grader");
JLabel quest1 = new JLabel("Who co-stared with Leonardo Dicaprio in the movie Titanic?",SwingConstants.CENTER);
quest1.setPreferredSize(new Dimension(400, 20));
//creating a panel
JPanel panel = new JPanel();
//creating a RadioButton.
//radio buttons for first quest.
JRadioButton r1 = new JRadioButton("KateWinslett");
JRadioButton r2 = new JRadioButton("Tom Cruise");
JRadioButton r3 = new JRadioButton("Julia Roberts");
JRadioButton r4 = new JRadioButton("Osama Bin Laden");
r4.setText("Osama Bin Laden");
//creating a button group.
ButtonGroup group= new ButtonGroup();
//adding radiobutton to the panel.
//Display the window.
if (e.getSource()== "Kate Winslett")
JOptionPane.showMessageDialog (null, "Are You Smarter Than a 5th Grader?");
computer - this isnt really a school question but i have a question about the ...
Computer Language Java - What is the concept of multi-threading in java and how ...
computer science - Who invented Java?
Computer Science - Is anyone familiar with JAVA?
computer science - which job titles are consistent only with the java language?
computer - can u help me in making a "quiz" wid reference by using java.cn u hlp...
Computer Science - Could someone show me an example of a service class that ...
java programming - write a java program using arrays function for hotel bill ...
JAVA PROGRAMMING - "POWERS" Compute the power of a number given the base and ...
probability - out of 250 students interviewed at a community college, 90 were ...