Jump to content

Error Using GUI [Client Crashing]


Recommended Posts

Posted
        // Create a select box for tree options
        JComboBox<String> treeSelector = new JComboBox<>(new String[]{"Tree", "Oak"});

        // Add an action listener, to listen for user's selections, assign to a variable called selectedTree on selection.
        treeSelector.addActionListener(e -> selectedTree = treeSelector.getSelectedItem().toString());

I was using this code, but if I choose 'Tree' the client crashes, well, the CPU goes to 100% and I have to force quit, but if I choose 'Oak' then it works perfectly fine. I added another option in front of 'Tree' and now 'Tree' works in second position but the 'Oak' options is now causing the problem.

Posted (edited)
        // Create a select box for tree options
        JComboBox<String> treeSelector = new JComboBox<>(new String[]{"Tree", "Oak"});

        // Add an action listener, to listen for user's selections, assign to a variable called selectedTree on selection.
        treeSelector.addActionListener(e -> selectedTree = treeSelector.getSelectedItem().toString());

I was using this code, but if I choose 'Tree' the client crashes, well, the CPU goes to 100% and I have to force quit, but if I choose 'Oak' then it works perfectly fine. I added another option in front of 'Tree' and now 'Tree' works in second position but the 'Oak' options is now causing the problem.

 

 

Probably something else in your code. You should really learn what a NullPointerException is though...

Edited by Explv
Posted

 

Edited from original comment.

 

Pls learn Java. Why are you doing this in onLoop ?:

switch (state) {
            case CHOP:
                new Chop(this);
                break;
            case DROP:
                new Drop(this);
                break;
            case IN_COMBAT:
                new InCombat(this);
            default:
                break;
        }

 

 

Thank I managed to get it working now.

 

It might work but you are still doing a lot of things incorrectly

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...