Is there a way to set the number of spaces shown for a tab? (tab as in a tab character)

I've made an editor using a StyledEditorKit and StyledDocument, but tabs give more spaces than I would prefer.

Recommended Answers

All 3 Replies

Member Avatar for iamthwee

Hmm, I'm not sure how to do that.

Although, when I was writing a password program, I needed to output '*' instead of letters when the user was inputing their password.

So I guess you could do something similiar for the tab key.

Such as:

if char = '\t'  //tab character?
  then print "   " //set defaults spaces here
 end if

Although that's incredibly hackish, there may be a better solution?

I've taken a look at it, though I don't see a way of implementing it with a styled document

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.