Click here to Skip to main content
15,558,264 members
Home / Discussions / Java
   

Java

 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 8:39
MallardsReach24-Mar-20 8:39 
GeneralRe: User defined Method Pin
Richard MacCutchan24-Mar-20 8:44
mveRichard MacCutchan24-Mar-20 8:44 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 9:29
MallardsReach24-Mar-20 9:29 
GeneralRe: User defined Method Pin
Richard MacCutchan24-Mar-20 11:16
mveRichard MacCutchan24-Mar-20 11:16 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 23:17
MallardsReach24-Mar-20 23:17 
QuestionJTextArea Pin
MallardsReach23-Mar-20 1:48
MallardsReach23-Mar-20 1:48 
AnswerRe: JTextArea Pin
Richard MacCutchan23-Mar-20 1:54
mveRichard MacCutchan23-Mar-20 1:54 
QuestionCalling a Method at run time Pin
MallardsReach21-Mar-20 23:32
MallardsReach21-Mar-20 23: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:
Java
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
Java
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 MacCutchan22-Mar-20 0:29
mveRichard MacCutchan22-Mar-20 0:29 
GeneralRe: Calling a Method at run time Pin
MallardsReach22-Mar-20 1:38
MallardsReach22-Mar-20 1:38 
GeneralRe: Calling a Method at run time Pin
Richard MacCutchan22-Mar-20 1:48
mveRichard MacCutchan22-Mar-20 1:48 
GeneralRe: Calling a Method at run time Pin
MallardsReach22-Mar-20 2:08
MallardsReach22-Mar-20 2:08 
GeneralRe: Calling a Method at run time Pin
Richard MacCutchan22-Mar-20 5:08
mveRichard MacCutchan22-Mar-20 5:08 
GeneralRe: Calling a Method at run time Pin
MallardsReach22-Mar-20 7:00
MallardsReach22-Mar-20 7:00 
QuestionMouse Dragged Event Pin
MallardsReach18-Mar-20 12:15
MallardsReach18-Mar-20 12:15 
AnswerRe: Mouse Dragged Event Pin
Richard MacCutchan18-Mar-20 22:47
mveRichard MacCutchan18-Mar-20 22:47 
GeneralRe: Mouse Dragged Event Pin
MallardsReach18-Mar-20 23:07
MallardsReach18-Mar-20 23:07 
GeneralRe: Mouse Dragged Event Pin
Richard MacCutchan19-Mar-20 1:01
mveRichard MacCutchan19-Mar-20 1:01 
GeneralRe: Mouse Dragged Event Pin
Richard MacCutchan19-Mar-20 1:06
mveRichard MacCutchan19-Mar-20 1:06 
GeneralRe: Mouse Dragged Event Pin
MallardsReach19-Mar-20 1:32
MallardsReach19-Mar-20 1:32 
QuestionBest Practice? Pin
MallardsReach15-Mar-20 10:41
MallardsReach15-Mar-20 10:41 
AnswerRe: Best Practice? Pin
Eddy Vluggen15-Mar-20 14:31
professionalEddy Vluggen15-Mar-20 14:31 
GeneralRe: Best Practice? Pin
MallardsReach15-Mar-20 22:34
MallardsReach15-Mar-20 22:34 
QuestionNetbeans Pin
MallardsReach15-Mar-20 1:13
MallardsReach15-Mar-20 1:13 
AnswerRe: Netbeans Pin
Peter_in_278015-Mar-20 1:24
professionalPeter_in_278015-Mar-20 1:24 

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.