Click here to Skip to main content
14,974,155 members
Home / Discussions / Java
   

Java

 
GeneralRe: cannot resolve Pin
Richard MacCutchan30-Mar-20 22:52
mveRichard MacCutchan30-Mar-20 22:52 
GeneralRe: cannot resolve Pin
MallardsReach30-Mar-20 23:22
MemberMallardsReach30-Mar-20 23:22 
QuestionRadio Button Selected Pin
MallardsReach25-Mar-20 9:50
MemberMallardsReach25-Mar-20 9:50 
QuestionRe: Radio Button Selected Pin
ZurdoDev25-Mar-20 10:10
professionalZurdoDev25-Mar-20 10:10 
AnswerRe: Radio Button Selected Pin
MallardsReach25-Mar-20 10:33
MemberMallardsReach25-Mar-20 10:33 
QuestionRe: Radio Button Selected Pin
ZurdoDev25-Mar-20 10:39
professionalZurdoDev25-Mar-20 10:39 
AnswerRe: Radio Button Selected Pin
MallardsReach25-Mar-20 11:11
MemberMallardsReach25-Mar-20 11:11 
QuestionRe: Radio Button Selected Pin
ZurdoDev25-Mar-20 12:19
professionalZurdoDev25-Mar-20 12:19 
AnswerRe: Radio Button Selected Pin
Richard MacCutchan26-Mar-20 0:16
mveRichard MacCutchan26-Mar-20 0:16 
GeneralRe: Radio Button Selected Pin
MallardsReach26-Mar-20 0:28
MemberMallardsReach26-Mar-20 0:28 
GeneralRe: Radio Button Selected Pin
Richard MacCutchan26-Mar-20 0:36
mveRichard MacCutchan26-Mar-20 0:36 
GeneralRe: Radio Button Selected Pin
MallardsReach26-Mar-20 2:55
MemberMallardsReach26-Mar-20 2:55 
GeneralRe: Radio Button Selected Pin
MallardsReach26-Mar-20 4:15
MemberMallardsReach26-Mar-20 4:15 
GeneralMessage Closed Pin
12-Apr-20 18:39
MemberBrenda Jasprizza12-Apr-20 18:39 
QuestionUser defined Method Pin
MallardsReach24-Mar-20 2:56
MemberMallardsReach24-Mar-20 2:56 
AnswerRe: User defined Method Pin
Richard MacCutchan24-Mar-20 4:18
mveRichard MacCutchan24-Mar-20 4:18 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 7:39
MemberMallardsReach24-Mar-20 7:39 
GeneralRe: User defined Method Pin
Richard MacCutchan24-Mar-20 7:44
mveRichard MacCutchan24-Mar-20 7:44 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 8:29
MemberMallardsReach24-Mar-20 8:29 
GeneralRe: User defined Method Pin
Richard MacCutchan24-Mar-20 10:16
mveRichard MacCutchan24-Mar-20 10:16 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 22:17
MemberMallardsReach24-Mar-20 22:17 
QuestionJTextArea Pin
MallardsReach23-Mar-20 0:48
MemberMallardsReach23-Mar-20 0:48 
AnswerRe: JTextArea Pin
Richard MacCutchan23-Mar-20 0:54
mveRichard MacCutchan23-Mar-20 0:54 
QuestionCalling a Method at run time Pin
MallardsReach21-Mar-20 22:32
MemberMallardsReach21-Mar-20 22:32 
I am using an example code that I found line JavaPoint which works and does what I would want it to do, so I thought I would use it in my Netbeans project.
It took a while to figure out what did what as there were no comments and obscure naming eg buttons name is 1.
I now have it working and have renamed things there is one problem I can't figure and it's a call to a method called set()
The program starts with a question and 4 possible radiobutton answers you select an answer then click button next which shows question 2.
For some reason It doesn't show question 1 when the form first loads. Tried various things but none worked for me.
The Next Button Code:
private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {
    if(check()) // Check answer
        count=count+1;
    current++;
        set();  //Next question
if(current==9)
{
     JOptionPane.showMessageDialog(this,"Correct Answers = "+count);
     btnNext.setEnabled(false);
        //b2.setText("Result");
}
}

First section of the set() Method code
void set()
	{
		rbSetQuestion.setSelected(true);
		if(current==0)
		{
			lblQuestions.setText("Question1: Which one among these is not a datatype");
			rbChoice_1.setText("int");rbChoice_2.setText("Float");rbChoice_3.setText("boolean");rbChoice_4.setText("char");	
		}
		if(current==1)
		{
			lblQuestions.setText("Question2: Which class is available to all the class automatically");
			rbChoice_1.setText("Swing");rbChoice_2.setText("Applet");rbChoice_3.setText("Object");rbChoice_4.setText("ActionEvent");
		}

AnswerRe: Calling a Method at run time Pin
Richard MacCutchan21-Mar-20 23:29
mveRichard MacCutchan21-Mar-20 23:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.