Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Insets;
- import java.awt.Point;
- import java.awt.Polygon;
- import java.awt.Rectangle;
- import org.powerbot.concurrent.Task;
- import org.powerbot.concurrent.strategy.Condition;
- import org.powerbot.concurrent.strategy.Strategy;
- import org.powerbot.game.api.ActiveScript;
- import org.powerbot.game.api.Manifest;
- import org.powerbot.game.api.methods.Calculations;
- import org.powerbot.game.api.methods.Tabs;
- import org.powerbot.game.api.methods.Walking;
- import org.powerbot.game.api.methods.Widgets;
- import org.powerbot.game.api.methods.input.Mouse;
- import org.powerbot.game.api.methods.interactive.Players;
- import org.powerbot.game.api.methods.node.Menu;
- import org.powerbot.game.api.methods.node.SceneEntities;
- import org.powerbot.game.api.methods.tab.Inventory;
- import org.powerbot.game.api.methods.tab.Skills;
- import org.powerbot.game.api.methods.widget.Camera;
- import org.powerbot.game.api.util.Random;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.wrappers.Area;
- import org.powerbot.game.api.wrappers.Tile;
- import org.powerbot.game.api.wrappers.node.SceneObject;
- import org.powerbot.game.api.wrappers.widget.WidgetChild;
- import org.powerbot.game.bot.event.MessageEvent;
- import org.powerbot.game.bot.event.listener.MessageListener;
- import org.powerbot.game.bot.event.listener.PaintListener;
- import java.awt.*;
- import javax.imageio.ImageIO;
- import javax.swing.JFrame;
- import java.io.IOException;
- import java.net.URL;
- import java.util.ArrayList;
- import javax.swing.JLabel;
- import java.awt.Font;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.SwingUtilities;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- /**
- * @author BrownBirdScripts
- * @version 1.00
- * Copyright 2011 - 2012 All Rights Reserved
- * ONLY BrownBird may edit this script, no exception.
- * Website: www.brownbirdscripts.net78.net
- */
- @Manifest(authors = { "BrownBirdScripts" }, name = "BBgoldMiner", description = "Mines gold ore for money.", version = 1.01, website = "http://www.brownbirdscripts.net78.net")
- public class BBgoldMiner extends ActiveScript implements PaintListener, MessageListener{
- //IDS
- final static private int[] goldOreRock = {9720, 9722, 11184, 11183, 11185};
- final static private int bank = 11758;
- final static private int goldOre = 444;
- final static private int craftingDoor = 2647;
- static private int pickaxes;// = { 1265, 1267, 1269, 1271, 1273, 1275};
- //PAINT
- private int startExp = 0;
- private int expGained;
- public int mined;
- public int gems;
- String status = "";
- public long startTime = 0;
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public long last = 0;
- public int expHour = 0;
- //TILES
- private Tile[] pathToBank = new Tile[] { new Tile(2977, 3238, 0),
- new Tile(2978, 3245, 0), new Tile(2978, 3251, 0),
- new Tile(2981, 3258, 0), new Tile(2989, 3267, 0),
- new Tile(2996, 3275, 0), new Tile(3001, 3279, 0),
- new Tile(3005, 3284, 0), new Tile(3006, 3294, 0),
- new Tile(3006, 3306, 0), new Tile(3006, 3314, 0),
- new Tile(3006, 3321, 0), new Tile(3006, 3327, 0),
- new Tile(3007, 3332, 0), new Tile(3007, 3338, 0),
- new Tile(3007, 3345, 0), new Tile(3007, 3352, 0),
- new Tile(3007, 3359, 0), new Tile(3011, 3356, 0)};
- private Tile[] pathToMine = new Tile[] {new Tile(3011, 3356, 0),
- new Tile(3007, 3359, 0), new Tile(3007, 3352, 0),
- new Tile(3007, 3345, 0), new Tile(3007, 3338, 0),
- new Tile(3007, 3332, 0), new Tile(3006, 3327, 0),
- new Tile(3006, 3321, 0), new Tile(3006, 3314, 0),
- new Tile(3006, 3306, 0), new Tile(3006, 3294, 0),
- new Tile(3005, 3284, 0), new Tile(3001, 3279, 0),
- new Tile(2996, 3275, 0), new Tile(2989, 3267, 0),
- new Tile(2981, 3258, 0), new Tile(2978, 3251, 0),
- new Tile(2978, 3245, 0), new Tile(2977, 3238, 0),
- new Tile(2976, 3234, 0),};
- private Tile[] pathToBankCG = new Tile[] { new Tile(2933, 3291, 0), new Tile(2934, 3297, 0),
- new Tile(2936, 3303, 0), new Tile(2942, 3304, 0),
- new Tile(2947, 3300, 0), new Tile(2952, 3296, 0),
- new Tile(2958, 3294, 0), new Tile(2964, 3295, 0),
- new Tile(2970, 3292, 0), new Tile(2975, 3288, 0),
- new Tile(2981, 3292, 0), new Tile(2982, 3298, 0),
- new Tile(2988, 3300, 0), new Tile(2994, 3300, 0),
- new Tile(3000, 3300, 0), new Tile(3000, 3306, 0),
- new Tile(3002, 3312, 0), new Tile(3004, 3318, 0),
- new Tile(3006, 3324, 0), new Tile(3006, 3330, 0),
- new Tile(3006, 3336, 0), new Tile(3007, 3342, 0),
- new Tile(3006, 3348, 0), new Tile(3006, 3354, 0),
- new Tile(3005, 3360, 0), new Tile(3011, 3362, 0),
- new Tile(3013, 3356, 0) };
- private Tile[] pathToMineCG = new Tile[] {
- new Tile(3015, 3355, 0), new Tile(3012, 3361, 0),
- new Tile(3006, 3362, 0), new Tile(3005, 3356, 0),
- new Tile(3007, 3350, 0), new Tile(3006, 3344, 0),
- new Tile(3005, 3338, 0), new Tile(3006, 3332, 0),
- new Tile(3006, 3326, 0), new Tile(3006, 3320, 0),
- new Tile(3004, 3314, 0), new Tile(2999, 3310, 0),
- new Tile(2994, 3305, 0), new Tile(2989, 3300, 0),
- new Tile(2984, 3296, 0), new Tile(2980, 3291, 0),
- new Tile(2975, 3287, 0), new Tile(2969, 3285, 0),
- new Tile(2964, 3289, 0), new Tile(2959, 3293, 0),
- new Tile(2954, 3297, 0), new Tile(2948, 3297, 0),
- new Tile(2942, 3297, 0), new Tile(2936, 3297, 0),
- new Tile(2932, 3292, 0), new Tile(2933, 3290, 0)};
- private Tile[] pathToMiningSpotWalk = new Tile[] { new Tile(2936, 3283, 0), new Tile(2940, 3280, 0)};
- private Tile[] pathTobankingSpotWalk = new Tile[] { new Tile(2934, 3284, 0)};
- private final Area outsideDoor = new Area(new Tile(2930, 3289, 0), new Tile(2936, 3294, 0));
- private final Area craftingArea = new Area(new Tile(2929, 3289, 0), new Tile(2936, 3278, 0));
- private final Area walkBackAreaCG = new Area(new Tile[] {
- new Tile(2932, 3293, 0), new Tile(2938, 3293, 0),
- new Tile(2944, 3294, 0), new Tile(2950, 3294, 0),
- new Tile(2955, 3290, 0), new Tile(2955, 3284, 0),
- new Tile(2960, 3280, 0), new Tile(2966, 3278, 0),
- new Tile(2972, 3276, 0), new Tile(2978, 3274, 0),
- new Tile(2984, 3273, 0), new Tile(2990, 3272, 0),
- new Tile(2996, 3271, 0), new Tile(3002, 3272, 0),
- new Tile(3008, 3274, 0), new Tile(3012, 3279, 0),
- new Tile(3013, 3288, 0), new Tile(3014, 3294, 0),
- new Tile(3014, 3300, 0), new Tile(3015, 3306, 0),
- new Tile(3017, 3312, 0), new Tile(3018, 3318, 0),
- new Tile(3017, 3324, 0), new Tile(3016, 3330, 0),
- new Tile(3016, 3336, 0), new Tile(3017, 3342, 0),
- new Tile(3021, 3347, 0), new Tile(3023, 3353, 0),
- new Tile(3023, 3359, 0), new Tile(3021, 3365, 0),
- new Tile(3015, 3366, 0), new Tile(3009, 3365, 0),
- new Tile(3003, 3362, 0), new Tile(2998, 3358, 0),
- new Tile(2994, 3353, 0), new Tile(2988, 3351, 0),
- new Tile(2982, 3349, 0), new Tile(2976, 3348, 0),
- new Tile(2970, 3347, 0), new Tile(2964, 3346, 0),
- new Tile(2959, 3342, 0), new Tile(2954, 3338, 0),
- new Tile(2948, 3334, 0), new Tile(2943, 3330, 0),
- new Tile(2938, 3326, 0), new Tile(2933, 3321, 0),
- new Tile(2929, 3316, 0), new Tile(2928, 3310, 0),
- new Tile(2929, 3304, 0), new Tile(2927, 3298, 0)
- });
- private final Area walkToAreaCG = new Area(new Tile(2933, 3289, 0), new Tile(3017, 3362, 0));
- private final Area miningAreaCG = new Area(new Tile(2937, 3285, 0), new Tile(2944, 3275, 0));
- private final Area bankArea = new Area(new Tile(3009, 3358, 0), new Tile(3018, 3355, 0));
- @Override
- protected void setup() {
- startTime = System.currentTimeMillis();
- startExp = Skills.getExperience(Skills.MINING);
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- MinerGUI g = new MinerGUI();
- g.setVisible(true);
- }
- });
- }
- private class mineGold implements Task, Condition {
- @Override
- public void run() {
- if(SceneEntities.getNearest(goldOreRock).isOnScreen()){
- status = "Mining Gold Ore...";
- if(SceneEntities.getNearest(goldOreRock).validate()){
- final SceneObject LS = SceneEntities.getNearest(goldOreRock);
- if (LS != null) {
- if (Calculations.distance(Players.getLocal().getLocation(),
- LS.getLocation()) > 4) {
- Walking.walk(getNextPathTile(LS.getLocation().derive(
- Random.nextInt(-3, 3), Random.nextInt(-3, 3))));
- } else {
- interact(LS, "Mine");
- Time.sleep(Random.nextInt(3000, 5000));
- }
- }
- }
- }
- }
- @Override
- public boolean validate() {
- return (Tabs.INVENTORY.open() && Players.getLocal().getAnimation() == -1);
- }
- }
- private class mineGoldCG implements Task, Condition {
- @Override
- public void run() {
- if(miningAreaCG.contains(Players.getLocal().getLocation())) {
- if(SceneEntities.getNearest(goldOreRock).isOnScreen()){
- status = "Mining Gold Ore...";
- if(SceneEntities.getNearest(goldOreRock).validate()){
- final SceneObject LS = SceneEntities.getNearest(goldOreRock);
- if (LS != null) {
- Camera.turnTo(LS);
- interact(LS, "Mine");
- Time.sleep(Random.nextInt(1600, 1800));
- if(Players.getLocal().getAnimation() == 624){
- Time.sleep(Random.nextInt(2000, 3000));
- }
- }
- }
- }
- }
- }
- @Override
- public boolean validate() {
- return (Tabs.INVENTORY.open() && Inventory.getCount() < 28 && Players.getLocal().getAnimation() == -1);
- }
- }
- private class walkToBankRigg implements Task, Condition {
- @Override
- public void run() {
- status = "Walking to bank";
- walkPath(pathToBank);
- }
- @Override
- public boolean validate() {
- return (Inventory.getCount() >=28 && Players.getLocal().getAnimation() == -1);
- }
- }
- private class walkToBankCG implements Task, Condition {
- @Override
- public void run() {
- if(walkToAreaCG.contains(Players.getLocal().getLocation()) && (Inventory.getCount() == 28)) {
- status = "Walking to bank";
- walkPath(pathToBankCG);
- }
- }
- @Override
- public boolean validate() {
- return (Inventory.getCount() >=28);
- }
- }
- private class useBank implements Task, Condition {
- @Override
- public void run() {
- if(bankArea.contains(Players.getLocal().getLocation())) {
- status = "Opening bank";
- final SceneObject LS = SceneEntities.getNearest(bank);
- if (LS != null) {
- if (Calculations.distance(Players.getLocal().getLocation(),
- LS.getLocation()) > 4) {
- Walking.walk(getNextPathTile(LS.getLocation().derive(
- Random.nextInt(-3, 3), Random.nextInt(-3, 3))));
- } else {
- interact(LS, "Bank");
- Time.sleep(Random.nextInt(1000, 2000));
- status = "Despositing items";
- depositAllExcept(pickaxes);
- /* old banking method:
- if(Widgets.get(762, 1).validate() && Inventory.getCount() >= 28) {
- Widgets.get(762, 34).click(true);
- Time.sleep(Random.nextInt(1200, 2000));
- Widgets.get(762, 45).click(true);
- Time.sleep(Random.nextInt(1200, 2000));*/
- }
- }
- }
- }
- @Override
- public boolean validate() {
- return (Inventory.getCount() >= 28 );
- }
- }
- private class walkToMineRigg implements Task, Condition {
- @Override
- public void run() {
- status = "Walking to back to Mine";
- walkPath(pathToMine);
- }
- @Override
- public boolean validate() {
- return (Inventory.getCount(goldOre) == 0 && Players.getLocal().getAnimation() == -1 );
- }
- }
- private class walkToMineCG implements Task, Condition {
- @Override
- public void run() {
- if(walkBackAreaCG.contains(Players.getLocal().getLocation()) && Inventory.getCount(goldOre) == 0 && Players.getLocal().getAnimation() == -1 ){
- status = "Walking to back to Mine";
- walkPath(pathToMineCG);
- }
- }
- @Override
- public boolean validate() {
- return (Players.getLocal().getAnimation() == -1 && Inventory.getCount(goldOre) >= 0 );
- }
- }
- private class Antiban implements Task, Condition {
- @Override
- public void run() {
- switch (Random.nextInt(1, 600)) {
- case 0:
- status = "Antiban";
- Camera.setAngle(Random.nextInt(-180, 180));
- case 119:
- status = "Antiban";
- Camera.setAngle(Random.nextInt(1, 150));
- case 289:
- status = "Antiban";
- Mouse.move(Random.nextInt(1, 500), Random.nextInt(1, 500));
- case 33:
- status = "Antiban";
- Tabs.STATS.open();
- Time.sleep(Random.nextInt(300, 500));
- Widgets.get(320, 3);
- Time.sleep(Random.nextInt(500, 800));
- }
- Time.sleep(Random.nextInt(100, 500));
- }
- @Override
- public boolean validate() {
- return true;
- }
- }
- private boolean openDoor() {
- final SceneObject LS = SceneEntities.getNearest(craftingDoor);
- if (LS != null) {
- Camera.turnTo(LS);
- interact(LS, "Open");
- Time.sleep(Random.nextInt(2002, 3000));
- }
- return false;
- }
- private class openDoor implements Task, Condition {
- @Override
- public void run() {
- if(craftingArea.contains(Players.getLocal().getLocation()) && Inventory.getCount() == 28 && SceneEntities.getNearest(craftingDoor).isOnScreen()) {
- status = "Opening Door";
- openDoor();
- }
- if(outsideDoor.contains(Players.getLocal().getLocation()) && Inventory.getCount() == 0 && SceneEntities.getNearest(craftingDoor).isOnScreen()) {
- status = "Opening Door";
- openDoor();
- }
- }
- @Override
- public boolean validate() {
- return true;
- }
- }
- private class walkToMiningSpot implements Task, Condition {
- @Override
- public void run() {
- if(craftingArea.contains(Players.getLocal().getLocation()) && Inventory.getCount(goldOre) == 0 && Players.getLocal().getAnimation() == -1 ){
- status = "Walking to back to Mine";
- walkPath(pathToMiningSpotWalk);
- }
- }
- @Override
- public boolean validate() {
- return (Inventory.getCount(goldOre) >= 0 && Players.getLocal().getAnimation() == -1 );
- }
- }
- private class walkToBankingspot implements Task, Condition {
- @Override
- public void run() {
- if(miningAreaCG.contains(Players.getLocal().getLocation()) && Inventory.getCount() == 28 && Players.getLocal().getAnimation() == -1){
- status = "Walking to bank";
- walkPath(pathTobankingSpotWalk);
- }
- }
- @Override
- public boolean validate() {
- return (Players.getLocal().getAnimation() == -1 && Inventory.getCount() >= 28);
- }
- }
- public void walkPath(final Tile... path) {
- if (Walking.getEnergy() > Random.nextInt(30, 50)) {
- Walking.setRun(true);
- }
- for (int i = path.length - 1; i >= 0; i--) {
- if (Calculations.distanceTo(path[i]) >= 15) {
- continue;
- }
- if (Walking.walk(path[i])) {
- break;
- }
- }
- }
- private Tile getNextPathTile(final Tile tile) {
- final Tile pos = Players.getLocal().getLocation();
- return new Tile((int) (pos.getX() + (tile.getX() - pos.getX())
- * Random.nextDouble(.75D, .9D)),
- (int) (pos.getY() + (tile.getY() - pos.getY())
- * Random.nextDouble(.75D, .9D)), tile.getPlane());
- }
- private boolean interact(final SceneObject l, final String action) {
- final java.awt.geom.Area a = new java.awt.geom.Area();
- for (final Polygon p : l.getBounds())
- a.add(new java.awt.geom.Area(p));
- final Rectangle bounds = a.getBounds();
- Point p;
- do {
- p = new Point(Random.nextGaussian(bounds.x,
- bounds.x + bounds.width, 20), Random.nextGaussian(bounds.y,
- bounds.y + bounds.height, 20));
- } while (!a.contains(p));
- Mouse.move(p.x, p.y);
- final String[] actions = Menu.getActions();
- if (actions.length > 0 && actions[0].contains(action)) {
- Mouse.click(true);
- return true;
- } else {
- for (final String item : actions) {
- if (item.contains(action)) {
- Mouse.click(false);
- Time.sleep(Random.nextInt(200, 400));
- return Menu.select(item);
- }
- }
- }
- return false;
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(255, 255, 255);
- private final Font font1 = new Font("Gnuolane Free", 0, 20);
- private final Image img1 = getImage("http://i46.tinypic.com/333vmm0.png");
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- Point mLoc = Mouse.getLocation();
- g.setColor(Color.black);
- g.drawLine(mLoc.x, 0, mLoc.x, 502);
- g.drawLine(0, mLoc.y, 764, mLoc.y);
- expGained = Skills.getExperience(Skills.MINING) - startExp;
- expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
- g.drawImage(img1, 1, 339, null);
- g.setFont(font1);
- g.setColor(color1);
- g.drawString(" "+ hours + ":" + minutes + ":" + seconds, 119, 430);
- g.drawString(" "+ expGained, 132, 448);
- g.drawString(" "+ expHour, 107, 469);
- g.drawString(" "+ mined, 324, 430);
- g.drawString(" "+ gems, 327, 450);
- g.drawString(" "+ status, 282, 469);
- }
- public void messageReceived(MessageEvent e) {
- String svrmsg = e.getMessage();
- if (svrmsg.contains("You just found") ) {
- gems++;
- }
- if(svrmsg.contains("You ma")) {
- mined++;
- }
- }
- //Aaimister's code.
- private void depositAllExcept(int... item) {
- ArrayList<Integer> ids = new ArrayList<Integer>();
- int ninvCount = -1;
- int invCount = Inventory.getCount();
- for (int id : item) {
- ids.add(id);
- }
- for (int i = 0; i < 28; i++) {
- WidgetChild slot = Widgets.get(679, 0).getChild(i);
- int slotId = slot.getChildId();
- if (slot.validate() && Inventory.getCount(slotId) > 0) {
- if (!ids.contains(slotId)) {
- for (int tries = 0; tries < 5; tries++) {
- if (Inventory.getCount(slotId) > 1) {
- if (slot.interact("Deposit-All"));
- else
- tries = 5;
- } else {
- if (slot.interact("Deposit"));
- else
- tries = 5;
- }
- Time.sleep(625, 902);
- ninvCount = Inventory.getCount();
- if (invCount > ninvCount) {
- invCount = ninvCount;
- tries = 5;
- }
- }
- }
- }
- }
- }
- class MinerGUI extends JFrame {
- public MinerGUI() {
- initComponents();
- }
- private void startActionPerformed(ActionEvent e) {
- start = new javax.swing.JButton();
- start.setText("Start!");
- dispose();
- }
- private void pickChooseActionPerformed(ActionEvent e) {
- String chosen = pickChoose.getSelectedItem().toString(); {
- if (chosen.equals("Bronze Pickace")) {
- pickaxes = 1265;
- }else{
- if (chosen.equals("Iron Pickaxe")) {
- pickaxes = 1267;
- }else{
- if(chosen.equals("Steel Pickaxe")) {
- pickaxes = 1269;
- }else{
- }
- if(chosen.equals("Mithril Pickaxe")) {
- pickaxes = 1271;
- }else{
- }
- if(chosen.equals("Adamant Pickaxe")) {
- pickaxes = 1273;
- }else{
- }
- if(chosen.equals("Runite Pickaxes")) {
- pickaxes = 1275;
- }else{
- }
- }
- }
- }
- }
- private void MineChooseActionPerformed(ActionEvent e) {
- String chosen = mineChoose.getSelectedItem().toString(); {
- if (chosen.equals("Rimmington")) {
- mineGold mG = new mineGold();
- Strategy mGStrategy = new Strategy(mG, mG);
- provide(mGStrategy);
- walkToBankRigg wBR = new walkToBankRigg();
- Strategy wBRStrategy = new Strategy(wBR, wBR);
- provide(wBRStrategy);
- useBank uB = new useBank();
- Strategy uBStrategy = new Strategy(uB, uB);
- provide(uBStrategy);
- walkToMineRigg wMR = new walkToMineRigg();
- Strategy wMRStrategy = new Strategy(wMR, wMR);
- provide(wMRStrategy);
- Antiban ab = new Antiban();
- Strategy abStrategy = new Strategy(ab, ab);
- provide(abStrategy);
- }else{
- if (chosen.equals("Crafting Guild")) {
- mineGoldCG mG = new mineGoldCG();
- Strategy mGStrategy = new Strategy(mG, mG);
- provide(mGStrategy);
- walkToBankingspot walk = new walkToBankingspot();
- Strategy walkStrategy = new Strategy(walk, walk);
- provide(walkStrategy);
- walkToBankCG wBCG = new walkToBankCG();
- Strategy wBCGRStrategy = new Strategy(wBCG, wBCG);
- provide(wBCGRStrategy);
- useBank uB = new useBank();
- Strategy uBStrategy = new Strategy(uB, uB);
- provide(uBStrategy);
- walkToMineCG wMCG = new walkToMineCG();
- Strategy wMCGStrategy = new Strategy(wMCG, wMCG);
- provide(wMCGStrategy);
- walkToMiningSpot wTMS = new walkToMiningSpot();
- Strategy wTMSStrategy = new Strategy(wTMS, wTMS);
- provide(wTMSStrategy);
- openDoor op = new openDoor();
- Strategy opStrategy = new Strategy(op, op);
- provide(opStrategy);
- Antiban ab = new Antiban();
- Strategy abStrategy = new Strategy(ab, ab);
- provide(abStrategy);
- }
- }
- }
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- mineChoose = new JComboBox<>();
- pickChoose = new JComboBox<>();
- start = new JButton();
- //======== this ========
- setFont(new Font("Dialog", Font.PLAIN, 28));
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //---- label1 ----
- label1.setText("BBgoldMiner");
- label1.setFont(new Font("Tahoma", Font.PLAIN, 28));
- contentPane.add(label1);
- label1.setBounds(95, 5, 165, 35);
- //---- mineChoose ----
- mineChoose.setModel(new DefaultComboBoxModel<>(new String[] {
- "Rimmington",
- "Crafting Guild"
- }));
- contentPane.add(mineChoose);
- mineChoose.setBounds(45, 55, 110, mineChoose.getPreferredSize().height);
- //---- pickChoose ----
- pickChoose.setModel(new DefaultComboBoxModel<>(new String[] {
- "Bronze Pickace",
- "Iron Pickaxe",
- "Steel Pickaxe",
- "Mithril Pickaxe",
- "Adamant Pickaxe",
- "Runite Pickaxe",
- "Dragon Pickaxe"
- }));
- contentPane.add(pickChoose);
- pickChoose.setBounds(190, 55, 110, pickChoose.getPreferredSize().height);
- //---- start ----
- start.setText("Start!");
- start.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- startActionPerformed(e);
- startActionPerformed(e);
- pickChooseActionPerformed(e);
- MineChooseActionPerformed(e);
- }
- });
- contentPane.add(start);
- start.setBounds(new Rectangle(new Point(145, 105), start.getPreferredSize()));
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < contentPane.getComponentCount(); i++) {
- Rectangle bounds = contentPane.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = contentPane.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- contentPane.setMinimumSize(preferredSize);
- contentPane.setPreferredSize(preferredSize);
- }
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox<String> mineChoose;
- private JComboBox<String> pickChoose;
- private JButton start;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment