SpinnerNumberModel incorrect decimal values appearing

Hi,
I have created a custom JSpinner using a SpinnerNumberModel which holds values as Doubles but when I use the up and down arrows at some point the double value that is returned looses it's decimal precision. I created the following class:
public class DecimalSpinner extends JSpinner{   
public DecimalSpinner( int displayDecimalPlaces, double value, double min, double max, double stepSize ) throws IllegalArgumentException {
SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, stepSize);
this.setModel(model);
JSpinner.NumberEditor editor = (JSpinner.NumberEditor)this.getEditor();
DecimalFormat format = editor.getFormat();
format.setMinimumFractionDigits(displayDecimalPlaces);
And instantiate the class to have 6 decimal place precision as:
private DecimalSpinner m_spnTransferMin = new DecimalSpinner( 6, 0.1, 0.000001, 1000, 0.1);
when this is used 0.1 is displayed to begin with and pressing the up arrow gives the model values 0.1, 0.2, 0.30000000000000004. Where did this lack of precision come from as the value should be 0.3? Is this related to the fact that Doubles are only ever approximations? regardless how do I correct for this?

Is this related to the fact that Doubles are only ever
approximations? that's the gist of the issue
regardless how do I correct for this?set the spinner editor to a JFormattedTextField configured to display the desired precision. Some useful info:
http://java.sun.com/docs/books/tutorial/uiswing/components/spinner.html#format
http://java.sun.com/docs/books/tutorial/uiswing/components/formattedtextfield.html

Similar Messages

  • P6v7 incorrect decimal value

    team... when we import programme file coming from p6 to p6v7 its rounded all figure to whole number.
    can this be fix by some settings?
    Edited by: user9134677 on Jun 12, 2010 12:42 AM

    I have almost the same case, I want my cost to have a decimal places but when I went to edit/user preference/currency the portion on "show decimal digits" only show "0" instead of "0.00" . This is crazy, what is the used of check/uncheck button when you can only choose "0" zero decimal places?

  • Incorrect data value selected when clicking on slicer entry in Excel Services

    We have uploaded various Excel 2013 files containing pivot tables to Sharepoint 2013 and viewed the pivot tables in a browser. The referenced pivot table data is normally a SSAS tabular model. This has been working fine for over 12 months apart
    from one irritating feature.
    Sometimes a clicked slicer entry does not result in the correct slicer value being selected. This typically occurs after using the mouse scroll button to scroll down a list of entries in a slicer. When using the keyboard arrow keys to highlight a slicer
    value and pressing Return to select an entry, the correct value does always seem to be selected - so it appears to point to a mouse scrollwheel issue. Also, after scrolling through slicer entries using the mouse scroll wheel, there appears to be some sort
    of slicer refresh problem that results in a blank entry/entries being displayed either at the top or bottom of a slicer. However, sometimes the correct 'tooltip' is shown for this blank slicer entry. One other point - when using the slicer scrollbar the scroll
    down a list of slicer entries using Firefox, the problem does not seem to occur. IE does not seem to display the same type of slicer scrollbars (only active when the mouse hovers over the slicer) and so this is more difficult to replicate in Ie.
    The worrying factor is that the user is often unaware that the incorrect slicer value has been selected. The problem can be replicated in both IE11 and Firefox. Also our client systems accessed via Citrix display the same problems.
    Any help greatly appreciated. Thanks.
    Graham Goodwin Email: [email protected]

    Hi Graham,
    i built the same version, please correct me if should your environment, is sharepoint 2013 with march 2013 update and your office also the same update. in my labbox seems the issue is not re-producible.
    after some discussion with my colleague, seems there was issue similar like this back in 2010 Excel and the remedy is to update the excel services and to re-install the power pivot at SQL server. back then the issue is because when we scroll the selection,
    it should be locked, so then when we scroll it may have the position to update and refresh the data. one of the workaround is by clicking the item and press enter, by doing this it will refresh the page correctly. the link was:http://www.microsoft.com/en-us/download/details.aspx?id=29074
    i tried to look at our update for the excel services 2013, there are updates in every cumulative updates but there is no particlular update regarding this issue, perhaps you may try this to check in your development environment, if should it may fix the
    issue.
    to re-install the power pivot, you may need to do this on your sql side. 
    http://technet.microsoft.com/en-us/library/ee210708.aspx
    http://technet.microsoft.com/en-us/library/ee210671.aspxi may suggest you to check the ULS log, if should there are issues with powerpivot also, to make sure if should there are no issue
    regarding power pivot. if there is no issues on the powerpivot, then you may need to open a ticket to report this issue, so that we can have a detailed checking to your environment remotely.
    Regards,
    Aries
    Microsoft Online Community Support
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • "The movie contains an incorrect time value" error - saving a trimmed video

    I am attempting to trim a video shot on my Samsung CL65. The video was shot in High Quality HD 1280 x 720. I open the video in QuickTime and then use the Trim command to remove the last part of the video and then close it to Save it. When I save it I get the following error: "The document SAM_0306.MP4 could not be saved as "SAM_0306". The movie contains an incorrect time value." I think this has to do with an encoding error in the original file or in the trimmed file but I have no idea how to get around it.
    Any ideas?

    This info probably won't help with your problem, but it's information for others who get this error.
    It's probably the software that made the MP4. ffmpegX, for example, and the mencoder program inside it, do this with every H264 encoding when the video is longer than 1 hour. Time codes are correct up to 1 hour, then the seconds value gets wacky (3600 is added to it). Quicktime won't save a movie with a time code like 1:20:3623.120 (although it will correctly display 1:20:23 in the player).
    Apple used to offer quicktime scripts that would allow you to see what the time code in a stream really looked like. Applescript appears to have officially and quietly gone missing, though, and those scripts are no longer available online as far as I can tell. There were some really handy other scripts that would allow you to view all sorts of movie properties and manipulate tracks (great for syncing poorly synced sound, for example), but time code problems like the above would invariably mean the movie couldn't be saved.

  • Decimal values for EA in MIGO

    Dear Experts
    Recently we have upgraded to SAP AFS 6.5 from SAP AFS 5.0. In previous version we could GR (using MIGO) decimal values for unit of measure EA. Now when we are trying to perform goods receipt decimal values it is automatically rounding off to an integer.
    After go live we got an issue which is similar like this and it was corrected after consulting SAP OSS. check the this; Rounding off in MIGO- Error
    I have checked settings in CUNI in previous and current versions. There is no change. Decimal places are zero. Please suggest if you have any idea on this.
    Regards
    Jeewana

    Hi,
       Please check whether all the correction instructions mentioned in the note:  1971912 
    are implemented correctly. If its already maintained correctly, then you may directly raise an OSS ticket to SAP.
       Also refer the similar notes: 1893043 - Decimal places not allowed in MIGO for movement type 561
    1932640 - Incorrect rounding in asset PO with no material.
    Regards,
    AKPT

  • BUG: Info panel displays incorrect Hue values

    Recently, I've been doing a lot of work with color in Fireworks and came across the following bug, which appears to be a longstanding issue within the application. Rather than keeping it to myself, I figured I'd post it here in addition to submitting a bug report with Adobe. So here it is...
    Hue values displayed within the Info panel (in HSB mode) do not consistently match the values displayed in the Color Mixer panel—including basic colors such as pure Yellow, Cyan, and Magenta. The values are 1 degree off—most often below the Color Mixer value, but sometimes above (as with Magenta). This holds true whether using with the Eyedropper tool or the Color Picker swatches eyedropper, and whether sampling from the canvas or from swatches.
    For example, the following inconsistencies were observed when sampling the centermost horizontal strip within CS6's default Color Cubes swatches picker. Note that over 50% of these colors are affected by the issue.
    The Color Mixer seems to display the correct values, while the Info panel's values appear to be incorrect. Note that this issue affects the HSB mode only; the RGB and Hex values are consistent between both panels.
    This bug has been observed in Fireworks CS6, Fireworks CS5.1 and Fireworks 8 on Mac OS 10.6.8 (Snow Leopard).
    Here's the bug report submitted for this issue:
    Product name: Fireworks
    Product Version: 12.0.0.236
    Product Language: English
    Your operating system: Mac OS 10.6.8 (Intel-based)
    ******BUG******
    Concise problem statement: The Info panel displays incorrect Hue values for many colors—including pure Yellow, Cyan, and Magenta. The Hue values are usually 1 degree below the value displayed in the Color Mixer panel (e.g., 59 instead of 60 for Yellow) but sometimes 1 degree above (e.g., 301 instead of 300 for Magenta). This is true whether using the Eyedropper tool or the Color Picker swatches eyedropper, and whether sampling from the canvas or from swatches.
    Steps to reproduce bug:
    In an open Fireworks document, open the Info, Color Mixer, and Swatches panels. Within the Color Mixer and Info panels, set the color mode to HSB.
    Draw a Rectangle and set its fill to Yellow (#FFFF00) using the Color Picker.
    Observe the Hue values displayed in the Color Mixer and Info panels.
    Select the Eyedropper (I) tool, and sample the rectangle's fill color. Again, observe the Hue values displayed in both the Color Mixer and Info panels.
    Results: In both steps 3 and 4, the Hue value for pure Yellow (#ffff00) appears as 60 degrees in the Color Mixer panel but 59 degrees in the Info panel.
    Expected results: The Hue for pure Yellow (#ffff00) should appear as 60 degrees in both panels.
    Note that this issue affects the Info panel's HSB mode only; the RGB and Hex values are consistent between panels. Also note that this bug affects over 50% of the "pure" hues within CS6's Color Cubes swatches palette. For more info, see the following forum post:
    http://forums.adobe.com/thread/1083391
    This bug has been observed in Fireworks CS6, CS5.1 and FW8 on Mac OS 10.6.8 (Snow Leopard).

    I haven't done anything other than add my footage to the timeline. I have 2 layers (1 targa seq and 1 png seq). As I move my mouse from the Timeline to the Comp Panel, the color values flash for a split second and go away. If I press Opt+1 (2, 3, and 4) the Info Panel displays the color for that one pixel but the values go blank as soon as I move my mouse. This happens in the Comp Panel mostly. If I open a Footage or Layer Panel, sometimes the values show, sometimes not. Never had this issue in previous versions.

  • Seeing decimal values in TOAD, but not in SQL Developer

    I'm writing on behalf of a co-worker. He's using SQL Developer to look at some records in a database, but in one column he sees zeroes instead of the correct decimal values (the values are between 0 and 1).
    However, the developer he's working with is using TOAD and sees the correct decimal values in the column.
    Any idea as to how to get the decimal values to appear correctly within SQL Developer?

    The database version is 10g, the version supported by TOAD is 9.
    Hi ,
    1/I have not seen this reported please give a create
    table statement and some test data to insert to
    reproduce the problem.. Please give versions of
    SQLDeveloper and the Oracle database - out current
    production release of SQLDeveloper is 1.5.1(.54.40)
    2.If you can convert the number to a string at the
    database side say with TO_CHAR you should see the
    string representation of the number in SQLDeveloper.
    This would work if you are using a select via the
    worksheet or a view on the table with the number if
    you want to see it in a views data tab.
    -Turloch

  • ABST2 - Values appear

    Dear Experts,
    I have a peculiar situation unable to understand the SAP Standard behavour, Please confrim below postings are correct.
    Uploaded legacy Asset data through AS91 and checked GL account report(FBL3n) no values updated.
    Then checked ABST2 - There is difference and the values appear as
    Asset Acquisition value  - rs. 15000 (which I have updated in AS91)
    Accum Depreciaito A/c - rs. 1500 - (which I have updated in AS91).
    Later I have passed an entry in OASV
    Asset Acquition A/c DR - 15000
    Accum Dep A/c       Cr - 1500
    Asset Clearing A/c  Cr - 13500
    Now I can see values in FBL3n Report (GL's Updated
    But in ABTS2 by right there should be any values, but system is generated the difference as below.
    Asset Acquisition value  - rs. 15000 (which I have updated in AS91)
    Accum Depreciaito A/c - rs. (1500) Credit (which I have updated in AS91)
    Asset Acquisition value  - rs. (15000)Credit
    Accum Depreciaito A/c - rs. 1500
    My understanding is system should knock of these debit/credit lines and there shouldn't be any values when we execute ABST2.
    Please let me know if I miss any step or is it system standard behaviour.
    My business wants the value should be zero if we execute ABST2, how can we acheive. Thanks.
    Regards,
    Raj

    Hi
    Note 104567 point 3 d) explains the issue :-
    Incorrect legacy data transfer:if there already exist differences
    in the year of the legacy data transfer, the differences must
    also be written off on the G/L account in the previous year.
    Refer also to Note 69225. This error occurs especially when a
    local currency changeover is performed directly in the year of a
    mid-year legacy data transfer and the balance values of Asset
    Accounting were not posted at the beginning of the year, that is,
    on December 31 but on the key date of legacy data transfer to the
    general ledger.You encounter this error when the system displays
    pairs of entries in the list for the balance carried forward
    (period is blank) and for the key date (period 999).

  • Public int indexOf(int ch, int fromIdx) doesn't work for some decimal value

    I have tested two strings below. These two string are identical, except the first string has a char 'ƒ, which has a decimal value of 131. And the second string has a char 'À', which has a decimal value of 192. I am expecting the same output, which is 11, but I got -1 for the test I did using the first string. In the API for public int indexOf(int ch, int fromIndex), values of ch is in the range from 0 to 0xFFFF (inclusive). It is highly appreciated if anyone could provide any insights on why -1 returned when the first string is tested. Thank you in advance.
    String strHasDecimal131 = "Test value ƒ, it has a decimal value of 131";
    String strHasDecimal192 = "Test value À, it has a decimal value of 192";
    int badDecimal = 131;
    int idxBadDecimal = strHasDecimal131.indexOf( badDecimal, 0);
    System.out.println( "index of Bad Decimal: " + idxBadDecimal );
    The output is: index of Bad Decimal -1
    int badDecimal = 192;
    int idxBadDecimal = strHasDecimal192.indexOf( badDecimal, 0);
    System.out.println( "index of Bad Decimal: " + idxBadDecimal );
    The output is: index of Bad Decimal: 11

    Thank you everyone for your inputs. Following are the print statements and the output: for character 'ƒ' and ' À':
    System.out.println((int)'\u0083' + ", " + (int)'\u00C0' + " print decimal value" );
    Output: 131, 192 print decimal value
    System.out.println((char)'\u0083' + ", " + (char)'\u00C0' + " print character value" );
    Output: ?, À print character value
    According to Latin-1 Supplement table, the first char in the output would have the appearance of ƒ, instead it has the appearance of ?
    System.out.println( (int)'ƒ' + ", "+ (int)'À' + " print integer value");
    Output: 402, 192 print integer value
    I also have tried to print out the decimal value of following char: € � ‚ ƒ „ … † ‡, according to Latin-1 Supplement table, these char has decimal value of 128 through 135 and hex value 0x0080 through 0x0087. And the output from java println is: 8364 65533 8218 8222 8230 402 8224 8225.
    System.out.println((int)'€' + " " + (int)'�' + " " + (int)'‚' + " " +(int)'„' + " " + (int)'…' + " " +(int)'ƒ' + " " + (int)'†' + " " + (int)'‡' );
    As I did before, I print out character of decimal value of 128 through 135
    System.out.println((char)128 + " " + (char)129 + " " + (char)130 + " " +(char)131 + " " + (char)132 + " " +(char)133 + " " + (char)134 + " " + (char)135 );
    Output: ? ? ? ? ? ? ? ?
    Not sure why java prints character for decimal value of 128 through 159 differently from what appears in the Latin-1 Supplement table. Any of your inputs are appreciately.

  • Excise Amount with three Digit decimal value

    Dear All,
    I enabled three digit decimal values for sales.
    When I am raising a Excise Invoice through J1I3, two digit only appearing?
    For Ex: Excise amount in sale order is 6897.525 where as in J1I3 transaction, it's showing as 68975.25.
    How to correct this issue?
    Rgds,
    Senni.B

    Dear GSL,
    For Import purchase purpose, client is asking for three digit decimal values. But when we go for excise related transactions, it's taking only two digits of the actual value.
    Is there any settings in CIN to activate three digit decimal?
    Rgds,
    Senni.B

  • CS4 angry with decimal values

    Hi,
    I can't find the answer to my problem :
    I'm on Indesign CS4 (french) and Windows XP. Constantly, without no (obvious) reason, the fields x, y, height and width (top left) suddenly doesn't take decimal values anymore.
    It drives me crazy!
    I work for a printer, I daily use Indesign so it's important.
    Apparently, the problem disappear when i restart the soft.
    I tried with point and decimal point,
    I tried to change one number when the value is already a decimal,
    I checked my keyboard (AZERTY),
    but nothing at all….
    Each time, the soft display "Valeur numerique incorrect" (Incorrect numeric value).
    Did someone already had this problem ? An even more important, does anyone have a solution?
    Hope you can help.
    THX

    Are you using the correct separator for the decimal (comma vs dot -- not sure which would be right for you), and are the files all French in origin (not sure tht matters).
    Check the Language settings in Windows under regional settings, and diable the keyboard shortcut to switch languages if you have multiple languages installed. That screws things up all the time becasue the OS interprests one of the common ID shorcuts as a call to switch languages.
    You might also want to trash your prefs. See Replace Your Preferences

  • Custom thousand separator for decimal values.

    Hello esperts,
    I have a a WD app with a decimal context attribute, I have already a Simple Type that formats the decimal so the thousand separator is a coma (,) and the decimal separator is the dot (.)
    I want to know if it is possible to change the thousand separator to dot and the decimal separator to comma without changing the user's language. Or even use whatever character I want to be the thousand separator e.g. @ | ¬ whithout changing the data type (decimal).
    Thanx in advance.
    JV

    Hi Siarhei,
    I dont want to use calculated fields, nor strings because I need the values of the decimal attribute. I will be desplaying these decimal values through a table and sorting functionality is a must. So as you should know, if I have 1, 2, 3, 20 and 100 and convert them to string, on sort it will be incorrect because of string sorting ( 1, 100, 2, 20 and 3).
    Basically my requirement is to be able to change the decimal presentation without changing the user's locale or language. I don't know if that's possible.
    Say, I select an option on my application that says "comma separated thousands", the decimal values will be presented this way ###,###,###,###.00 or when the user selects the option "dot separated thousands", the decimal values will be presented like this ###.###.###.###,00. I already tried to format the last reprersentation but I get java.lang.IllegalArgumentException: Malformed pattern. I have already checked the DecimalFormat API, so I know the pattern is incorrect, still I'm looking if by chance I'm forgeting something else to do in order the application to work as I spect.
    Thanks!
    JV

  • Incorrect initial value for char 0FISCYEAR in i_t_range in DTP filter prog

    Gurus
    I need your help , I have searched all the threads but could not find anything which can help me resolve this issue.
    I have a filter in DTP as a routine to get the year from system date.
    The program is correct for syntex but when I trigger the DTP I am getting the following message , not sure what needs to be added to my programe.
    Incorrect initial value for characteristic 0FISCYEAR in i_t_range
    Message no. DBMAN889
    appreciate any help I can get to reoslve this ASAP.
    Thanks in advance

    Hi
    Pleae check if you have initialised with a NULL value . "blank/null" is indeed not a valid characteristic value for fiscal period. Fisc.per is of type NUMC which means all characters have to be numerical. The initial value should be "0000000" .
    Thanks,
    Rajesh.
    Please provide points to answers if you find them helpful

  • Incorrect initial value for characteristic 0fiscyear in i_t_range

    Hi,
    While extracting the data from the source DSO to Target I got an error message like '' Incorrect initial value for characteristic 0fiscyear in i_t_range".
    what is the step should i take to resolve this?
    Thanks in Advance.

    Gurus
    I have the same problem with my ABAP code written in DTP filter.
    Can anyone please help what needs to be done , I am getting this error when I try to load the data to cube.

  • How do I convert an alpha character from a text string to its decimal value

    I am trying to find out the actual decimal value of a character in a string. So far the code below is as far as I got. I am able to get what I guess is a byte value.
    This is for a school assignment:
    The idea behind what I am trying to do is to design a hash function to store dictionary words into a bucket array hash table, without using the existing Hashtable.class
    so far this is what I can come up with to get some kind of value for each character in the string, however, what I am trying to get is the decimal value for each character.
    public static void main(String args[]){
         String word = "abcdefghijklmnopqrstuvwxyz";
         for (int i=0 ; i < word.length(); i++){
         System.out.print((word.substring(i,i+1)));
         System.out.print("\t : "+((word.substring(i,i+1))).getBytes());
    Thankyou for any replies.

    I'm not sure I completly understand your goal- what you mean by "decimal value", but, if you simply want to find the byte value of each character in a String, you would probably be better off using getBytes() in a way like this,
    byte [] bytes = string.getBytes();
    Then, if you need to map that to a charcter, you could use a for loop like
    for (int x = 0; x < bytes.length; x++) {
    table.put((char)bytes[x], bytes[x]);
    which assummes this bucket class of yours allows primitive data types like so (in Hashtable or HashMap, you would have to use a wrapper Object). I guess, my point reduces to, don't use substring and string search methods (like indexOf()), unless you have to because they are more expensive then just maping the array of bytes and chars, which seems to be what you are interested in doing.

Maybe you are looking for

  • In which table to find parked, cleared and open invoices?

    in FI how to know which table stores parked , open and cleared invoices? if through FBL1N, what is the way ? thanks

  • CQ5 server performance is very slow ?

    Hello, I deployed my project on publish server, but both the server responding very slow, Is it the CQ5 server the very slow? Please let me know how to make more faster performance of CQ5 server, please let me know is there any configration we have t

  • Digusted with the lack of Customer Service and Complete disregard for Inconvenie​nces

    Its a shame I have to come here in order for my voice to be heard. I have spent many hours on the phone with technical support and customer service and it has been to no avail. As a longstanding verizon wireless customer I assumed the high level of c

  • Font Size in Script

    Hi All, I want to change the font size in script. ( for eg :when i change the size to 8 or 10 it accepts but if i give 9 it does not. it gives the message "not SAP font size".) wat do i do to get the required size. pls reply. thanks. kavitha

  • Containers are not working on my PC

    Hello I came to learn about Containers, and I tryed to compile a simple file like this one, for ex., and I've gotten those error messages. Please give me an advise. THX ! import java.util.*; public class Liste{      public static void main(String[] a