John Piekos

Greenhorn
+ Follow
since Jun 21, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Piekos

Thanks for the pointer, it helped - I read the javadoc but didn't "get it" the first time.

My issue is further compounded by the fact that the 3rd party spreadsheet control barfs on the escaped pattern (they must be doing their own escaping - I unescaped prior to setting, ugh) and more importantly, by the fact the user could enter any type of currency symbol in various positions in the user-specified pattern. Other problematic symbols could include: Antigua's "E.C. $", Bermuda's "Bd.$", Ecuador's "S/.
", Kenya's "Kshs.", Macau's "Ptc.", Panama's "B/.", Tanzania's "T.Shs." and a few (known) others... Too bad the Java (locale) currency processing doesn't take handle this automatically.

Anyway, thanks for the pointer, I got around my immediate issue and if I have to travel to Bermuda to fix any currency formatting issues they might have, well, then I guess I'll deal with that then. :-)
17 years ago
I'm having trouble applying a currency format to a numeric value and could use some thoughts/ideas/help.

For our Swiss German locale, we want to display price values with a currency symbol of "SFr.". I figured I could using the CurrencyInstance of the DecimalFormatter for the job. Here's the details:

The format is: SFr.#,##0.00

The code snippet is:

DecimalFormat df = (DecimalFormat)NumberFormat.getCurrencyInstance(Locale.getDefault());
// df.applyLocalizedPattern(strFormat);
df.applyPattern(strFormat);

No difference between .applyPattern() and .applyLocalaizedPattern(), both give the following exception:

java.lang.IllegalArgumentException: Multiple decimal separators in
pattern "SFr.#,##0.00"
at java.text.DecimalFormat.applyPattern(Unknown Source)
at java.text.DecimalFormat.applyPattern(Unknown Source)

Anyone have any ideas how I can apply this valid currency format? Note that I really can't extract the "SFr." every time. The format string could be passed in by the user and could be embedded, and plus it seems that currency symbol processing for the locale should be taken care of by the Java Locale processing.

Note that I start my VM with the following:
-Duser.language=de -Duser.region=CH

Thanks!
17 years ago
Nate,
I am calling JTable.getScrollableBlockIncrement
to get the size of the scroll region. The JavaDoc API for this method says: "Returns visibleRect.height or visibleRect.width, depending on this table's orientation. Note that as of Swing 1.1.1 (Java 2 v 1.2.2) the value returned will ensure that the viewport is cleanly aligned on a row boundary."
Alignment on a row boundary is what I am hoping for. Anyone ever successfully use this method to do what I want to do?
Thanks,
John
21 years ago
I place my JTable in a scroll region, the scroll region is added to a panel. When I display this panel in an Applet (or a JDialog), depending on the size of the container, the last line of the table can be clipped, only partially displayed. I'd like to ensure that whenever the table is displayed, regardless as to the size of the outer container.
Now I have tried adding a container (and scroll region, and jtable) component listener to catch the ComponentResized notification. In there I call table.getScrollableBlockIncrement then call table.setPreferredScrollableViewportSize, but the size never seems to come out right. I am told that this is possible via MFC (but I am not an MFC programmer nor do I ever hope to be. :-) ). Anyone have any thoughts?
21 years ago