Jump to content

JFormDesigner ComboBox1


Guest Apogee

Recommended Posts

Guest Apogee

I've recently implemented a GUI into the script i'm working on. I've built the GUI to my liking, however actually coding in the different parts of the GUI is difficult for me. I've spent hours playing with it.

My question is:

How can i make a selection in comboBox1 affect what happens in-game?

Example(which i know is wrong.): if comboBox1 = Bury bones {
                                                           client.burybones(lol)

                                                    } else {

                                                           client.dropbones

                                                    }

 

Given, that code is completely fake. It is just an example to help you understand what i want to do through code.

I'd really appreciate if somebody could show me example code, or explain how to do what i need to do.

Thanks!

 

 

 

 

 

PS: I looked all through google and the OSBot forums for this. I couldn't find it anywhere.

Link to comment
Share on other sites

Guest Apogee

 

dont use jformdesigner, the code is sloppy and you wont learn anything.  Now for the combobox, try 

String string = combobox.getSelectedItem().toString();

if(string.equals("Bury bones") {

do shit

}

 

 

What should i use then? :p

Edited by Bitter
Link to comment
Share on other sites

What should i use then? tongue.png

Use a radiobutton

 

and then 

Boolean BuryBones = false;

so

private void radioButton1ActionPerformed(ActionEvent e) {
		if(BuryBones = false){
                  BuryBones = true;
                   }else{
                    BuryBones = false;
            }

	}

so when its false the first time it gets ticked and becomes true, than if they click it again its unticked again and false again :D

so

if(Inventory.contains("Bones"){
if(BuryBones){
   /*Bury Bones*/
}else{
   /*Drop Bones*/
}
}

(code might not be exact from this API but logic should work

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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