Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.29 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Component;
  3. import java.awt.Container;
  4. import java.awt.Dimension;
  5. import java.awt.Font;
  6. import java.awt.Graphics;
  7. import java.awt.Insets;
  8. import java.awt.LayoutManager;
  9. import java.awt.Point;
  10. import java.awt.event.ActionEvent;
  11. import javax.swing.JButton;
  12. import javax.swing.JComboBox;
  13. import javax.swing.JLabel;
  14. import javax.swing.JTextField;
  15.  
  16.  
  17. import org.rsbot.event.events.ServerMessageEvent;
  18. import org.rsbot.event.listeners.PaintListener;
  19. import org.rsbot.event.listeners.ServerMessageListener;
  20. import org.rsbot.script.Script;
  21. import org.rsbot.script.ScriptManifest;
  22. import org.rsbot.script.methods.Game;
  23. import org.rsbot.script.methods.Skills;
  24. import org.rsbot.script.wrappers.RSGroundItem;
  25. import org.rsbot.script.wrappers.RSTile;
  26.  
  27. @ScriptManifest(authors = { "Petje123" }, name = "Ghoulkiller", version = 1.0, description = "Kills ghouls at the north place")
  28. public class Ghoulkiller extends Script implements PaintListener {
  29.  
  30. RSTile[] bankToGhoul = { new RSTile(3512, 3479), new RSTile(3500, 3483),
  31. new RSTile(3485, 3479), new RSTile(3451, 3487),
  32. new RSTile(3470, 3474), new RSTile(3455, 3481),
  33. new RSTile(3441, 3486), new RSTile(3429, 3496),
  34. new RSTile(3419, 3505), new RSTile(3417, 3509) };
  35. RSTile[] ghoulToBank = { new RSTile(3417, 3509), new RSTile(3426, 3501),
  36. new RSTile(3438, 3494), new RSTile(3451, 3487),
  37. new RSTile(3462, 3478), new RSTile(3477, 3478),
  38. new RSTile(3491, 3483), new RSTile(3505, 3482),
  39. new RSTile(3512, 3479) };
  40. RSTile ghoulTile = new RSTile(3415, 3513);
  41. RSTile bankTile = new RSTile(3512, 3479);;
  42.  
  43. RSGroundItem itegr;
  44. volatile RSGroundItem ite;
  45. int foodb = 0;
  46. int ghoul = 1218;
  47. int food;
  48. int[] items = { 12158, 12163, 12160, 12159, 10266, 10264, 10265, 10263 };
  49. boolean inFight = false;
  50. boolean walkToBank = false;
  51. boolean walkToghoul = false;
  52. public String status;
  53. int trainStatran;
  54. int startStatLvlran;
  55. int startXpran;
  56. int trainStatdef;
  57. int startStatLvldef;
  58. int startXpdef;
  59. int trainStatatt;
  60. int startStatLvlatt;
  61. int startXpatt;
  62. int trainStatstr;
  63. int startStatLvlstr;
  64. int startXpstr;
  65. int htrainStat;
  66. int hstartStatLvl;
  67. int hstartXp;
  68. long startTime = System.currentTimeMillis();
  69. boolean pickup = true;
  70. boolean eat = true;
  71. private gui gui;
  72. JLabel label_1;
  73. JLabel label_2;
  74. JComboBox combobox_1;
  75. JTextField textfield_1;
  76. JLabel label_3;
  77. JLabel label_4;
  78. JComboBox combobox_2;
  79. JLabel label_5;
  80. JComboBox combobox_3;
  81. JLabel label_6;
  82. JComboBox combobox_4;
  83. JButton button_1;
  84. public boolean start = false;
  85. public boolean paint = true;
  86. public String Style;
  87.  
  88. public int loop() {
  89. try {
  90. if (start == true) {
  91. gui.setVisible(false);
  92. }
  93. if (gui.isVisible() == false) {
  94. if (textfield_1.getText().length() == 0) {
  95. if (eat == true) {
  96. log("You need to enter Food ID, if eating is true!");
  97. stopScript();
  98. }
  99. }
  100. if (textfield_1.getText().length() != 0) {
  101. try {
  102. food = Integer.parseInt(textfield_1.getText());
  103. } catch (NumberFormatException e) {
  104. log("Food ID = number!");
  105. stopScript();
  106. }
  107. }
  108. if (walkToghoul == true) {
  109. status = "Walking to ghouls";
  110. if (!getMyPlayer().isMoving()) {
  111. walking.walkPathMM(bankToGhoul, 2, 2);
  112. walkToghoul = false;
  113. }
  114. }
  115. if (walkToBank == true) {
  116. status = "Walking to bank";
  117. if (!getMyPlayer().isMoving()) {
  118. walking.walkPathMM(ghoulToBank, 2, 2);
  119. walkToBank = false;
  120. }
  121. }
  122. if (getMyPlayer().isMoving()) {
  123. antiban();
  124. sleep(180, 220);
  125. }
  126. if (inFight == true) {
  127. antiban();
  128. sleep(180, 220);
  129. }
  130. if (!walking.isRunEnabled()
  131. && (walking.getEnergy() > random(55, 95))) {
  132. walking.setRun(true);
  133. status = "Setting run";
  134. sleep(800, 1000);
  135. } else if (calc.distanceTo(ghoulTile) < 15) {
  136. if (eat == true) {
  137. if (!inventory.contains(food)) {
  138. walkToBank = true;
  139. }
  140. if (combat.getLifePoints() < (skills.getRealLevel(3) * 10) / 2) {
  141. if (inventory.getItem(food).doAction("Eat")) {
  142. status = "Eating...";
  143. sleep(300, 600);
  144. }
  145. }
  146. }
  147. if (inventory.isFull() && eat == false) {
  148. walkToBank = true;
  149. }
  150. if (pickup == true) {
  151. itegr = groundItems.getNearest(items);
  152. if (itegr != null) {
  153. if (itegr != ite) {
  154. if (itegr.isOnScreen()) {
  155. ite = itegr;
  156. if (!inventory.isFull()
  157. && (ite != null)
  158. && getMyPlayer().getInteracting() == null) {
  159. if (ite.doAction("Take")) {
  160. status = "Picking up item..";
  161. sleep(1800, 2300);
  162. }
  163. }
  164. if (inventory.isFull()
  165. && (ite != null)
  166. && getMyPlayer().getInteracting() == null) {
  167. inventory.getItem(food).doAction("Eat");
  168. status = "Eating for space";
  169. sleep(1300, 1600);
  170. if (!inventory.isFull()
  171. && (ite != null)) {
  172. if (ite.doAction("Take")) {
  173. status = "Picking up item..";
  174. sleep(1800, 2300);
  175. }
  176. }
  177. }
  178. } else {
  179. ite = null;
  180. }
  181. }
  182. } else if (ite != null) {
  183. ite = null;
  184. }
  185. }
  186. if (getMyPlayer().getAnimation() != -1
  187. && getMyPlayer().getInteracting() != null) {
  188. status = "Fighting...";
  189. inFight = true;
  190. }
  191. if (getMyPlayer().getAnimation() == -1
  192. && getMyPlayer().getInteracting() == null) {
  193. inFight = false;
  194. }
  195. if (inFight == false) {
  196. attack();
  197. }
  198. } else if (calc.distanceTo(bankTile) < 5) {
  199. if (eat == true) {
  200. if (!inventory.contains(food)) {
  201. status = "No food, taking some...";
  202. useBank();
  203. }
  204. if (inventory.contains(food)) {
  205. walkToghoul = true;
  206. }
  207. }
  208. if (eat == false) {
  209. if (inventory.getCount() != 0) {
  210. useBank();
  211. }
  212. if (inventory.getCount() == 0) {
  213. walkToghoul = true;
  214. }
  215. }
  216. }
  217. }
  218. } catch (Exception e) {
  219. }
  220. return 0;
  221. }
  222.  
  223. public int useBank() {
  224. try {
  225. if (!bank.isOpen()) {
  226. bank.open();
  227. sleep(700, 1400);
  228. } else if (bank.isOpen()) {
  229. status = "Banking";
  230. sleep(500, 1200);
  231. if (inventory.getCount() != 0) {
  232. bank.depositAll();
  233. sleep(500, 700);
  234. }
  235. if (eat == false && inventory.getCount() == 0) {
  236. bank.close();
  237. }
  238. if (eat == true) {
  239. if (bank.getCount(food) == 0) {
  240. bank.close();
  241. sleep(1000, 2000);
  242. foodb++;
  243. log("Out of food +1 time(s)");
  244. if (foodb > 5) {
  245. log("Out of food, more than 5 times. stopScript();");
  246. stopScript();
  247. }
  248. } else {
  249. bank.withdraw(food, 0);
  250. sleep(1000, 1300);
  251. foodb = 0;
  252. }
  253. }
  254. }
  255. } catch (Exception e) {
  256. }
  257. return 1200;
  258. }
  259.  
  260. public boolean onStart() {
  261. if (!game.isLoggedIn()) {
  262. log("Please log in before starting the script!");
  263. return false;
  264. }
  265. gui = new gui();
  266. gui.setVisible(true);
  267. mouse.setSpeed(random(4, 5));
  268. log("Starting Ghoulkiller");
  269. trainStatran = Skills.RANGE;
  270. startStatLvlran = skills.getCurrentLevel(trainStatatt);
  271. startXpran = skills.getCurrentExp(trainStatatt);
  272. trainStatatt = Skills.ATTACK;
  273. startStatLvlatt = skills.getCurrentLevel(trainStatatt);
  274. startXpatt = skills.getCurrentExp(trainStatatt);
  275. trainStatdef = Skills.DEFENSE;
  276. startStatLvldef = skills.getCurrentLevel(trainStatdef);
  277. startXpdef = skills.getCurrentExp(trainStatdef);
  278. trainStatstr = Skills.STRENGTH;
  279. startStatLvlstr = skills.getCurrentLevel(trainStatstr);
  280. startXpstr = skills.getCurrentExp(trainStatstr);
  281. htrainStat = Skills.CONSTITUTION;
  282. hstartStatLvl = skills.getCurrentLevel(Skills.CONSTITUTION);
  283. hstartXp = skills.getCurrentExp(Skills.CONSTITUTION);
  284. return true;
  285. }
  286.  
  287. public void onRepaint(Graphics g) {
  288. if (game.isLoggedIn()) {
  289. if (start == true && paint == true) {
  290. Point m = mouse.getLocation();
  291. g.setColor(Color.red);
  292. g.drawRoundRect(m.x - 6, m.y, 14, 2, 5, 5);
  293. g.drawRoundRect(m.x, m.y - 6, 2, 14, 5, 5);
  294. g.setColor(Color.red);
  295. g.fillRoundRect(m.x - 6, m.y, 14, 2, 5, 5);
  296. g.fillRoundRect(m.x, m.y - 6, 2, 14, 5, 5);
  297. double millis = System.currentTimeMillis() - startTime;
  298. int hlevelChange = skills.getCurrentLevel(htrainStat)
  299. - hstartStatLvl;
  300. int hxpChange = skills.getCurrentExp(htrainStat) - hstartXp;
  301. int hclvl = skills.getCurrentLevel(htrainStat);
  302. int hxpPerHour = (int) ((hxpChange / millis) * (1000 * 3600));
  303. int alevelChange = skills.getCurrentLevel(trainStatatt)
  304. - startStatLvlatt;
  305. int axpChange = skills.getCurrentExp(trainStatatt) - startXpatt;
  306. int aclvl = skills.getCurrentLevel(trainStatatt);
  307. int axpPerHour = (int) ((axpChange / millis) * (1000 * 3600));
  308. int slevelChange = skills.getCurrentLevel(trainStatstr)
  309. - startStatLvlstr;
  310. int sxpChange = skills.getCurrentExp(trainStatstr) - startXpstr;
  311. int sclvl = skills.getCurrentLevel(trainStatstr);
  312. int sxpPerHour = (int) ((sxpChange / millis) * (1000 * 3600));
  313. int dlevelChange = skills.getCurrentLevel(trainStatdef)
  314. - startStatLvldef;
  315. int dxpChange = skills.getCurrentExp(trainStatdef) - startXpdef;
  316. int dclvl = skills.getCurrentLevel(trainStatdef);
  317. int dxpPerHour = (int) ((dxpChange / millis) * (1000 * 3600));
  318. int rlevelChange = skills.getCurrentLevel(trainStatran)
  319. - startStatLvlran;
  320. int rxpChange = skills.getCurrentExp(trainStatran) - startXpran;
  321. int rclvl = skills.getCurrentLevel(trainStatran);
  322. int rxpPerHour = (int) ((rxpChange / millis) * (1000 * 3600));
  323. String time = formatTime((int) (millis / 1000));
  324. g.setColor(new Color(0, 0, 0, 150));
  325. g.draw3DRect(5, 30, 210, 150, true);
  326. g.fill3DRect(5, 30, 210, 150, true);
  327. g.setColor(Color.red);
  328. g.setFont(new Font("Comic Sans MS", Font.PLAIN, 11));
  329. g.drawString("Ghoulkiller, by petje", 8, 30);
  330. g.setFont(new Font("Comic Sans MS", Font.PLAIN, 11));
  331. g.setColor(Color.white);
  332. g.drawString("Version 1.0", 8, 40);
  333. g.setColor(Color.white);
  334. g.setFont(new Font("Comic Sans MS", Font.PLAIN, 11));
  335. g.drawString("Status: " + status, 8, 55);
  336. g.setColor(Color.cyan);
  337. if (combobox_4.getSelectedItem().toString().contains("Attack")) {
  338. g.drawString("Attack lvl: " + aclvl + " (" + alevelChange
  339. + ")", 8, 80);
  340. g.drawString("Attack XP Gained: " + axpChange, 8, 90);
  341. g.drawString("Attack XP/H: " + axpPerHour, 8, 100);
  342. }
  343. if (combobox_4.getSelectedItem().toString()
  344. .contains("Strength")) {
  345. g.drawString("Strength lvl: " + sclvl + " (" + slevelChange
  346. + ")", 8, 80);
  347. g.drawString("Strength XP Gained: " + sxpChange, 8, 90);
  348. g.drawString("Strength XP/H: " + sxpPerHour, 8, 100);
  349. }
  350. if (combobox_4.getSelectedItem().toString().contains("Defense")) {
  351. g.drawString("Defense lvl: " + dclvl + " (" + dlevelChange
  352. + ")", 8, 80);
  353. g.drawString("Defense XP Gained: " + dxpChange, 8, 90);
  354. g.drawString("Defense XP/H: " + dxpPerHour, 8, 100);
  355. }
  356. if (combobox_4.getSelectedItem().toString().contains("Ranged")) {
  357. g.drawString("Ranged lvl: " + rclvl + " (" + rlevelChange
  358. + ")", 8, 80);
  359. g.drawString("Ranged XP Gained: " + rxpChange, 8, 90);
  360. g.drawString("Ranged XP/H: " + rxpPerHour, 8, 100);
  361. }
  362. g.setColor(Color.red);
  363. g.drawString("Hitpoints lvl: " + hclvl + " (" + hlevelChange
  364. + ")", 8, 125);
  365. g.drawString("Hitpoints XP Gained: " + hxpChange, 8, 135);
  366. g.drawString("Hitpoints XP/H: " + hxpPerHour, 8, 145);
  367. g.setColor(Color.white);
  368. g.drawString("Runtime: " + time, 8, 165);
  369. }
  370. }
  371. }
  372.  
  373. String formatTime(int seconds) {
  374. return (((int) seconds / 3600 < 10 ? "0" : "") + (int) seconds / 3600
  375. + ":" + ((int) seconds / 60 % 60 < 10 ? "0" : "")
  376. + (int) seconds / 60 % 60 + ":"
  377. + ((int) seconds % 60 < 10 ? "0" : "") + (int) seconds % 60);
  378. }
  379.  
  380. public void serverMessageRecieved(ServerMessageEvent e) {
  381. final String serverString = e.getMessage();
  382. if (serverString.contains("You've just advanced")) {
  383. log("Congrats on level up, Screenshot taken!");
  384. sleep(random(1500, 2500));
  385. if (interfaces.canContinue()) {
  386. interfaces.clickContinue();
  387. }
  388. }
  389.  
  390. }
  391. public void antiban() {
  392. try {
  393. if (getMyPlayer().getInteracting() != null) {
  394. int rndm;
  395. rndm = random(1, 10000);
  396. if (rndm <= 10) {
  397. if (!(game.getCurrentTab() == Game.TAB_STATS)) {
  398. game.openTab(Game.TAB_STATS);
  399. sleep(300, 500);
  400. }
  401. mouse.move(642, 222, 28, 9);
  402. sleep(500, 700);
  403. } else if (rndm <= 40) {
  404. if (!(game.getCurrentTab() == Game.TAB_STATS)) {
  405. sleep(200, 300);
  406. game.openTab(Game.TAB_STATS);
  407. sleep(200, 300);
  408. }
  409. if (Style == "Attack") {
  410. mouse.move(580, 222, 28, 9);
  411. sleep(500, 700);
  412. } else if (Style == "Strength") {
  413. mouse.move(580, 248, 28, 9);
  414. sleep(500, 700);
  415. } else if (Style == "Defence") {
  416. mouse.move(580, 280, 28, 9);
  417. sleep(500, 700);
  418. } else if (Style == "Range") {
  419. mouse.move(580, 306, 28, 9);
  420. sleep(500, 700);
  421. }
  422. } else if (rndm <= 425) {
  423. mouse.moveRandomly(500);
  424. } else if (rndm <= 650) {
  425. camera.setAngle(random(1, 360));
  426. } else if (rndm <= 850) {
  427. mouse.setSpeed(random(4, 5));
  428. } else if (rndm <= 860) {
  429. if (!(game.getCurrentTab() == Game.TAB_STATS)) {
  430. sleep(200, 300);
  431. game.openTab(Game.TAB_STATS);
  432. sleep(200, 300);
  433. }
  434. mouse.move(580, 336, 27, 9);
  435. sleep(500, 700);
  436. } else if (rndm <= 880) {
  437. mouse.moveOffScreen();
  438. }
  439. sleep(100, 200);
  440. } else {
  441. int rndm;
  442. rndm = random(1, 10000);
  443. if (rndm == 10) {
  444. if (!(game.getCurrentTab() == Game.TAB_STATS)) {
  445. game.openTab(Game.TAB_STATS);
  446. sleep(300, 500);
  447. }
  448. mouse.move(642, 222, 28, 9);
  449. sleep(500, 700);
  450. } else if (rndm <= 40) {
  451. if (!(game.getCurrentTab() == Game.TAB_STATS)) {
  452. sleep(200, 300);
  453. game.openTab(Game.TAB_STATS);
  454. sleep(200, 300);
  455. }
  456. if (Style == "Attack") {
  457. mouse.move(580, 222, 28, 9);
  458. sleep(500, 700);
  459. } else if (Style == "Strength") {
  460. mouse.move(580, 248, 28, 9);
  461. sleep(500, 700);
  462. } else if (Style == "Defence") {
  463. mouse.move(580, 280, 28, 9);
  464. sleep(500, 700);
  465. } else if (Style == "Range") {
  466. mouse.move(580, 306, 28, 9);
  467. sleep(500, 700);
  468. }
  469. } else if (rndm <= 425) {
  470. mouse.moveRandomly(500);
  471. } else if (rndm <= 650) {
  472. camera.setAngle(random(1, 360));
  473. } else if (rndm <= 850) {
  474. mouse.setSpeed(random(4, 5));
  475. } else if (rndm <= 950) {
  476. if (!(game.getCurrentTab() == Game.TAB_STATS)) {
  477. sleep(200, 300);
  478. game.openTab(Game.TAB_STATS);
  479. sleep(200, 300);
  480. }
  481. mouse.move(580, 336, 27, 9);
  482. sleep(500, 700);
  483. } else if (rndm <= 980) {
  484. mouse.moveOffScreen();
  485. }
  486. sleep(100, 200);
  487. }
  488. } catch (Exception e) {
  489. }
  490. }
  491.  
  492. public int attack() {
  493. try {
  494. if (!npcs.getNearest(ghoul).isOnScreen()) {
  495. if (npcs.getNearest(ghoul).getHPPercent() != 0) {
  496. if (!getMyPlayer().isMoving()) {
  497. if (walkToBank == false) {
  498. if (walkToghoul == false) {
  499. if (walking.walkTileMM(npcs.getNearest(ghoul,
  500. 2, 2).getLocation())) {
  501. status = ("Walking to nearest ghoul");
  502. attack();
  503. }
  504. }
  505. }
  506. }
  507. }
  508. } else {
  509. if (npcs.getNearest(ghoul).isOnScreen()) {
  510. if (npcs.getNearest(ghoul).getHPPercent() != 0) {
  511. if (getMyPlayer().getInteracting() == null) {
  512. if (walkToBank == false) {
  513. if (walkToghoul == false) {
  514. if (npcs.getNearest(ghoul).doAction(
  515. "Attack")) {
  516. status = "Attacking ghouls";
  517. sleep(1500, 2000);
  518. }
  519. }
  520. }
  521. }
  522. }
  523. }
  524. }
  525. } catch (Exception e) {
  526. }
  527. return 0;
  528. }
  529.  
  530. public class gui extends javax.swing.JFrame {
  531.  
  532. private static final long serialVersionUID = 1L;
  533.  
  534. public gui() {
  535. initComponents();
  536. }
  537.  
  538. private void initComponents() {
  539. aLayout customLayout = new aLayout();
  540. getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
  541. getContentPane().setLayout(customLayout);
  542. label_1 = new JLabel("Ghoulkiller - Petje123");
  543. getContentPane().add(label_1);
  544. label_2 = new JLabel("Food ID:");
  545. getContentPane().add(label_2);
  546. textfield_1 = new JTextField("");
  547. getContentPane().add(textfield_1);
  548. label_3 = new JLabel("Pickup:");
  549. getContentPane().add(label_3);
  550. combobox_1 = new JComboBox();
  551. combobox_1.setModel(new javax.swing.DefaultComboBoxModel(
  552. new String[] { "Yes", "No" }));
  553. getContentPane().add(combobox_1);
  554. label_4 = new JLabel("Eat food:");
  555. getContentPane().add(label_4);
  556. combobox_2 = new JComboBox();
  557. combobox_2.setModel(new javax.swing.DefaultComboBoxModel(
  558. new String[] { "Yes", "No" }));
  559. getContentPane().add(combobox_2);
  560. label_5 = new JLabel("Paint:");
  561. getContentPane().add(label_5);
  562. combobox_3 = new JComboBox();
  563. combobox_3.setModel(new javax.swing.DefaultComboBoxModel(
  564. new String[] { "Yes", "No" }));
  565. getContentPane().add(combobox_3);
  566. label_6 = new JLabel("Paint skill:");
  567. getContentPane().add(label_6);
  568. combobox_4 = new JComboBox();
  569. combobox_4
  570. .setModel(new javax.swing.DefaultComboBoxModel(
  571. new String[] { "Attack", "Strength", "Defense",
  572. "Ranged" }));
  573. getContentPane().add(combobox_4);
  574. button_1 = new JButton("Start!");
  575. getContentPane().add(button_1);
  576. button_1.addActionListener(new java.awt.event.ActionListener() {
  577.  
  578. public void actionPerformed(java.awt.event.ActionEvent evt) {
  579. button_1actionPerformed(evt);
  580. }
  581. });
  582. setSize(getPreferredSize());
  583. }
  584.  
  585. public void button_1actionPerformed(ActionEvent evt) {
  586. if (combobox_1.getSelectedItem().toString().contains("Yes")) {
  587. pickup = true;
  588. }
  589. if (combobox_1.getSelectedItem().toString().contains("No")) {
  590. pickup = false;
  591. }
  592. if (combobox_2.getSelectedItem().toString().contains("Yes")) {
  593. eat = true;
  594. }
  595. if (combobox_2.getSelectedItem().toString().contains("No")) {
  596. eat = false;
  597. }
  598. if (combobox_3.getSelectedItem().toString().contains("No")) {
  599. paint = false;
  600. }
  601. if (combobox_3.getSelectedItem().toString().contains("Yes")) {
  602. paint = true;
  603. }
  604. if (combobox_4.getSelectedItem().toString().contains("Attack")) {
  605. Style = "Attack";
  606. }
  607. if (combobox_4.getSelectedItem().toString().contains("Strength")) {
  608. Style = "Strength";
  609. }
  610. if (combobox_4.getSelectedItem().toString().contains("Defense")) {
  611. Style = "Defense";
  612. }
  613. if (combobox_4.getSelectedItem().toString().contains("Ranged")) {
  614. Style = "Range";
  615. }
  616. start = true;
  617. }
  618.  
  619. @SuppressWarnings("deprecation")
  620. public void main(String args[]) {
  621. gui window = new gui();
  622. window.setTitle("Ghoulkiller");
  623. window.pack();
  624. window.show();
  625. }
  626.  
  627. class aLayout implements LayoutManager {
  628.  
  629. public aLayout() {
  630. }
  631.  
  632. public void addLayoutComponent(String name, Component comp) {
  633. }
  634.  
  635. public void removeLayoutComponent(Component comp) {
  636. }
  637.  
  638. public Dimension preferredLayoutSize(Container parent) {
  639. Dimension dim = new Dimension(0, 0);
  640. Insets insets = parent.getInsets();
  641. dim.width = 110 + insets.left + insets.right;
  642. dim.height = 365 + insets.top + insets.bottom;
  643. return dim;
  644. }
  645.  
  646. public Dimension minimumLayoutSize(Container parent) {
  647. Dimension dim = new Dimension(0, 0);
  648. return dim;
  649. }
  650.  
  651. public void layoutContainer(Container parent) {
  652. Insets insets = parent.getInsets();
  653. Component c;
  654. c = parent.getComponent(0);
  655. if (c.isVisible()) {
  656. c.setBounds(insets.left + 8, insets.top + 8, 88, 24);
  657. }
  658. c = parent.getComponent(1);
  659. if (c.isVisible()) {
  660. c.setBounds(insets.left + 8, insets.top + 40, 88, 24);
  661. }
  662. c = parent.getComponent(2);
  663. if (c.isVisible()) {
  664. c.setBounds(insets.left + 8, insets.top + 64, 88, 24);
  665. }
  666. c = parent.getComponent(3);
  667. if (c.isVisible()) {
  668. c.setBounds(insets.left + 8, insets.top + 88, 88, 24);
  669. }
  670. c = parent.getComponent(4);
  671. if (c.isVisible()) {
  672. c.setBounds(insets.left + 8, insets.top + 112, 88, 24);
  673. }
  674. c = parent.getComponent(5);
  675. if (c.isVisible()) {
  676. c.setBounds(insets.left + 8, insets.top + 136, 88, 24);
  677. }
  678. c = parent.getComponent(6);
  679. if (c.isVisible()) {
  680. c.setBounds(insets.left + 8, insets.top + 160, 88, 24);
  681. }
  682. c = parent.getComponent(7);
  683. if (c.isVisible()) {
  684. c.setBounds(insets.left + 8, insets.top + 184, 88, 24);
  685. }
  686. c = parent.getComponent(8);
  687. if (c.isVisible()) {
  688. c.setBounds(insets.left + 8, insets.top + 208, 88, 24);
  689. }
  690. c = parent.getComponent(9);
  691. if (c.isVisible()) {
  692. c.setBounds(insets.left + 8, insets.top + 232, 88, 24);
  693. }
  694. c = parent.getComponent(10);
  695. if (c.isVisible()) {
  696. c.setBounds(insets.left + 8, insets.top + 256, 88, 24);
  697. }
  698. c = parent.getComponent(11);
  699. if (c.isVisible()) {
  700. c.setBounds(insets.left + 16, insets.top + 288, 72, 24);
  701. }
  702. }
  703. }
  704.  
  705. }
  706. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement