This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am busy writing some translation software for my company and I have run into one requirement from the boss that I am having trouble implementing.
Basically, I am stripping the values out of define statements out of php files and displaying these in textfields in a table. Now, there are pieces in the strings that the user must translate and there are pieces that the translator must leave alone. This is stuff like html formatting and references to other variables. So I want these bits to be in the textfield, but the user cannot edit them. And to go further, I don't want the user to see the exact code, I want them to see a little gray box in the textfield so that the user knows that there is a piece here that must not be translated.
For example in the english value it is: Rachel is my name.<br> Hello!
On screen I want to show the user (where the _ are boxes) Rachel is my name._ Hello!
And in the text area for the user to translate it must show _
So that the user knows to type before and after the box, so that I can preserve the formatting.
Could anyone help me in getting a little gray box in a text field or is there some better approach that I am missing?
I'm not sure if this is possible, but can you put all the bits of text that are to be editable textboxes and the non-editable bits in JLabels or non-editable textfields ? I think that would be easiest.
If you want textboxes that are only part editable you need to write a DocumentFilter. This will help. You can make your non-editable text appear grey by using the setParagraphAttributes method and the Style & StyleConstants class.
I think the former of these approaches will be much easier. hth D.
Joined: May 18, 2004
DocumentFilter NOOOO!! I've been putting that off for as long as possible!!
Maybe that textfield label combination will work. Maybe i'll make it into a little panel that I shove into the table's cell. Thank goodness it's Friday and I don't actually have to implement this today. But thanks for the suggestions. I'm going to go with this one first and try the DocumentFilter as a last resort.
Thank you once again Almighty Don for saving Rachel from swinging into danger.
May you have a super weekend! Rachel
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com