JTextArea width problem

N

Neutrino

Hello,
I am using a JTextArea to display 10 lines with a maximum of 40 characters,
so I created a JTextArea (10, 40). It is working correctly excepted the fact
that the width of the text area is doubled under KDE compared to XP Windows
look-and-feel. With windows the width is closed to the correct size (I mean
40 characters fill the area quite correctly), but with Linux KDE, I can
input quite 80 characters and the area is very large. I understand that for
fonts size compatibilities and portability reasons the size could be
different than 40 characters but a so important difference, I do not
understand ? with other words, is there somewhere an description for what is
the meaning of the parameter 'column' of the JTextArea constructor ?
Best Regards,
AR
 
P

Paul H. van Rossem

Hello,
I am using a JTextArea to display 10 lines with a maximum of 40 characters,
so I created a JTextArea (10, 40). It is working correctly excepted the fact
that the width of the text area is doubled under KDE compared to XP Windows
look-and-feel. With windows the width is closed to the correct size (I mean
40 characters fill the area quite correctly), but with Linux KDE, I can
input quite 80 characters and the area is very large. I understand that for
fonts size compatibilities and portability reasons the size could be
different than 40 characters but a so important difference, I do not
understand ? with other words, is there somewhere an description for what is
the meaning of the parameter 'column' of the JTextArea constructor ?
Best Regards,
AR
Quote from the source code (JTextArea.getColumnWidth()):

* The meaning of what a column is can be considered a fairly weak
* notion for some fonts. This method is used to define the width
* of a column. By default this is defined to be the width of the
* character <em>m</em> for the font used.

1) Did you change the Font for the JTextArea?
2) You could override JTextArea.getColumnWidth() to solve this.

Good luck, Paul.
 
A

Ann

Neutrino said:
Hello,
I am using a JTextArea to display 10 lines with a maximum of 40 characters,
so I created a JTextArea (10, 40). It is working correctly excepted the fact
that the width of the text area is doubled under KDE compared to XP Windows
look-and-feel. With windows the width is closed to the correct size (I mean
40 characters fill the area quite correctly), but with Linux KDE, I can
input quite 80 characters and the area is very large. I understand that for
fonts size compatibilities and portability reasons the size could be
different than 40 characters but a so important difference, I do not
understand ? with other words, is there somewhere an description for what is
the meaning of the parameter 'column' of the JTextArea constructor ?
Best Regards,
AR

The layout manager might make it wider for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top