Guest Apogee Posted April 18, 2014 Share Posted April 18, 2014 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 More sharing options...
Novak Posted April 18, 2014 Share Posted April 18, 2014 (edited) 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 } Edited April 18, 2014 by novak80 Link to comment Share on other sites More sharing options...
Guest Apogee Posted April 18, 2014 Share Posted April 18, 2014 (edited) 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 April 18, 2014 by Bitter Link to comment Share on other sites More sharing options...
Isolate Posted April 18, 2014 Share Posted April 18, 2014 What should i use then? 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 so if(Inventory.contains("Bones"){ if(BuryBones){ /*Bury Bones*/ }else{ /*Drop Bones*/ } } (code might not be exact from this API but logic should work 1 Link to comment Share on other sites More sharing options...
Novak Posted April 18, 2014 Share Posted April 18, 2014 What should i use then? you should be writing it yourself, as swing is not that hard to learn at all. Using programs to do it for you is bad and you don't really learn anything, not to mention they usually use bad conventions/sloppy code Link to comment Share on other sites More sharing options...