Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

error in formating text when using tabs  RSS feed

 
Chandhrasekar Saravanan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to display text from a file into an scrollpane.
i am modifying the text position such that it is aligned and
does not consume useful scrollpane space. but if i find something
like code experts, i should not change the text position and
i should display as it is in the file.
I am able to do so. but the problem i face is ,it works fine
whenever i use space bar. but if i use tabs, the white spaces are
not displayed. i dont think there is any bug in my code.

It is something like ubb code tag in our javaranch.

why is the tabs not working ?
an expert from my code
else if(fline.startsWith("<code>")){
Font f4 = new Font("Monospaced",Font.PLAIN,10);
g.setFont(f4);
g.setColor(Color.black);
int n3 = fline.indexOf('>');
fline = fline.substring(n3+1);
while(!(fline.endsWith("</code>"))){
x = fline.indexOf(0);
g.drawString(fline,x,y);
y = y +fm.getHeight();
fline = br.readLine();
}
int n4 = fline.indexOf('<');
fline = fline.substring(0,n4);
g.drawString(fline,x,y);
x = 5;
y = y +fm.getHeight();
}
Hi,
I am trying to display text from a file into an scrollpane.
i am modifying the text position such that it is aligned and
does not consume useful scrollpane space. but if i find something
like code experts, i should not change the text position and
i should display as it is in the file.
I am able to do so. but the problem i face is ,it works fine
whenever i use space bar. but if i use tabs, the white spaces are
not displayed. i dont think there is any bug in my code.

It is something like ubb code tag in our javaranch.

why is the tabs not working ?
an expert from my code
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!