I want to display a file path in JTextarea/ JLabel.
I want to display it in following format , "C:/Program Files/... .../abc.xml"
means if file path i too long then i want to display it by above format starting with left & ends at right & middle part can be shown in dots.
so how can I show this format in JTextArea/ JTextFiled/ JLabel.
which alignment should i use for this.
First off, you need to firm up those specifications.
1. What constitutes the 'right part' (the last slash and everything that follows it? a fixed number of characters?)
2. What constitutes the 'left part' (as many characters as can be accommodated? up to the last slash that can be accommodated?)
3. Depending on the first two specs, what's the fallback if the 'right part' and 'left part' together are too long to display?
4. In the event that dots are required, what's the minimum (and maybe maximum) number of dots? how are they to be grouped?
5. Does the solution have to cater to resizing of the Swing component used for display? With changing the LaF? With setting a different Font?