This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
i was doing style into my jtextpane using styleDocument and i wanted it to align text as justify, i have achieved what i wanted to do but the alignment is not the same as MS word's "justify" alignment
is this is a case or i m doing something wrong ?
I'm fairly certain that visual consistency with MS Word wasn't part of the Swing specification, so I'd tend to disregard any such discrepancies. If some part of Swing doesn't work according to your expectations, tell us in detail what you did, what you expected, and what the actual outcome was.
Tim Moores wrote:I'm fairly certain that visual consistency with MS Word wasn't part of the Swing specification, so I'd tend to disregard any such discrepancies. If some part of Swing doesn't work according to your expectations, tell us in detail what you did, what you expected, and what the actual outcome was.
thanks for the reply i was just trying to align "justify " my text
code for that
how ever after this code i have placed a simple print statement and retrieve the alignment and i get the same justify align but the text in my textpane positioned themselves in some way
but that way is not exactly what i wanted ?
all i wanted is the text should be justify properly just as like MS Word
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
2
MS Word is not the definition of text processing or layout. That its way would be the "proper" way is quite a stretch.
Can you be more precise about what "some way" is? And also, what exactly it is that you wanted? Or does the question mark at the end of that sentence indicate that you're not sure what you wanted and/or expected?
Tim Moores wrote:MS Word is not the definition of text processing or layout. That its way would be the "proper" way is quite a stretch.
Can you be more precise about what "some way" is? And also, what exactly it is that you wanted? Or does the question mark at the end of that sentence indicate that you're not sure what you wanted and/or expected?
yes, i m not getting what i m expecting
it will be very hard for me to explain you what i want because i guess you are not familiar with the align "Justify" of MS word
let me try once more, suppose you are writing a paragraph, and lines in that paragraph are not proper consider this example
your paragraph without justify align :
hi i love programming
do you love programming
yes i do love but , but what ?
now your paragraph with justify align:
hi[ss]i[ss]love[ss]programming
do[ ]you[ ]love[s]programming
yes i do love but ,[s]but what ?
note : [ ] or [] or [ss] indicates spaces for the example to appear cleaner
notice here how everything in a paragraph is justify this is how MS Word works and i m expecting this output, i guess now the picture is clear for you ?
and hope you can help me with that?
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
2
> this is how MS Word works and i m expecting this output
how about you get apple to mimic everything MS does, then java/oracle might follow.
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
1
I'm familiar with the concept of justification of text. What I asked was what you got instead of what you thought you should be getting.
Tim Moores wrote:I'm familiar with the concept of justification of text. What I asked was what you got instead of what you thought you should be getting.
oh you are familiar, i m sorry then , but i m getting the output just similar to the example i have shown you (without justify align).
Michael Dunn wrote:> this is how MS Word works and i m expecting this output
how about you get apple to mimic everything MS does, then java/oracle might follow.
:) funny .....
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
1
I can't tell from 4 lines of code what they might do in the context of an actual program. Maybe you can post a screenshot of the output, or, even better, post an SSCCE.
Tim Moores wrote:I can't tell from 4 lines of code what they might do in the context of an actual program. Maybe you can post a screenshot of the output, or, even better, post an SSCCE.
naved, please keep technical discussions on the forum. Private messaging has its purposes, but repeating forum posts in a private message is not one of them.
You've been asked more than once to post your code in the form of an SSCCE, but it appears that you are unwilling to take the effort to make it easier for other members here to help you.
Darryl Burke wrote:naved, please keep technical discussions on the forum. Private messaging has its purposes, but repeating forum posts in a private message is not one of them.
You've been asked more than once to post your code in the form of an SSCCE, but it appears that you are unwilling to take the effort to make it easier for other members here to help you.
Good luck with your problem.
OK i have read the SSCCE ...and now i m posting a code that can be run through just copy-paste operation into your IDE.
hope with this any one can provide me help ?
That's not an SSCCE - you forgot the imports: You should check if selexted inside your action listener is null. If you don't select anything you will get a NullPointerException.
Rob Spoor wrote:That's not an SSCCE - you forgot the imports: You should check if selexted inside your action listener is null. If you don't select anything you will get a NullPointerException.
yes, thanks for the import one ,
and yes i do know that i will get null pointer exception if i didnt select anything but thats not what i m searching here, i want justify align which is not happening or working in my code
can any one will point out the problem please
that will be a great help
thanks anyways ......
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Is Java's alignment "Justify" is same as MS Word's alignment "Justify"?