Click here to Skip to main content
14,297,905 members
   

Java

 
Questiong.drawString is not printing the correct value in Jpanel. Pin
chandra12212-Apr-19 5:01
memberchandra12212-Apr-19 5:01 
<pre>g.drawString is not printing the correct value in Jpanel.
The program is few thousand lines long. So I am posting a snippet where the error occurs

String tmpStg=new String(Integer.toString(val3));
System.out.format("%d %d %s %s\n",indexOfBlock,indexOfBlock1,String.valueOf(indexOfBlock1),tmpStg);
g.drawString(String.valueOf(indexOfBlock1),thsXPosWithBorder+10,thsYPosWithBorder);
System.out.format("%d %d %d\n",indexOfBlock,indexOfBlock1,val3);

Output of this section of the code is
0 8 8 8
0 8 8
While the values in print statement are correct. The value printed on the jpanel using g.drawString
is not correct. The g.drawString method prints 0 in the graphics panel instead of 8. The value in indexOfBlock1
is 8 and value in indexOfBlock is 0. Value in val3 is also same as value in indexOfBlock1. But if
I print it through g.drawString then it shows value as 0.</pre>
QuestionRe: g.drawString is not printing the correct value in Jpanel. Pin
Richard MacCutchan12-Apr-19 6:19
protectorRichard MacCutchan12-Apr-19 6:19 
AnswerRe: g.drawString is not printing the correct value in Jpanel. Pin
chandra12212-Apr-19 18:58
memberchandra12212-Apr-19 18:58 
GeneralRe: g.drawString is not printing the correct value in Jpanel. Pin
Richard MacCutchan12-Apr-19 20:51
protectorRichard MacCutchan12-Apr-19 20:51 
GeneralRe: g.drawString is not printing the correct value in Jpanel. Pin
chandra12212-Apr-19 22:57
memberchandra12212-Apr-19 22:57 
GeneralRe: g.drawString is not printing the correct value in Jpanel. Pin
Richard MacCutchan12-Apr-19 23:23
protectorRichard MacCutchan12-Apr-19 23:23 
QuestionPreview implementing 10 cross validation Pin
Member 142144734-Apr-19 22:41
memberMember 142144734-Apr-19 22:41 
AnswerMessage Closed Pin
8-Apr-19 18:52
memberdurga65178-Apr-19 18:52 
QuestionGlobal variables are not supported in C# Pin
Brian_TheLion27-Mar-19 21:04
memberBrian_TheLion27-Mar-19 21:04 
AnswerRe: Global variables are not supported in C# Pin
Richard MacCutchan27-Mar-19 22:26
protectorRichard MacCutchan27-Mar-19 22:26 
GeneralRe: Global variables are not supported in C# Pin
Brian_TheLion27-Mar-19 23:40
memberBrian_TheLion27-Mar-19 23:40 
GeneralRe: Global variables are not supported in C# Pin
Richard MacCutchan27-Mar-19 23:45
protectorRichard MacCutchan27-Mar-19 23:45 
GeneralRe: Global variables are not supported in C# Pin
Brian_TheLion27-Mar-19 23:58
memberBrian_TheLion27-Mar-19 23:58 
GeneralRe: Global variables are not supported in C# Pin
Richard MacCutchan28-Mar-19 0:03
protectorRichard MacCutchan28-Mar-19 0:03 
GeneralRe: Global variables are not supported in C# Pin
Brian_TheLion28-Mar-19 0:13
memberBrian_TheLion28-Mar-19 0:13 
GeneralRe: Global variables are not supported in C# Pin
Richard MacCutchan28-Mar-19 1:43
protectorRichard MacCutchan28-Mar-19 1:43 
GeneralRe: Global variables are not supported in C# Pin
Brian_TheLion28-Mar-19 2:02
memberBrian_TheLion28-Mar-19 2:02 
GeneralRe: Global variables are not supported in C# Pin
jschell13-Apr-19 6:42
memberjschell13-Apr-19 6:42 
GeneralRe: Global variables are not supported in C# Pin
Dr.Walt Fair, PE5-May-19 7:54
professionalDr.Walt Fair, PE5-May-19 7:54 
AnswerRe: Global variables are not supported in C# Pin
Maciej Los27-Mar-19 23:00
protectorMaciej Los27-Mar-19 23:00 
GeneralRe: Global variables are not supported in C# Pin
Brian_TheLion27-Mar-19 23:35
memberBrian_TheLion27-Mar-19 23:35 
AnswerRe: Global variables are not supported in C# Pin
Dr.Walt Fair, PE5-May-19 7:50
professionalDr.Walt Fair, PE5-May-19 7:50 
QuestionHome automation using iot Pin
Member 1417643119-Mar-19 1:49
memberMember 1417643119-Mar-19 1:49 
AnswerRe: Home automation using iot Pin
OriginalGriff19-Mar-19 1:51
protectorOriginalGriff19-Mar-19 1:51 
AnswerRe: Home automation using iot Pin
jschell23-Mar-19 5:48
memberjschell23-Mar-19 5:48 

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.