Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:48:38+00:00 2026-05-27T06:48:38+00:00

The code below works great for when the user assigns the total amount of

  • 0

The code below works great for when the user assigns the total amount of stat points I allocate. However, I would love to only disable the plus button, so they could lower a stat value and then add again.

if ((strengthModel.getNumber().intValue()) + (constitutionModel.getNumber().intValue()) + (dexterityModel.getNumber().intValue()) + (intelligenceModel.getNumber().intValue()) > 49){
     strengthSpinner.setEnabled(false);
     constitutionSpinner.setEnabled(false);
     dexteritySpinner.setEnabled(false);
     intelligenceSpinner.setEnabled(false);
}

Is that possible with int spinners? I did not see it in the docs.

EDIT Bit more info: You can spread your stat points around or assign them all to one stat. The max on each of the models is all 10 of the un-used points.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:48:39+00:00Added an answer on May 27, 2026 at 6:48 am

    For anyone who finds this thread here is how I solved my issue:

    public void stateChanged(ChangeEvent e) {
        Component[] components = characterCreationPanel.getComponents();
        Component component = null; 
        strengthValue = strengthModel.getNumber().intValue();
        constitutionValue = constitutionModel.getNumber().intValue();
        dexterityValue = dexterityModel.getNumber().intValue();
        intelligenceValue = intelligenceModel.getNumber().intValue();
        for (int i = 0; i < components.length; i++)
        {
            component = components[i];
            if (component instanceof JLabel){
                if (((JLabel) component).getText().substring(0, 5).equals("Stat ")){
                    ((JLabel) component).setText("Stat Points Left: " + Integer.toString(50 - (strengthValue + constitutionValue + dexterityValue + intelligenceValue)));
                    if ((strengthValue + constitutionValue + dexterityValue + intelligenceValue) == 50){
                        System.out.println("Hit your cap.");
                    }
                }       
            }
            strengthModel.setMaximum(50 - (constitutionValue + dexterityValue + intelligenceValue));
            constitutionModel.setMaximum(50 - (strengthValue + dexterityValue + intelligenceValue));
            dexterityModel.setMaximum(50 - (strengthValue + constitutionValue + intelligenceValue));
            intelligenceModel.setMaximum(50 - (strengthValue + constitutionValue + dexterityValue));
        }
    }
    

    Thanks “ziesemer” for the tip with the setMaximium.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below works great. It allows a user to send emails to other
The below code works great except for one condition. If the user is hovering
The code below works great. It allows a user to send a recommendation for
The code below works great. I have a MySQL database that contains book titles
The code below works great except the email has all the text on one
I have to code below - works great in IE and Opera, but does
Directory.CreateDirectory(@C:\test); Works great. I'm able to create the folder. BUT code below doesn't work.
The code below works. But if I comment out the line Dim objRequest As
the code below works fine but it takes an absolute age to run. How
The code below works nicely. Each title in the MySQL table submission is printed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.