The Artima Developer Community
Sponsored Link

Java Answers Forum
Get rid of that comma in my JSpinner!!!

1 reply on 1 page. Most recent reply: Nov 5, 2004 4:13 AM by Amol Brid

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Gibran Shah

Posts: 27
Nickname: gibby
Registered: Jun, 2004

Get rid of that comma in my JSpinner!!! Posted: Nov 1, 2004 6:58 PM
Reply to this message Reply
Advertisement
Hey,

There's gotta be a way to do this: My JSpinner seems to like inserting commas in the numbers I enter when the number's big enough. Example: I enter "30000" and when I change the focus it makes it into "30,000". This is undesirable for the application I'm programming. The JSpinner is for entering an appartment number, and no one writes their appartment numbers with commas. Is there a way to tell it that I don't want this?

Gib


Amol Brid

Posts: 43
Nickname: amolbrid
Registered: Feb, 2004

Re: Get rid of that comma in my JSpinner!!! Posted: Nov 5, 2004 4:13 AM
Reply to this message Reply
Hi,

check out this code.

// number model with no upper limit
SpinnerNumberModel model = new SpinnerNumberModel();
JSpinner spinner = new JSpinner(model);
// new editor for displaying number without comma
JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner, "#");
spinner.setEditor(editor);


Amol Brid.

Flat View: This topic has 1 reply on 1 page
Topic: passing array in java by value-result? Previous Topic   Next Topic Topic: Launch browser from java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use