Can't Set Value in JSpinner

I am having trouble setting a value to a JSpinner in my code.
I am using two JSpinners, both with SpinnerNumberModels.
I use the Object JSpinner.getValue() method to get the current value from that JSpinner, change that object into an Integer format, and perform an arithmetic operation on the integer.
I then change the resulting integer into an Object format, and call the method JSpinner.setValue(Object).
The setValue method never changes the value of the JSpinner, and occasionally throws an IllegalArgumentException - depending on where I put it in the code.
The problem appears to come from either all the changing formats or the setValue method.
Any suggestions?

Perhaps this example will help?
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Dork extends JFrame implements ActionListener
     JSpinner dizzy;
     public static void main(String[] args)
          Dork dork=new Dork();
     public Dork()
          super("Dork");
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          Container content=getContentPane();
          dizzy=new JSpinner(new SpinnerNumberModel(5,1,10,1));
          content.add(dizzy,BorderLayout.CENTER);
          JButton increment=new JButton("Increment");
          increment.addActionListener(this);
          content.add(increment,BorderLayout.SOUTH);
          pack();
          setLocationRelativeTo(null);
          show();
     public void actionPerformed(ActionEvent e)
          Integer value=(Integer)dizzy.getValue();
          Integer plusone=new Integer(value.intValue()+1);
          dizzy.setValue(plusone);
}

Similar Messages

  • Item - Can't set value on item because the item can't get focus.  [66000-15

    hi i created one text box in purchase order form and asign the choose from list.l when i choose in edit box its show the following error-- Item - Can't set value on item because the item can't get focus
    Dim lonHeadDatasource As SAPbouiCOM.DBDataSource
    lonHeadDatasource = oOrderForm.DataSources.DBDataSources.Item("OPOR")
    oNewItem1 = oOrderForm.Items.Add("EditDS", SAPbouiCOM.BoFormItemTypes.it_EDIT)
                        Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                        Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                        Dim oCFL As SAPbouiCOM.ChooseFromList
                        oCFLs = oOrderForm.ChooseFromLists
                        oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                        oCFLCreationParams.MultiSelection = False
                        oCFLCreationParams.ObjectType = "INTORDER"
                        oCFLCreationParams.UniqueID = "CFL1"
                        oCFL = oCFLs.Add(oCFLCreationParams)
                        oItem = oOrderForm.Items.Item("4")
                        oNewItem1.Top = 95
                        oNewItem1.Height = oItem.Height
                        oNewItem1.Width = 140
                        oNewItem1.Left = 125
                        oEdit = oNewItem1.Specific
                        oEdit.DataBind.SetBound(True, "OPOR", "U_EditDS")
                        oOrderForm.Items.Item("EditDS").Specific.ChooseFromListUID = "CFL1"
                        oEdit.ChooseFromListAlias = "U_ID"
    Item events
    Try
                If pVal.BeforeAction = False Then
                    If (pVal.FormType = 142) Then
                        Select Case (pVal.ItemUID)
                            Case "EditDS"
                                Select Case (pVal.EventType)
                                    Case SAPbouiCOM.BoEventTypes.et_GOT_FOCUS
                                    Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
                                        Dim bonCflEvents As SAPbouiCOM.ChooseFromListEvent
                                        Dim bonCflList As SAPbouiCOM.ChooseFromList
                                        Dim bnnstrUID As String
                                        Dim bonDTTable As SAPbouiCOM.DataTable = Nothing
                                        bonCflEvents = pVal
                                        bnnstrUID = bonCflEvents.ChooseFromListUID
                                        bonDTTable = bonCflEvents.SelectedObjects
                                        bonCflList = oOrderForm.ChooseFromLists.Item(bnnstrUID)
                                        If pVal.BeforeAction = False Then
                                            If oOrderForm.Mode <> SAPbouiCOM.BoFormMode.fm_FIND_MODE Then
                                                If Not (bonDTTable Is Nothing) Then
                                                    If bonCflList.UniqueID = "CFL1" Then
                                                        If pVal.ItemUID = "EditDS" Then
                                                            Dim value As String = Nothing
                                                            oOrderForm.Items.Item("EditDS").Specific.value = bonDTTable.GetValue(0, 0)
                                                        End If
                                                    End If
                                                Else
                                                    lonHeadDatasource.SetValue("EditDS", lonHeadDatasource.Offset, "")
                                                End If
                                            End If
                                        End If
                                End Select
                        End Select
                    End If
                End If
            Catch ex As Exception
                SBO_Application.SetStatusBarMessage(ex.Message)
            End Try
    Thanks & Regards
    B.Narain

    Hi
    Instead of   oOrderForm.Items.Item("EditDS").Specific.value = bonDTTable.GetValue(0, 0) the following
    lonHeadDatasource.SetValue("U_EditDS", 0, bonDTTable.GetValue(0, 0))
    Regards
    Arun

  • PreparedStatement Can't set value at index 1 null

    I've never had this situation before, but I am unable to set a value at the first position of the PreparedStatement.
    System.out.println("The value = " + this.valueId);  // Prints -- The value = 479
    statement.setInt(1, valueId);
    statement.setInt(2, valueId);
    System.out.println(statement.toString());
    // Prints - "INSERT INTO table SET value = null, value_two = 479"wtf? Why am I losing the value at the first index.. Note that I am using prepared statements without error in other places of my program and I am able to set the first index with the proper value. But this, I'm stumped. I don't know how to debug this. If anyone could shed some light, let me know under what circumstances I might not be able to set a value to the first index of a prepared statement.. I'd be grateful. Thanks.

    Thank you for your response. Yes that was myoversight when I posted. Indeed I have tried it both
    ways, with and without the "this" in the System print
    and the set statement. Currently my code appears as
    System.out.println("The value = " + this.valueId);
    statement.setInt(1, this.valueId);
    statement.setInt(2, this.valueId);Thanks again.
    is the parameter the wrong type?
    if possible can you call getParameterMetaData();
    ParameterMetaData pmd = statement.getParameterMetaData();
    for(int i=1;i<=pmd.getParameterCount();i++){
      System.out.println("Meta Data for Parameter "+i);
      System.out.println("Parameter Type Name "+pmd.getParameterTypeName(i));
      System.out.println("Parameter SQL TYPE "+pmd.getParameterType(i));
       This should return the same for both. Otherwise we have a problem.
        You can look up the constants here http://java.sun.com/j2se/1.4.2/docs/api/constant-values.html#java.sql.Types.ARRAY
    }

  • How can I set value for vc application's form

    there is a running vc application,and the vc application has form.the form's parameters can input from keyboard.but I want use java application to realize the function that input parameter instead of mannual input.
    can you give me some advices,thank you very much.

    This may help:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=236676

  • Setting values to properties on load

    Hi,
    I have a big Trouble on Data Populating to the components on page loading like,
    Have page1 and page2.Based on ID passed from page1,query should execute and results should set to the form on page2 through Backing Bean.
    What doing is..
    using setActionListener passing ID from page1 and setting to method in page2 as argument which gets results based on ID and sets to component properties, here the problem is..
    Before page2 loads method called first from setActionListener where we cannot set the values to properties before loading.
    How can we set values to components in backing bean only on load based on ID from other page.
    And one more issue is, if we make any code in setter property it get executes every time,
    what is the correct procedure to execute the method only on loading.
    Does there any procedure to make method to excecute only on load.
    Please suggest me, how can i overcome this issues,these were become major issue for the Development.
    Thanks,
    Bandaru.

    hi,
    we tried to achieve the same thing.. But its not possible to set the values to individual segments of a KFF..
    Thanks,
    raghav.

  • How can use set automatically after executeQuery in UIX Site?

    Hallo ...,
    i start in my site with an initial event for instance site.do?event=init.
    in the init event i make a roolback, setWhereClause and executeQuery. then the site will display. after the executeQuery i have data in my site which i want to put on variables. all solutions i know need an event. when i put an submit button on the site and go to an event variable there i can say set value=... property=... target=... and can work for example with session variables. but i want to fill the variables without user interaction. but i don't know a way.
    any help is appreciated.

    Hi Marc,
    You can use the Origin property of the pane to set the top left point of your front panel.
    Is this what you are after?
    Dave
    Message Edited by DavidU on 10-06-2008 10:13 AM
    Attachments:
    OriginProperty.png ‏2 KB

  • Setting values for items other than default value

    How can I set the value of Items (hidden item, display item etc) without using any of navigational control such as list, select list or tree?
    I have a two report region on a page and no navigation control. the requirement is only one region should be displayed at one point of time.
    Condition that drives this are passed from other page through links.
    The code is like this
    For Region A
    select * from table a where cola = :P_VALUE_FROM_OTHER_PAGE; //value passed is JOE
    For Region B
    select * from table a where cola = :P_VALUE_FROM_OTHER_PAGE; //value passed is JOHNnow there is the hidden item :P_HIDDEN that i am comparing in expression1 = expression2 conditions for each region
    for e.g.
    for region A
    value in expression1 = expression2
    P_HIDDEN = 1
    for region B
    P_HIDDEN = 2my issue is, where can I set values for P_HIDDEN item (set to 1 and set to 2) without any navigational control on the page.
    Thanks,
    R
    now there is the hidden item :P_HIDDEN that i am comparing in expression1 = expression2 conditions for each region
    for e.g.
    for region A
    value in expression1 = expression2
    P_HIDDEN = 1
    for region B
    P_HIDDEN = 2
    my issue is, where can I set values for P_HIDDEN item (set to 1 and set to 2) without any navigational control on the page.
    Thanks,
    R
    Edited by: Rich V on May 21, 2010 10:41 PM

    The question I would ask is:
    How are you determining which region you want to be displayed by default?
    Either way, you could potentially use a 'before header' computation to calculate the value of your hidden item, although you'd also need to include some sort of conditional means of preventing the computation from running everytime to run the page (otherwise you'd never see your other region) e.g. you might only want it to run if the hidden item is null.

  • BUG Can not set DML Fetch Mode:

    http://screencast.com/t/m7lEYZ1m5F
    while creating a DML ( Automatic Row Processing ) , can not set value of radio button .
    is this a bug , or i am missing something?

    >
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    It's even more essential to include full version information if you suspect a bug. Knowing the versions involved enables Oracle and other forum members to try to replicate the problem properly. It also allows us to look at the documentation or MOS bug database to compare the problem to known bugs and fixes.
    http://screencast.com/t/m7lEYZ1m5FYou've even managed to crop the screenshot so it doesn't show the version number...
    while creating a DML ( Automatic Row Processing ) , can not set value of radio button .
    is this a bug , or i am missing something?Confirmed as appearing in ARP (DML) processes in APEX 4.2.1.00.08. This does indeed appear to be a bug. However it is only cosmetic. DML Fetch Mode is an ARF (fetch) process option that is deprecated in APEX 4.x. Setting it for ARP (DML) processes is unnecessary, so you can safely ignore it.
    The appearance of the radio group in ARF processes is subject to a bug in APEX 4.2.0: +{message:id=10713985}+
    However it should not be appearing in an ARP (DML) definition at all as it was only an option for fetch behaviour.

  • How can I set a value in a field before create when a New button is clicked

    Hi,
    I am using
    JDeveloper 10.1.3.1.0.3984 and
    JHeadstart 10.1.3.1 release 10.1.3.1.26
    I have one group and there is a detail group under that group.
    From main group to detail group there are 3 field relating those groups.
    field1
    field2
    fieldSEQ (auto-generated by database trigger)
    These 3 fields are PK.
    In the detail group, there is a New button. So, when the New button is clicked, it tries to create the record with those 3 fields value as those are coming from main group. As a result it's giving the duplicate error as that record already exists in the table.
    But I don't want to create the record with that SEQ as that will be created in the trigger.
    How can I set the SEQ temporarily any no. (-1) before create when the New button is clicked?
    Can anybody help?
    Thanks
    Syed Jabbar
    University of Windsor
    Windsor, ON, Canada

    Hello Syad,
    What I would suggest is setting the sequence number at the creation of the entity object (so in the create() method) by using the database sequence. This way it will always be unique.
    So something like:
    protected void create(AttributeList AttributeList) {
    super.create(AttributeList);
    SequenceImpl sequence =
    new SequenceImpl("KCP_SEQ", getDBTransaction());
    setFieldSeq( sequence.getSequenceNumber());
    If this still does not solve it: please go to the ADF Forum since this problem is an ADF problem, not a JHeadstart problem.
    Regards,
    Evert-Jan de Bruin
    JHeadstart Team.

  • How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi
    Can anyone tell me.
    How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi Mithlesh,
    javascript runs on client side and you cannot assign the value to a Page attribute directly.
    As a workaround,you can use an Inputfield,hidden if required,and set the value using javascript.Then the form will have to be submit to be able to read the value in onInputProcessing and then can be assigned to any variable.
    In Layout
    <head>
    <script language="javascript">
    function pass()
       txt1 = document.getElementById("ip_mrf");
       txt.value = "hello" ;
    </script>
    </head>
    <htmlb:inputField  id="ip_mrf"
                               value="<%=mrf_number%>"
                               visible="FALSE"/>
    in onInputProcessing
    cha1 = request->get_form_field( 'ip_mrf' ).
    where cha1 is the page attribute
    hope this helps,
    Regards,
    Siddhartha
    Message was edited by: Siddhartha Jain

  • How can I set a variable number of values in a SQL IN clause?

    Hi,
    How can I set a variable number of values in a SQL IN clause without having to change the text of the SQL statement each time?
    I read the link http://radio.weblogs.com/0118231/2003/06/18.html. as steve wrote.
    SELECT *
    FROM EMP
    WHERE ENAME IN (?)
    But we need the steps not to create type in the system and would there be any other solution if we would like to use variable number of values in a SQL IN clause ?
    We are using JDeveloper 10.1.3.2 with Oracle Database 10.1.3.2
    Thanks
    Raj

    Hi,
    can you please explain why the solution from steve is not the right solution for you.
    regards
    Peter

  • How can I set a value of column in SSIS by using Replace

    How can I set a value of a column in SSIS using a Replace in Derive columns. I have here NameCode and I need to Set = 1 Where NameCode like LIKE '____99____'
    eg. 1006993010... if 5th and 6th characters are 99
    Else 0
    Hope to hear from someone soon and I appreciate great help here.

    If NameCode column is integer then you have to cast it correctly to String.
    I am adding that to the expression provided by Rajen.
    SUBSTRING((DT_WSTR,20)ProductCode,5,2) == "99" ? 1 : 0
    -Vaibhav Chaudhari

  • Can I set a Session Variable from a Dashboard Prompt, using values that are

    Hi All
    Trying to set a Session Variable to an integer value, by letting users select a text value from the drop-down list on a Dashboard Prompt. The goal is to set the input parameter to the IndexCol function, but to provide the end users with a text description of what they are setting.
    Select Value Set Variable Value
    My 0
    My Team 1
    My Companies 2
    My Teams Companies 3
    Any suggestions on how to accomplish this? Certainly we could populate the drop-down from a data source, however I don't see how to populate a variable with something other than the values on the screen.
    The IndexCol function is referenced in a Filter in Answers, and I'm thinking to populate a Session variable using the (Presentation) variable value set from the prompt. But how to do this? I see a reference to a function NQSSetSessionValue(), but cannot find documentation on how it works.
    Any clue will be greatly appreciated.
    Thanks

    Hi kishore..
    Looks like the link u have sent uses advanced SQL tab to set session variables. I want to know if I can use "set variable NQ_SESSION.myvar= @something" in the "SQL results" -while creating a dashboard prompt-.
    Purpose: I want the session variable to be set based on whatever report that im currently in.
    And i dont want to use presentation variables because im using a reset button in my page.
    My reset script resets presentation variables and NOT session variables.
    Thanks in advance
    Loy

  • How can I set bind parameter as Default Display Value in JHeadstart

    Hi,
    I am using -
    JDeveloper Studio Edition Version 10.1.3.1.0.3984
    JHeadstart Release 10.1.3.1.26
    Can anybody help me for the following:
    I am using a super class of ViewObjectImpl where I am definning a bind parameter (Student ID) using login userid:
    if ("p_std_id".equals(bindParam[0])) {
    sLog.debug("executeQueryForCollection: found bind param p_std_id, setting value to " + studentNumber_from_LDAP);
    bindParam[1] = studentNumber_from_LDAP;
    Then I defined p_std_id in Bind Variables tab in VO Editor and used that in Where clause in the SQL Statement tab.
    This is working fine.
    Now what I want to do is:
    I want to put the value of p_std_id as Default Display Value for a field.
    Can anybody let me know how I can put the value of p_std_id in JHeadstart Application Definition?
    Thanks
    Syed Jabbar
    University of Windsor
    Windsor, ON, Canada

    Hi Jan and Steven,
    Thanks for your reply.
    I need to show the default value in the table layout.
    Steven, could you please give some more hints about EL Expression?
    To obtain the value of p_std_id now and pass it on as bind param, I am using a class extending ViewObjectImpl. Inside that class I am using the following method:
    I'd appreciate if you could help for the EL Expression.
    Thanks
    protected void executeQueryForCollection(Object Object, Object[] bindParams,
    int i) {
    String userId = ((ApplicationModuleImpl)getApplicationModule()).getUserPrincipalName();
    try{
    getLdapInfo(userId);
    catch(Exception e) {
    sLog.debug("executeQueryForCollection: Userid = " + userId);
    if (bindParams != null)
    for (int j = 0; j < bindParams.length; j++)
    Object[] bindParam = (Object[])bindParams[j];
    if ("p_user_id".equals(bindParam[0])) {
    sLog.debug("executeQueryForCollection: found bind param p_user_id, setting value to " + userId);
    bindParam[1] = userId;
    if ("p_emp_id".equals(bindParam[0])) {
    sLog.debug("executeQueryForCollection: found bind param p_emp_id, setting value to " + employeeNumber_from_LDAP);
    bindParam[1] = employeeNumber_from_LDAP;
    if ("p_std_id".equals(bindParam[0])) {
    sLog.debug("executeQueryForCollection: found bind param p_std_id, setting value to " + studentNumber_from_LDAP);
    bindParam[1] = studentNumber_from_LDAP;
    super.executeQueryForCollection(Object, bindParams, i);
    Thanks
    Syed

  • How can i set the dynamic text box to show variable value?

    In AS2, I can make a dynamic text box set a var name, when i
    use button set/change the var value, this textbox can show the
    value also.
    but In AS3, dynamic text box can't add var name. than how can
    i do it now?

    Set an instance name for the dynamic textfield. Then, to
    populate the textfield with the value of a variable, use:
    textFieldInstanceName.text = variableName

Maybe you are looking for

  • Can't download file from iCloud

    Hello. I can't download my Keynote project from iCloud. What do i need to do? Help, please!

  • X and y co-ordinates - how to get rid of them??

    Hello When I click and hold to drag an object I keep getting a little box just under the arrow which details the x and y co-ordinates. How do I get rid of this? I can't figure out how to do it but I'm sure there must be a way! Thanks

  • HR Reports

    I am creating HR report using pnp LDB selection screen, In this selection screen the selection block titled period is not working ...means i cant sort my data using periods titled selection screen of pnp LDB selection screen...what i should do for th

  • BW - additional field in infoset

    Hi all , I used data source with infoset and I added additional field into infoset . But additional fields did not come to the data source selection screen ( Field list screen ).  Is there a way to do this ? Can anyone help me ? Thnks a lot ..

  • Following your instructions for fixing problems after downloading firefox 4 made it completely unusable, not even able to connect for feedback.

    I was having with internet and web connections just stopping or freezing after downloading firefox4. I tried following your dirrections that said to turn it off then back on. It turned off but would not go back on. I couldn't connect to anything so w