Jump to content

Error Using GUI [Client Crashing]


debug

Recommended Posts

        // 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.

Link to comment
Share on other sites

        // 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
Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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