• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error in formating text when using tabs

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic