Guest User

Untitled

a guest
Dec 26th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.29 KB | None | 0 0
  1. import javax.swing.ButtonGroup;
  2. //import javax.swing.ButtonModel;
  3. import javax.swing.JButton;
  4. //import javax.swing.JComboBox;
  5. import javax.swing.JFrame;
  6. //import javax.swing.JLabel;
  7. //import javax.swing.JPanel;
  8. //import javax.swing.JSpinner;
  9. //import javax.swing.SpinnerModel;
  10. //import javax.swing.SpinnerNumberModel;
  11. import javax.swing.JRadioButton;
  12. import java.awt.Font;
  13. import java.awt.event.ActionEvent;
  14. import java.awt.event.ActionListener;
  15. import java.awt.event.ItemEvent;
  16. import java.awt.event.ItemListener;
  17.  
  18. //import java.awt.event.ActionListener;
  19. //import java.awt.event.ActionEvent;
  20. import javax.swing.JCheckBox;
  21. import javax.swing.JTextPane;
  22. import javax.swing.JSpinner;
  23. import javax.swing.SpinnerNumberModel;
  24.  
  25. import java.awt.Checkbox;
  26. import java.awt.Component;
  27.  
  28. public class SettingsGUI {
  29. /**
  30. * @wbp.parser.entryPoint
  31. */
  32. public static void Window(main m) {
  33. JFrame jFrame = new JFrame("Curtidor");
  34. jFrame.getContentPane().setEnabled(false);
  35. jFrame.setSize(261, 419);
  36. jFrame.setResizable(false);
  37. jFrame.getContentPane().setLayout(null);
  38.  
  39. JRadioButton rdbtnLeather = new JRadioButton("Leather");
  40. rdbtnLeather.setSelected(true);
  41. rdbtnLeather.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  42. rdbtnLeather.setBounds(6, 25, 109, 23);
  43. jFrame.getContentPane().add(rdbtnLeather);
  44.  
  45. JRadioButton rdbtnHardLeather = new JRadioButton("Hard Leather");
  46. rdbtnHardLeather.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  47. rdbtnHardLeather.setBounds(128, 25, 109, 23);
  48. jFrame.getContentPane().add(rdbtnHardLeather);
  49.  
  50. JRadioButton rdbtnGreenDhide = new JRadioButton("Green D'Hide");
  51. rdbtnGreenDhide.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  52. rdbtnGreenDhide.setBounds(6, 51, 109, 23);
  53. jFrame.getContentPane().add(rdbtnGreenDhide);
  54.  
  55. JRadioButton rdbtnBlueDhide = new JRadioButton("Blue D'Hide");
  56. rdbtnBlueDhide.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  57. rdbtnBlueDhide.setBounds(128, 51, 109, 23);
  58. jFrame.getContentPane().add(rdbtnBlueDhide);
  59.  
  60. JRadioButton rdbtnRedDhide = new JRadioButton("Red D'Hide");
  61. rdbtnRedDhide.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  62. rdbtnRedDhide.setBounds(6, 77, 109, 23);
  63. jFrame.getContentPane().add(rdbtnRedDhide);
  64.  
  65. JRadioButton rdbtnBlackDhide = new JRadioButton("Black D'Hide");
  66. rdbtnBlackDhide.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  67. rdbtnBlackDhide.setBounds(128, 77, 109, 23);
  68. jFrame.getContentPane().add(rdbtnBlackDhide);
  69.  
  70. JCheckBox chckbxAutoGE = new JCheckBox("Auto G/E");
  71. chckbxAutoGE.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  72. chckbxAutoGE.setBounds(6, 204, 109, 23);
  73. jFrame.getContentPane().add(chckbxAutoGE);
  74.  
  75. JTextPane txtpnSelectWhatYou = new JTextPane();
  76. txtpnSelectWhatYou.setEditable(false);
  77. txtpnSelectWhatYou.setFont(new Font("Century Gothic", Font.PLAIN, 13));
  78. txtpnSelectWhatYou.setText("Select what to tan:");
  79. txtpnSelectWhatYou.setBounds(6, 5, 239, 23);
  80. jFrame.getContentPane().add(txtpnSelectWhatYou);
  81.  
  82. JTextPane txtpnSelectALocation = new JTextPane();
  83. txtpnSelectALocation.setEditable(false);
  84. txtpnSelectALocation.setText("Select a location:");
  85. txtpnSelectALocation.setFont(new Font("Century Gothic", Font.PLAIN, 13));
  86. txtpnSelectALocation.setBounds(6, 107, 239, 23);
  87. jFrame.getContentPane().add(txtpnSelectALocation);
  88.  
  89. JCheckBox chckbxEnableMule = new JCheckBox("Enable Mule");
  90. chckbxEnableMule.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  91. chckbxEnableMule.setBounds(128, 204, 109, 23);
  92. jFrame.getContentPane().add(chckbxEnableMule);
  93.  
  94. JTextPane txtpnMiscOptions = new JTextPane();
  95. txtpnMiscOptions.setText("Misc. options:");
  96. txtpnMiscOptions.setFont(new Font("Century Gothic", Font.PLAIN, 13));
  97. txtpnMiscOptions.setEditable(false);
  98. txtpnMiscOptions.setBounds(6, 181, 239, 23);
  99. jFrame.getContentPane().add(txtpnMiscOptions);
  100.  
  101. JRadioButton rdbtnAlKharid = new JRadioButton("Al Kharid");
  102. rdbtnAlKharid.setSelected(true);
  103. rdbtnAlKharid.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  104. rdbtnAlKharid.setBounds(6, 128, 109, 23);
  105. jFrame.getContentPane().add(rdbtnAlKharid);
  106.  
  107. JRadioButton rdbtnCraftingGuild = new JRadioButton("Crafting Guild");
  108. rdbtnCraftingGuild.setEnabled(false);
  109. rdbtnCraftingGuild.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  110. rdbtnCraftingGuild.setBounds(128, 129, 109, 23);
  111. jFrame.getContentPane().add(rdbtnCraftingGuild);
  112.  
  113. JRadioButton rdbtnRangingGuild = new JRadioButton("Ranging Guild");
  114. rdbtnRangingGuild.setEnabled(false);
  115. rdbtnRangingGuild.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  116. rdbtnRangingGuild.setBounds(6, 154, 109, 23);
  117. jFrame.getContentPane().add(rdbtnRangingGuild);
  118.  
  119. JRadioButton rdbtnCanifis = new JRadioButton("Canifis");
  120. rdbtnCanifis.setEnabled(false);
  121. rdbtnCanifis.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  122. rdbtnCanifis.setBounds(128, 155, 109, 23);
  123. jFrame.getContentPane().add(rdbtnCanifis);
  124.  
  125. ButtonGroup group = new ButtonGroup();
  126. group.add(rdbtnHardLeather);
  127. group.add(rdbtnLeather);
  128. group.add(rdbtnGreenDhide);
  129. group.add(rdbtnBlueDhide);
  130. group.add(rdbtnRedDhide);
  131. group.add(rdbtnBlackDhide);
  132.  
  133. ButtonGroup group2 = new ButtonGroup();
  134. group2.add(rdbtnAlKharid);
  135. group2.add(rdbtnCraftingGuild);
  136. group2.add(rdbtnRangingGuild);
  137. group2.add(rdbtnCanifis);
  138.  
  139. JSpinner spinnerHides = new JSpinner();
  140. spinnerHides.setModel(new SpinnerNumberModel(1600, 1, 10000, 50));
  141. spinnerHides.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  142. spinnerHides.setBounds(6, 260, 109, 20);
  143. jFrame.getContentPane().add(spinnerHides);
  144.  
  145. JTextPane txtpnMaxAmountOf = new JTextPane();
  146. txtpnMaxAmountOf.setText("Max amount of hides to buy:");
  147. txtpnMaxAmountOf.setFont(new Font("Century Gothic", Font.PLAIN, 13));
  148. txtpnMaxAmountOf.setEditable(false);
  149. txtpnMaxAmountOf.setBounds(6, 234, 239, 23);
  150. jFrame.getContentPane().add(txtpnMaxAmountOf);
  151.  
  152. //
  153. JButton btnStartButton = new JButton("Start");
  154. btnStartButton.setFont(new Font("Century Gothic", Font.PLAIN, 12));
  155. btnStartButton.setBounds(75, 356, 89, 23);
  156. jFrame.getContentPane().add(btnStartButton);
  157. //
  158. jFrame.setVisible(true);
  159.  
  160. /*chckbxAutoGE.addActionListener(e -> {
  161. if (chckbxAutoGE.isSelected()) {
  162. spinnerHides.setEnabled(true);
  163. } else {
  164. spinnerHides.setEnabled(false);
  165. }
  166. });*/
  167.  
  168. chckbxAutoGE.addItemListener(new ItemListener() {
  169. @Override
  170. public void itemStateChanged(ItemEvent e) {
  171. if(e.getStateChange() == ItemEvent.SELECTED){
  172. spinnerHides.setEnabled(true);
  173. }
  174. if(e.getStateChange() == ItemEvent.DESELECTED){
  175. spinnerHides.setEnabled(false);
  176. }
  177. }
  178. });
  179.  
  180. btnStartButton.addActionListener(e -> {
  181.  
  182. if (rdbtnLeather.isSelected()) {
  183. m.hideOption = "Soft leather";
  184. m.hideUsed = "Cowhide";
  185. m.hideCreated = "Leather";
  186. m.hideUsedPaintName = "Cowhide";
  187. m.hidePaintName = "Leather";
  188. m.hideIdSelling = 1741;
  189. m.hideIdRaw = 1739;
  190. m.tanningCost = 1;
  191. m.buyAbove = 60;
  192. }
  193. if (rdbtnHardLeather.isSelected()) {
  194. m.hideOption = "Hard leather";
  195. m.hideUsed = "Cowhide";
  196. m.hideCreated = "Hard leather";
  197. m.hideUsedPaintName = "Cowhide";
  198. m.hidePaintName = "Hard Leather";
  199. m.hideIdSelling = 1743;
  200. m.hideIdRaw = 1739;
  201. m.tanningCost = 3;
  202. m.buyAbove = 60;
  203. }
  204. if (rdbtnGreenDhide.isSelected()) {
  205. m.hideOption = "Green d'hide";
  206. m.hideUsed = "Green dragonhide";
  207. m.hideCreated = "Green dragon leather";
  208. m.hideUsedPaintName = "Green Dragonhide";
  209. m.hidePaintName = "Green Dragon Leather";
  210. m.hideIdSelling = 1745;
  211. m.hideIdRaw = 1753;
  212. m.tanningCost = 20;
  213. m.buyAbove = 200;
  214. }
  215. if (rdbtnBlueDhide.isSelected()) {
  216. m.hideOption = "Blue d'hide";
  217. m.hideUsed = "Blue dragonhide";
  218. m.hideCreated = "Blue dragon leather";
  219. m.hideUsedPaintName = "Blue Dragonhide";
  220. m.hidePaintName = "Blue Dragon Leather";
  221. m.hideIdSelling = 2505;
  222. m.hideIdRaw = 1751;
  223. m.tanningCost = 20;
  224. m.buyAbove = 200;
  225. }
  226. if (rdbtnRedDhide.isSelected()) {
  227. m.hideOption = "Red d'hide";
  228. m.hideUsed = "Red dragonhide";
  229. m.hideCreated = "Red dragon leather";
  230. m.hideUsedPaintName = "Red Dragonhide";
  231. m.hidePaintName = "Red Dragon Leather";
  232. m.hideIdSelling = 2507;
  233. m.hideIdRaw = 1749;
  234. m.tanningCost = 20;
  235. m.buyAbove = 200;
  236. }
  237. if (rdbtnBlackDhide.isSelected()) {
  238. m.hideOption = "Black d'hide";
  239. m.hideUsed = "Black dragonhide";
  240. m.hideCreated = "Black dragon leather";
  241. m.hideUsedPaintName = "Black Dragonhide";
  242. m.hidePaintName = "Black Dragon Leather";
  243. m.hideIdSelling = 2509;
  244. m.hideIdRaw = 1747;
  245. m.tanningCost = 20;
  246. m.buyAbove = 200;
  247. }
  248. if (chckbxAutoGE.isSelected()) {
  249. m.autoGE = true;
  250. }
  251. if (!chckbxAutoGE.isSelected()) {
  252. m.autoGE = false;
  253. }
  254. if (chckbxEnableMule.isSelected()) {
  255. m.muleEnabled = true;
  256. }
  257. if (!chckbxEnableMule.isSelected()) {
  258. m.muleEnabled = false;
  259. }
  260.  
  261. m.start = true;
  262. jFrame.setVisible(false);
  263. });
  264. }
  265.  
  266. public boolean isShowing(JFrame window) {
  267. if (window.isShowing()) {
  268. return true;
  269. } else {
  270. return false;
  271. }
  272. }
  273. }
  274. // ** add: GUI.Window(this); in the main class in the method: onStart
Advertisement
Add Comment
Please, Sign In to add comment