Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.*;
- import java.awt.*;
- import java.util.*;
- import java.io.*;
- import java.net.*;
- import java.lang.reflect.Method;
- import javax.swing.*;
- import org.rsbot.script.*;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.*;
- import javax.imageio.ImageIO;
- @ScriptManifest(authors = { "Conderoga" }, keywords = "Mining", name = "Conderoga's Cavern Miner", version = 1.02,description = "Mines and banks gold and coal in the LRC.")
- /*UpdateLog:
- v1.00 - initial release
- v1.01 - Fixed logout bug and deathwalking bugs
- v1.02 - Added inferno adze, fixed coal path, fixed deprecation warnings (Thanks to Rawr =D)
- */
- public class CCMine extends Script implements PaintListener, MessageListener, MouseListener{
- //GUI stuff
- private String version = "1.02";
- public CCMineGUI gui;
- private boolean guiWait = true;
- private boolean guiExit = true;
- private String rockType;
- private boolean quickDeposit = false;
- private boolean evade = false;
- private boolean fastBank = false;
- //IDS and such
- private int bankID = 45079;
- private int goldID = 444;
- private int coalID = 453;
- private int rockPrice = 1;
- private int [] picks = {1265,1267,1269,1271,1273,1275,15259};
- private int closedCoalRock = 5990;
- private int closedGoldRock = 45075;
- private int openGoldRock = 45076;
- private int openCoalRock = 5999;
- private int openID;
- private int closedID;
- private RSTile bankTile = new RSTile(3653,5113);
- private RSTile [][] bankToRocks;
- private RSTile [][] rocksToBank;
- private RSTile [][] rocksToRocks;
- private boolean isDead = false;
- //Timers Stuff
- private RSTile [] rocks;
- private boolean [] rockStatus = new boolean [3];
- private long [] rockTimeDead = new long [3];
- private long [] rockDeadTime = new long [3];
- private long [] rockTimeAlive = new long [3];
- private long [] rockAliveTime = new long [3];
- private int nextRock = 0;
- int safety = 0;
- //Paint Stuff
- private String status = "";
- private int numGold;
- private int numCoal;
- private boolean full = false;
- private int startLevel;
- private int startExp;
- private int expGained;
- private int lvlsGained;
- private long startTime;
- private double startTimeDbl;
- private Point [] rockPoints;
- private final Image img1 = getImage("http://www.conderogascripts.99k.org/CCMine.png");
- private final Image img2 = getImage("http://i263.photobucket.com/albums/ii158/zpogo/Bar.png");
- private final Image img4 = getImage("http://i263.photobucket.com/albums/ii158/zpogo/EXPback-1copy.png");
- private boolean showPaint = true;
- private boolean fancyPaint = true;
- private Point p;
- private Color mouseColor = Color.RED;
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- startTimeDbl = System.currentTimeMillis();
- //Credits to Zombieknight for this:-----------------
- final int welcome = JOptionPane.showConfirmDialog(null,"Before using my script, would you like to thank me\nby clicking some adverts?","Welcome", JOptionPane.YES_NO_OPTION);
- if (welcome == 0) {
- final String message = "<html>Thank you for your support!<br /></html>";
- JOptionPane.showMessageDialog(null, message);
- openURL("http://adf.ly/AgSn");
- }
- //=------------------------------------------------------*/
- gui = new CCMineGUI();
- gui.setVisible(true);
- while(guiWait)
- {
- sleep(100);
- }
- env.disableRandom("InterfaceCloser");
- return !guiExit;
- }
- public void setUp(){
- status = "Setting Up";
- if(rockType.equals("Gold")){
- openID = openGoldRock;
- closedID = closedGoldRock;
- status = "Looking up Prices";
- rockPrice = getGEValue("Gold ore",goldID);
- log("Gold ore price: "+rockPrice);
- rocks = new RSTile [2];
- rocks[0] = new RSTile(3668,5076);
- rocks[1] = new RSTile(3638,5095);
- bankToRocks = new RSTile[2][];
- rocksToBank = new RSTile[2][];
- rocksToRocks = new RSTile [1][];
- RSTile [] bankToRock1 = {new RSTile(3654,5114),new RSTile(3658,5101),new RSTile(3662,5090),new RSTile(3666,5080),new RSTile(3669,5077),new RSTile(3669,5075)};
- bankToRocks[0] = bankToRock1;
- rocksToBank[0] = walking.newTilePath(bankToRock1).reverse().toArray();
- RSTile [] bankToRock2 = {new RSTile(3654,5114),new RSTile(3657,5105),new RSTile(3651,5096),new RSTile(3639,5096)};
- bankToRocks[1] = bankToRock2;
- rocksToBank[1] = walking.newTilePath(bankToRock2).reverse().toArray();
- RSTile [] rock2ToRock1 = {new RSTile(3639,5094),new RSTile(3648,5092),new RSTile(3658,5088),new RSTile(3666,5082),new RSTile(3669,5077)};
- rocksToRocks[0] = rock2ToRock1;
- rockPoints = new Point [2];
- }
- if(rockType.equals("Coal")){
- openID = openCoalRock;
- closedID = closedCoalRock;
- status = "Looking up Prices";
- rockPrice = getGEValue("Coal",coalID);
- log("Coal price: "+rockPrice);
- rocks = new RSTile[3];
- rocks[0] = new RSTile(3665,5091);
- rocks[1] = new RSTile(3675,5099);
- rocks[2] = new RSTile(3688,5108);
- rockPoints = new Point [3];
- bankToRocks = new RSTile[3][];
- rocksToBank = new RSTile[3][];
- rocksToRocks = new RSTile[3][];
- RSTile[] bankToRock1 ={new RSTile(3654,5114),new RSTile(3660,5104),new RSTile(3661,5095),new RSTile(3665,5092)};
- RSTile[] bankToRock2 ={new RSTile(3654,5114),new RSTile(3660,5114),new RSTile(3667,5111),new RSTile(3673,5104),new RSTile(3674,5101)};
- RSTile[] bankToRock3 ={new RSTile(3654,5114),new RSTile(3662,5114),new RSTile(3671,5112),new RSTile(3678,5107),new RSTile(3686,5108),new RSTile(3689,5106)};
- bankToRocks[0] = bankToRock1;
- bankToRocks[1] = bankToRock2;
- bankToRocks[2] = bankToRock3;
- rocksToBank[0] = walking.newTilePath(bankToRock1).reverse().toArray();
- rocksToBank[1] = walking.newTilePath(bankToRock2).reverse().toArray();
- rocksToBank[2] = walking.newTilePath(bankToRock3).reverse().toArray();
- RSTile [] rock1ToRock2 = {new RSTile(3665,5092),new RSTile(3670,5095),new RSTile(3673,5098)};
- RSTile [] rock1ToRock3 = {new RSTile(3665,5092),new RSTile(3670,5097),new RSTile(3675,5102),new RSTile(3680,5105),new RSTile(3686,5108),new RSTile(3689,5106)};
- RSTile [] rock2ToRock3 = {new RSTile(3673,5098),new RSTile(3675,5102),new RSTile(3680,5105),new RSTile(3686,5108),new RSTile(3689,5106)};
- rocksToRocks[0] = rock1ToRock2;
- rocksToRocks[1] = rock1ToRock3;
- rocksToRocks[2] = rock2ToRock3;
- }
- }
- public boolean mineCheck(){
- for(int i = 0; i<5;i++){
- if(players.getMyPlayer().getAnimation()==10224||players.getMyPlayer().getAnimation()==12189||players.getMyPlayer().getAnimation()==6746||players.getMyPlayer().getAnimation()==6750||players.getMyPlayer().getAnimation()==6751||players.getMyPlayer().getAnimation()==6749||players.getMyPlayer().getAnimation()==6748||players.getMyPlayer().getAnimation()==6747)
- {status = "Mining!";
- return true;}
- sleep(random(200,300));
- }
- status = "Not mining.";
- return false;
- }
- public void updateStatus()
- {
- antiBan(random(1,100));
- if(evade){
- if(getMyPlayer().isInCombat())
- status = "Evading combat.";
- }
- else{
- if(getMyPlayer().isInCombat())
- status = "Being attacked.";
- }
- if(evade&&status.equals("Evading combat."))
- {
- }
- else{
- boolean temp = mineCheck();
- boolean temp2 = false;
- for(int i = 0; i<rockStatus.length;i++){
- if(rockStatus[i])
- temp2 = true;
- }
- if(!temp&&!temp2)
- {
- status = "Waiting.";
- }
- }
- }
- public int floorHeight(){
- int y = (int)getMyPlayer().getLocation().getY();
- if(y<3400)
- return 0;
- else if( y< 9000 && y>4000)
- return -2;
- else
- return -1;
- }
- public void walkToMine(){
- sleep(random(1000,2000));
- int floor = floorHeight();
- if(floor==-2){
- status = "Resuming.";
- if(playerIsNear(new RSTile(3654,5114),5))
- isDead = false;
- else
- walking.walkTileMM(new RSTile(3654,5114));
- sleep(random(600,800));
- updateStatus();
- }
- if(floor==-1){
- RSTile [] path = {new RSTile(3058, 9776), new RSTile(3049, 9780),new RSTile(3043, 9787),new RSTile(3042, 9796),new RSTile(3040, 9804),new RSTile(3041, 9814),new RSTile(3040, 9822),new RSTile(3035, 9833),new RSTile(3025, 9828),new RSTile(3017, 9831),new RSTile(3012, 9832)};
- long startTime = System.currentTimeMillis();
- status = "Walking cave.";
- camera.setPitch(true);
- int lastTileToWalkTo = -1;
- int tempTileToWalkTo = 0;
- while(!playerIsNear(new RSTile(3012, 9832),5)&&System.currentTimeMillis()-startTime<20000)
- {
- if(!walking.isRunEnabled()&&walking.getEnergy()>20){
- walking.setRun(true);
- sleep(random(600,800));
- }
- if(!getMyPlayer().isMoving()){
- sleep(random(600,800));
- if(!getMyPlayer().isMoving())
- lastTileToWalkTo=-1;
- }
- boolean clicked = false;
- tempTileToWalkTo = walkPath(path);
- if(tempTileToWalkTo>lastTileToWalkTo){
- if(walking.walkTileMM(path[tempTileToWalkTo],1,1))
- clicked = true;
- sleep(random(400,500));
- if(getMyPlayer().isMoving())
- clicked = true;
- }
- if(clicked){
- lastTileToWalkTo = tempTileToWalkTo;
- }
- sleep(random(200, 300));
- }
- if(playerIsNear(new RSTile(3012, 9832),5))
- {
- status = "Going down rope.";
- RSObject o=null;
- RSObject [] test = objects.getAllAt(new RSTile(3012,9831));
- for(RSObject oa : test){
- if(oa.getID()==45077)
- o = oa;
- }
- if(o!=null){
- while(getMyPlayer().isMoving())
- sleep(random(100,200));
- RSModel m = o.getModel();
- Point p = m.getPoint();
- mouse.move(p);
- sleep(600,800);
- menu.doAction("Climb Rope");
- }
- }
- walkToMine();
- }
- if(floor==0){
- if(quickDeposit){
- RSItem [] inv = inventory.getItems();
- if(inventory.getCount()>0){
- status = "Equipping items.";
- for(int i = 0; i<3;i++){
- if(inv[i].getID()!=coalID&&inv[i].getID()!=goldID)
- if(!inv[i].doAction("Wield"))
- if(!inv[i].doAction("Wear"))
- inv[i].doAction("Equip");
- }
- }
- }
- RSTile [] Fpath = {new RSTile(2970, 3339),new RSTile(2964, 3349),new RSTile(2965, 3360),new RSTile(2965, 3370),new RSTile(2968, 3377),new RSTile(2977, 3377),new RSTile(2983, 3373),new RSTile(2991, 3370),new RSTile(3000, 3363),new RSTile(3008, 3363),new RSTile(3020, 3362),new RSTile(3029, 3366),new RSTile(3036, 3369),new RSTile(3044, 3369),new RSTile(3054, 3369),new RSTile(3061, 3374)};
- RSTile [] Lpath = {new RSTile(3220,3219),new RSTile(3218,3210),new RSTile(3209,3205),new RSTile(3203,3205),new RSTile(3198,3218),new RSTile(3183,3221),new RSTile(3175,3228),new RSTile(3166,3231),new RSTile(3151,3233),new RSTile(3138,3228),new RSTile(3126,3225),new RSTile(3112,3229),new RSTile(3099,3235),new RSTile(3090,3237),new RSTile(3081,3241),new RSTile(3072,3249),new RSTile(3071,3261),new RSTile(3067,3276),new RSTile(3054,3276),new RSTile(3041,3276),new RSTile(3027,3277),new RSTile(3016,3278),new RSTile(3009,3279),new RSTile(3007,3292),new RSTile(3007,3306),new RSTile(3007,3315),new RSTile(3007,3329),new RSTile(3007,3343),new RSTile(3007,3354),new RSTile(3016,3362),new RSTile(3026,3366),new RSTile(3043,3370),new RSTile(3057,3371),new RSTile(3061,3374)};
- RSTile [] path = new RSTile [0];
- if(playerIsNear(new RSTile(2970,3339),7)){
- log("You died and respawned in Falador, walking back to mine.");
- path = fixPath(Fpath);
- }
- else if(playerIsNear(new RSTile(3220,3219),7)){
- log("You died and respawned in Lumbridge, walking back to mine.");
- log("This could take a while...");
- path = fixPath(Lpath);
- }
- long startTime = System.currentTimeMillis();
- status = "Walking to mine.";
- camera.setPitch(true);
- int lastTileToWalkTo = -1;
- int tempTileToWalkTo = 0;
- while(!playerIsNear(new RSTile(3061, 3374),5)&&System.currentTimeMillis()-startTime<300000)
- {
- if(!walking.isRunEnabled()&&walking.getEnergy()>20){
- walking.setRun(true);
- sleep(random(600,800));
- }
- if(!getMyPlayer().isMoving()){
- sleep(random(600,800));
- if(!getMyPlayer().isMoving())
- lastTileToWalkTo=-1;
- }
- boolean clicked = false;
- tempTileToWalkTo = walkPath(path);
- if(tempTileToWalkTo>lastTileToWalkTo){
- if(walking.walkTileMM(path[tempTileToWalkTo],1,1))
- clicked = true;
- sleep(random(400,500));
- if(getMyPlayer().isMoving())
- clicked = true;
- }
- if(clicked){
- lastTileToWalkTo = tempTileToWalkTo;
- }
- sleep(random(200, 300));
- }
- RSObject door=null;
- if(playerIsNear(new RSTile(3061, 3374),5)){
- boolean doorClosed = false;
- RSObject [] check = objects.getAllAt(new RSTile(3061,3374));
- for(RSObject o : check){
- if(o.getID()==11714){
- doorClosed = true;
- door = o;
- }
- }
- if(doorClosed&&getMyPlayer().getLocation().getY()<3375){
- while(getMyPlayer().isMoving())
- sleep(random(100,200));
- RSModel m = door.getModel();
- Point p = m.getPoint();
- mouse.move(p);
- sleep(600,800);
- menu.doAction("Open Door");
- }
- }
- RSObject stairs=null;
- RSObject [] check2 = objects.getAllAt(new RSTile(3060,3377));
- for(RSObject j : check2){
- if(j.getID()==30944)
- stairs = j;
- }
- if(stairs!=null){
- while(getMyPlayer().isMoving())
- sleep(random(100,200));
- RSModel m = stairs.getModel();
- Point p = m.getPoint();
- mouse.move(p);
- sleep(600,800);
- menu.doAction("Climb-down Stairs");
- }
- walkToMine();
- }
- }
- public RSObject getNextRock(){
- RSObject[] check = objects.getAllAt(rocks[nextRock-1]);
- for(RSObject o : check)
- if(o.getID()==openID||o.getID()==closedID)
- return o;
- return null;
- }
- public int nearRock(){
- for(int i =0; i<rocks.length;i++){
- if(playerIsNear(rocks[i],5))
- return i+1;
- }
- return 0;
- }
- public void checkRocks(){
- for(int r = 0; r< rocks.length;r++){
- RSObject[] check = objects.getAllAt(rocks[r]);
- for(int i = 0; i< check.length; i++)
- {
- if(check[i].getID()==closedID&&rockStatus[r])
- { rockStatus[r] = false;
- rockDeadTime[r] = System.currentTimeMillis();
- rockTimeAlive[r] = -1;
- }
- else if(check[i].getID()==openID&&!rockStatus[r])
- { rockStatus[r] = true;
- rockAliveTime[r] = System.currentTimeMillis();
- rockTimeDead[r] = -1;
- }
- else if(check[i].getID()==openID)
- { rockStatus[r] = true;
- rockTimeAlive[r] = System.currentTimeMillis()-rockAliveTime[r];}
- else if(check[i].getID()==closedID)
- { rockStatus[r] = false;
- rockTimeDead[r] = System.currentTimeMillis()-rockDeadTime[r];}
- }
- }
- }
- public boolean allRocksClosed(){
- boolean allClosed = true;
- for(int i=0;i<rockStatus.length;i++)
- {
- if(rockStatus[i])
- allClosed = false;
- }
- return allClosed;
- }
- public void calculateNextRock(){
- if(allRocksClosed())
- {
- long num = -2;
- int index = 0;
- for(int i =0; i < rockTimeDead.length; i++)
- {
- if(rockTimeDead[i]>=num)
- {index = i;
- num = rockTimeDead[i];
- }
- }
- nextRock = index+1;
- }
- else{
- long num = -2;
- int index = 0;
- for(int i =0; i < rockTimeAlive.length; i++)
- {
- if(rockTimeAlive[i]>=num)
- {index = i;
- num = rockTimeAlive[i];
- }
- }
- nextRock = index+1;
- }
- }
- public void moveToNextRock(){
- status = "Moving to rock "+nextRock;
- RSTile [] path = new RSTile[0];
- if(rockType.equals("Gold")){
- path = (nextRock==1) ? rocksToRocks[0] : walking.newTilePath(rocksToRocks[0]).reverse().toArray();
- }
- else if(rockType.equals("Coal")){
- boolean near1 = playerIsNear(rocks[0],4);
- boolean near2 = playerIsNear(rocks[1],4);
- boolean near3 = playerIsNear(rocks[2],4);
- if(near1&&nextRock==2)
- path = rocksToRocks[0];
- else if(near1)
- path = rocksToRocks[1];
- else if(near2&&nextRock==1)
- path = walking.newTilePath(rocksToRocks[0]).reverse().toArray();
- else if(near2)
- path = rocksToRocks[2];
- else if(near3&&nextRock==1)
- path = walking.newTilePath(rocksToRocks[1]).reverse().toArray();
- else
- path = walking.newTilePath(rocksToRocks[2]).reverse().toArray();
- }
- path = fixPath(path);
- long startTime = System.currentTimeMillis();
- camera.setPitch(true);
- int lastTileToWalkTo = -1;
- int tempTileToWalkTo = 0;
- while(!playerIsNear(path[path.length-1],5)&&System.currentTimeMillis()-startTime<20000)
- {
- if(!walking.isRunEnabled()&&walking.getEnergy()>20){
- walking.setRun(true);
- sleep(random(600,800));
- }
- if(!getMyPlayer().isMoving()){
- sleep(random(600,800));
- if(!getMyPlayer().isMoving())
- lastTileToWalkTo=-1;
- }
- boolean clicked = false;
- tempTileToWalkTo = walkPath(path);
- if(tempTileToWalkTo>lastTileToWalkTo){
- if(walking.walkTileMM(path[tempTileToWalkTo],1,1))
- clicked = true;
- sleep(random(400,500));
- if(getMyPlayer().isMoving())
- clicked = true;
- }
- if(clicked){
- lastTileToWalkTo = tempTileToWalkTo;
- }
- sleep(random(200, 300));
- }
- }
- public void mine(boolean secondTry){
- safety = 1;
- RSObject rockToMine = getNextRock();
- if(rockToMine!=null){
- RSModel m = rockToMine.getModel();
- if(m!=null){
- Point temp = m.getPoint();
- mouse.move(temp);
- if(menu.doAction("Mine Mineral deposit")){
- sleep(random(600,800));
- while (players.getMyPlayer().isMoving()) {
- sleep(random(100, 200));
- }
- if(!mineCheck()&&!secondTry)
- mine(true);
- }
- else if(!secondTry){
- mine(true);
- }
- }
- }
- }
- public void hoverMouse(){
- if(calc.tileOnScreen(rocks[nextRock-1])){
- Point temp = calc.tileToScreen(rocks[nextRock-1]);
- try{
- if(temp.getY()-10>1)
- mouse.move(new Point((int)temp.getX(),(int)temp.getY()-10),1,1);
- else
- mouse.move(new Point((int)temp.getX(),(int)temp.getY()),1,1);
- }catch(Exception e){};
- }
- }
- public void walkToBank(){
- long startTime = System.currentTimeMillis();
- status = "Walking to bank.";
- mouse.setSpeed(random(5,8));
- if(random(1,3)==2)
- camera.setPitch(true);
- int lastTileToWalkTo = -1;
- int tempTileToWalkTo = 0;
- RSTile [] path = new RSTile [0];
- if(playerIsNear(rocks[0],5))
- path = rocksToBank[0];
- else if(playerIsNear(rocks[1],5))
- path = rocksToBank[1];
- else if(rocks.length>2&&playerIsNear(rocks[2],5))
- path = rocksToBank[2];
- else
- path = rocksToBank[0];
- path = fixPath(path);
- while(!playerIsNear(bankTile,6)&&System.currentTimeMillis()-startTime<20000)
- {
- if(!walking.isRunEnabled()&&walking.getEnergy()>20){
- walking.setRun(true);
- sleep(random(600,800));
- }
- status = "Walking to bank..";
- if(!getMyPlayer().isMoving()){
- sleep(random(600,800));
- if(!getMyPlayer().isMoving())
- lastTileToWalkTo=-1;
- }
- boolean clicked = false;
- tempTileToWalkTo = walkPath(path);
- if(tempTileToWalkTo>lastTileToWalkTo){
- if(walking.walkTileMM(path[tempTileToWalkTo],1,1))
- clicked = true;
- sleep(random(400,500));
- if(getMyPlayer().isMoving())
- clicked = true;
- }
- if(clicked){
- lastTileToWalkTo = tempTileToWalkTo;
- }
- sleep(random(200, 300));
- }
- }
- public boolean compareTiles(RSTile t1, RSTile t2){
- if(t1==null||t2==null)
- return false;
- return t1.getX()==t2.getX()&&t1.getY()==t2.getY();
- }
- public int walkPath(RSTile [] path){
- int temp = 0;
- boolean nearSomething = false;
- for(int i = 0; i<path.length;i++)
- {
- if(playerIsNear(path[i],5))
- {
- nearSomething = true;
- temp = i+1;
- antiBan(random(1,200));
- for(int j = i; j<path.length; j++)
- {
- if(calc.tileToMinimap(path[j]).x<0)
- {
- temp=j-1;
- break;
- }
- if(j==path.length-1&&calc.tileToMinimap(path[j]).x>0)
- {
- temp=j;
- break;
- }
- }
- return temp;
- }
- }
- if(!nearSomething){
- RSTile tempTileToCompare = walking.newTilePath(path).getNext();
- for(int i = 0; i<path.length;i++)
- {
- if(compareTiles(path[i],tempTileToCompare))
- return i;
- }
- }
- return 0;
- }
- public void bank(){
- while(getMyPlayer().isMoving())
- sleep(random(100,200));
- mouse.setSpeed(random(7,8));
- boolean tryAgain = true;
- while(inventory.isFull()){
- tryAgain = true;
- while(tryAgain) {
- status = "Opening bank.";
- RSObject [] test = objects.getAllAt(bankTile);
- RSObject bankBox = null;
- for(int i = 0; i<test.length;i++)
- if(test[i].getID()==bankID)
- bankBox = test[i];
- RSModel m = bankBox.getModel();
- Point p = m.getPoint();
- mouse.move(p,1,1);
- if(menu.doAction("Deposit Pulley lift"))
- tryAgain = false;
- }
- sleep(random(1500,2000));
- status = "Depositing.";
- sleep(random(600,800));
- if(!quickDeposit)
- bank.depositAllExcept(picks);
- else
- bank.depositAll();
- sleep(random(600,800));
- bank.close();
- }
- if(fastBank){
- walkToRocks();
- }
- }
- public void walkToRocks(){
- long startTime = System.currentTimeMillis();
- status = "Walking to rocks.";
- int lastTileToWalkTo = -1;
- mouse.setSpeed(random(5,8));
- RSTile [] path;
- if(nextRock==3)
- path = bankToRocks[2];
- else if(nextRock==2)
- path = bankToRocks[1];
- else
- path = bankToRocks[0];
- path = fixPath(path);
- int tempTileToWalkTo = walkPath(path);
- while(!playerIsNear(rocks[nextRock-1],5)&&System.currentTimeMillis()-startTime<20000){
- if(!walking.isRunEnabled()&&walking.getEnergy()>20){
- walking.setRun(true);
- sleep(random(600,800));
- }
- status = "Walking to rocks.";
- if(!getMyPlayer().isMoving()){
- sleep(random(600,800));
- if(!getMyPlayer().isMoving())
- lastTileToWalkTo=-1;
- }
- boolean clicked = false;
- tempTileToWalkTo = walkPath(path);
- if(tempTileToWalkTo>lastTileToWalkTo){
- if(walking.walkTileMM(path[tempTileToWalkTo],1,1))
- clicked = true;
- sleep(random(400,500));
- if(getMyPlayer().isMoving())
- clicked = true;
- }
- if(clicked){
- lastTileToWalkTo = tempTileToWalkTo;
- }
- sleep(random(200, 300));
- }
- }
- public void doBank(int num)
- { if(num==0)
- {
- walkToBank();
- sleep(random(600,800));
- }
- bank();
- sleep(random(600,800));
- walkToRocks();
- sleep(random(600,800));
- }
- public void messageReceived(final MessageEvent e) {
- final String serverString = e.getMessage();
- if (serverString.toLowerCase().contains("dead"))
- isDead = true;
- }
- public boolean playerIsNear(RSTile tile, int d)
- {
- return (Math.abs(getMyPlayer().getLocation().getX()-tile.getX())<d&&Math.abs(getMyPlayer().getLocation().getY()-tile.getY())<d);
- }
- public void mouseExited(MouseEvent e) {
- }
- public void mouseEntered(MouseEvent e) {
- }
- public void mouseReleased(MouseEvent e) {
- mouseColor = Color.RED;
- }
- public void mousePressed(MouseEvent e) {
- mouseColor = new Color(255,0,0,100);
- }
- public void mouseClicked(MouseEvent e) {
- p = e.getPoint();
- if(showPaint && p.getX()>447&&p.getX()<513&& p.getY()>458&&p.getY()<473)
- showPaint = false;
- else if(!showPaint && p.getX()>447&&p.getX()<513&& p.getY()>458&&p.getY()<473)
- showPaint = true;
- else if(showPaint && fancyPaint && p.getX()>397&&p.getX()<448&& p.getY()>458&&p.getY()<473)
- fancyPaint = false;
- else if(showPaint && !fancyPaint && p.getX()>397&&p.getX()<448&& p.getY()>458&&p.getY()<473)
- fancyPaint = true;
- mouseColor = new Color(255,0,0,100);
- }
- public int distanceTo(RSTile test){
- RSTile myLoc = players.getMyPlayer().getLocation();
- return (int)Math.pow(Math.pow(test.getY()-myLoc.getY(),2)+Math.pow(test.getX()-myLoc.getX(),2),.5);
- }
- public int distanceBetween(RSTile t1, RSTile t2){
- return (int)Math.pow(Math.pow(t1.getY()-t2.getY(),2)+Math.pow(t1.getX()-t2.getX(),2),.5);
- }
- public RSTile[] fixPath(RSTile [] path){
- ArrayList<RSTile> newPath = new ArrayList<RSTile>();
- for(RSTile t : path)
- newPath.add(t);
- newPath = fixPath(newPath);
- path = new RSTile[newPath.size()];
- for(int i=0; i<path.length;i++){
- path[i]=newPath.get(i);
- }
- return path;
- }
- public ArrayList<RSTile> fixPath(ArrayList<RSTile> path){
- boolean madeSwap = false;
- do{
- madeSwap = false;
- for(int i = 0; i<path.size()-1;i++)
- if(distanceBetween(path.get(i),path.get(i+1))>7){
- path.add(i+1,getMidTile(path.get(i),path.get(i+1)));
- madeSwap = true;
- }
- }while(madeSwap);
- return path;
- }
- public RSTile getMidTile(RSTile tile1, RSTile tile2)
- {
- int x1 = tile1.getX();
- int y1 = tile1.getY();
- int x2 = tile2.getX();
- int y2 = tile2.getY();
- return new RSTile((int)(x1+x2)/2,(int)(y1+y2)/2);
- }
- public int getGEValue(String name, int id){
- try{
- String [] temp = name.split(" ");
- String newName = "";
- for(int i = 0; i<temp.length; i++)
- if(i==temp.length-1)
- newName+=temp[i];
- else
- newName+="_"+temp[i];
- URL url = new URL("http://services.runescape.com/m=itemdb_rs/"+newName+"/viewitem.ws?obj="+id);
- InputStream is = url.openStream();
- InputStreamReader isr = new InputStreamReader(is);
- BufferedReader br = new BufferedReader(isr);
- String line;
- String num = "";
- while((line=br.readLine())!=null){
- if(line.contains("Current guide price:"))
- num = line;
- }
- System.out.println(num);
- if(num.length()<29)
- return -1;
- else{
- num = num.substring(28);
- num = num.replaceAll(",", "");
- return Integer.parseInt(num);
- }
- }catch(Exception e){
- return -1;
- }
- }
- public void closeGraveIface() { //Credits to Rawr
- if (interfaces.get(266).getComponent(1).isValid()) {
- log.info("[UPDATE] Closing the grave interface that accidently opened.");
- interfaces.get(266).getComponent(1).doClick(true);
- } else {
- return;
- }
- } // Credits to Rawr
- //LOOP====================================================================================================================
- public int loop() {
- try{
- if(safety<1)
- {
- if(!game.isFixed())
- for(int i = 0; i<3;i++)
- log("For best results, please set your window mode to 'fixed'.");
- setUp();
- camera.setPitch(true);
- safety=1;
- full = inventory.isFull();
- if(!full&&playerIsNear(bankTile,5))
- walkToRocks();
- else if(full&&playerIsNear(bankTile,5))
- doBank(1);
- else if(full)
- doBank(0);
- if(playerIsNear(new RSTile(2970,3339),8)||playerIsNear(new RSTile(3220,3219),8))
- isDead=true;
- }
- mouse.setSpeed(random(5,8));
- antiBan(random(1,120));
- closeGraveIface();
- updateStatus();
- full = inventory.isFull();
- if(playerIsNear(new RSTile(2970,3339),8)||playerIsNear(new RSTile(3220,3219),8))
- isDead=true;
- if(isDead){
- walkToMine();
- }
- if(full&&playerIsNear(bankTile,5))
- {
- doBank(1);
- }
- else if(!full&&playerIsNear(bankTile,5)){
- walkToRocks();
- }
- else if(full) //BANK
- {
- doBank(0);
- }
- else if(status.equals("Evading combat.")){
- walkToBank();
- status = "Evading...";
- sleep(random(2000,3000));
- status = "Returning.";
- walkToRocks();
- }
- if(status.equals("Mining!"))
- {
- if(random(1,5)==2)
- if(safety<3)
- {hoverMouse();
- safety++;
- }
- }
- else if(status.equals("Not mining.")||status.contains("Moving to rock"))
- {
- long tempTimer = System.currentTimeMillis();
- while(nearRock()!=nextRock&&System.currentTimeMillis()-tempTimer<5000)
- moveToNextRock();
- mine(false);
- }
- else if(status.equals("Waiting."))
- {
- if(safety==3)
- {
- long tempTimer = System.currentTimeMillis();
- while(nearRock()!=nextRock&&System.currentTimeMillis()-tempTimer<10000)
- moveToNextRock();
- camera.turnToTile(rocks[nextRock-1]);
- camera.setPitch(random(20,50));
- }
- if(safety<5)
- hoverMouse();
- safety++;
- }
- else{
- }
- }catch (Exception e){};
- return random(300,500);
- }
- //LOOP====================================================================================================================
- public void antiBan(int rand){
- status += "(AB)";
- mouse.setSpeed(random(7,8));
- if(rand==1)
- if(random(1, 8) == 2)
- mouse.moveRandomly(900,1200);
- if(rand==2)
- if(random(1, 8) == 2)
- mouse.moveRandomly(400,800);
- if(rand==3)
- if(random(1, 8) == 2)
- mouse.moveRandomly(200,700);
- if(rand==4) //THIS CHECKS THE MINING STAT
- if(random(1, 6) == 2)
- {
- game.openTab(Game.TAB_STATS);
- sleep(random(600,800));
- skills.doHover(Skills.INTERFACE_MINING);
- sleep(random(1900,2000));
- game.openTab(Game.TAB_INVENTORY);
- }
- if(rand==5) //THIS CLICKS THE XP BUTTON UNDER THE COMPASS (Update thanks to Rawr =D)
- if(random(1, 24) == 2)
- {
- if (interfaces.get(548).getComponent(38).isValid()) {
- return;
- } else {
- if (interfaces.get(548).getComponent(0).doClick()) {
- sleep(1500);
- }
- }
- }
- if(rand==7) //RANDOM SPIN
- if(random(1, 3) == 2)
- {int r = random(1,2);
- camera.setAngle(random(1,359));
- if(r!=1)
- camera.setPitch(random(1,99));}
- if(rand==8) //THIS CHECKS A RANDOM TAB
- if(random(1, 4) == 2)
- {
- int[] tabs = {0,2,3,5,6,7,9,10,11,12,13,14,15};
- game.openTab(tabs[random(0,tabs.length-1)]);
- mouse.moveRandomly(175,200);
- sleep(random(1600,1800));
- sleep(random(900,1000));
- }
- if(rand==9)
- if(random(1,10)==2)
- mouse.moveOffScreen();
- status=status.substring(0,status.indexOf('('));
- }
- public void onRepaint(Graphics g)
- {
- if(game.isLoggedIn())
- {
- try{
- checkRocks();
- calculateNextRock();
- }catch(Exception e){};
- if(startExp==0)
- {
- startExp = skills.getCurrentExp(Skills.MINING);
- startLevel = skills.getCurrentLevel(Skills.MINING);
- }
- lvlsGained = skills.getCurrentLevel(Skills.MINING) - startLevel;
- expGained = skills.getCurrentExp(Skills.MINING) - startExp;
- long expToLvl = skills.getExpToNextLevel(Skills.MINING);
- //setting up the time
- long ms = System.currentTimeMillis() - startTime;
- double ms2 = System.currentTimeMillis() - startTimeDbl;
- long hours = ms/3600000;
- ms = ms-(hours*3600000);
- long minutes = ms/60000;
- ms = ms-(minutes*60000);
- long seconds = ms/1000;
- long time2Lvl = 0;
- long time2LvlHrs = 0;
- long time2LvlMins = 0;
- long time2LvlSec = 0;
- if(ms2!=0&&expGained!=0){
- time2Lvl = (long)(expToLvl/(expGained/(ms2/3600000))*3600000);
- time2LvlHrs = time2Lvl/3600000;
- time2Lvl -= time2LvlHrs*3600000;
- time2LvlMins = time2Lvl/60000;
- time2Lvl -= time2LvlMins*60000;
- time2LvlSec = time2Lvl/1000;
- }
- numGold = expGained/65;
- numCoal = expGained/50;
- if(fancyPaint)
- {
- if(showPaint){
- onRepaint2(g,true);
- //Text Color and Output
- g.setColor(new Color(0,0,0,255));
- g.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
- g.drawString(" "+version,453,360);
- g.setFont(new Font("Comic Sans MS", Font.PLAIN, 11));
- g.drawString("Levels Gained: "+lvlsGained,16,40);
- if(rockType.equals("Gold"))
- g.drawString("Gold Mined: "+numGold,395,22);
- else if(rockType.equals("Coal"))
- g.drawString("Coal Mined: "+numCoal,395,22);
- g.drawString("Exp Gained: "+expGained,16,55);
- g.drawString("Time Running: "+hours+":"+minutes+":"+seconds,16,97);
- //Determine Length:
- double difference = Skills.XP_TABLE[skills.getCurrentLevel(Skills.MINING)+1]-Skills.XP_TABLE[skills.getCurrentLevel(Skills.MINING)];
- double barLength = ((difference-expToLvl)/difference)*512;
- //Progress Bar
- g.setColor(new Color(255,0,0,255));
- g.fillRoundRect(4,320,512,18,8,8); //Bar background
- g.setColor(new Color(51,153,0,255)); //GREEN
- g.fillRoundRect(4,320,(int)barLength,18,4,4);
- g.setColor(new Color(0,0,0,255));
- g.drawString(skills.getPercentToNextLevel(Skills.MINING)+"% to: "+(skills.getCurrentLevel(Skills.MINING)+1)+" ("+expToLvl+" exp)",215,334);
- g.setColor(new Color(255,255,255,100));
- g.fillRoundRect(4,320,512,9,4,4);
- if(ms2!=0)
- g.setColor(new Color(0,0,0,255));
- g.drawString("Exp/Hr: "+(int)(expGained/(ms2/3600000)),16,69);
- g.drawString("Status: "+status,16,22);
- if(rockType.equals("Gold"))
- {
- g.drawString("Money Gained: "+numGold*rockPrice,154,22);
- if(ms2!=0)
- g.drawString("Money/Hr: "+(int)((numGold*rockPrice)/(ms2/3600000)),289,22);
- }
- else if(rockType.equals("Coal"))
- {
- g.drawString("Money Gained: "+numCoal*rockPrice,154,22);
- if(ms2!=0)
- g.drawString("Money/Hr: "+(int)((numCoal*rockPrice)/(ms2/3600000)),289,22);
- }
- g.drawString("Est. Time to Lvl: "+time2LvlHrs+":"+time2LvlMins+":"+time2LvlSec,16,83);
- //Mouse Stuff
- Point tempPoint = mouse.getLocation();
- int tempXCoordinate = (int)tempPoint.getX();
- int tempYCoordinate = (int)tempPoint.getY();
- g.setColor(mouseColor);
- g.drawLine(tempXCoordinate,0,tempXCoordinate,501);
- g.drawLine(0,tempYCoordinate,764,tempYCoordinate);
- g.fillRect(tempXCoordinate-1,tempYCoordinate-1,3,3);
- Color tempColor = new Color(255,0,0,100);
- if(mouseColor.equals(tempColor))
- mouseColor=Color.RED;
- //timer drawing
- for(int i = 0; i < rockPoints.length; i++){
- rockPoints[i] = calc.tileToScreen(rocks[i]);
- if(rockStatus[i]&&rockAliveTime[i]!=0){
- g.setColor(Color.GREEN);
- g.drawString((int)(rockTimeAlive[i]/1000)+"s",(int)rockPoints[i].getX(),(int)rockPoints[i].getY());
- }
- if(!rockStatus[i]&&rockDeadTime[i]!=0){
- g.setColor(Color.RED);
- g.drawString((int)(rockTimeDead[i]/1000)+"s",(int)rockPoints[i].getX(),(int)rockPoints[i].getY());
- }
- }
- }
- else
- {
- g.setColor(Color.RED);
- g.fillRect(448,459,(512-448),(472-459));
- g.setColor(new Color(0,0,0,255));
- g.drawRect(448,459,(512-448),(472-459));
- g.drawString("Hide/Show",450,470);
- }
- }
- else
- {
- if(showPaint){
- onRepaint2(g,false);
- g.setColor(new Color(0, 0, 0, 205));
- g.fillRoundRect(333, 160, 181, 179, 6, 6);
- g.setColor(new Color(255,0,0,255));
- g.setFont(new Font("Comic Sans MS", Font.PLAIN, 12));
- g.drawString("C's Cavern Miner "+version,338,177);
- g.setFont(new Font("Comic Sans MS", Font.PLAIN, 11));
- g.drawString("Levels Gained: "+lvlsGained,344,192);
- if(rockType.equals("Gold"))
- g.drawString("Gold Mined: "+numGold,344,207);
- else if(rockType.equals("Coal"))
- g.drawString("Coal Mined: "+numCoal,344,207);
- g.drawString("Exp Gained: "+expGained,344,222);
- g.drawString("Time Running: "+hours+":"+minutes+":"+seconds,344, 237);
- //Progress Bar
- g.setColor(new Color(255,0,0,255));
- g.fillRoundRect(344,241,150,20,8,8); //Bar background
- g.setColor(new Color(0,255,0,255)); //GREEN
- g.fillRoundRect(344,241,(int)(skills.getPercentToNextLevel(Skills.MINING)*1.5),20,8,8);
- g.setColor(new Color(255,255,255,100));
- g.drawString(skills.getPercentToNextLevel(Skills.MINING)+"% to: "+(skills.getCurrentLevel(Skills.MINING)+1)+" ("+expToLvl+" exp)",348,256);
- g.fillRoundRect(345,251,148,10,8,8);
- g.setColor(new Color(0,0,0,255));
- g.drawString(skills.getPercentToNextLevel(Skills.MINING)+"% to: "+(skills.getCurrentLevel(Skills.MINING)+1)+" ("+expToLvl+" exp)",347,255);
- g.setColor(new Color(255,0,0,255));
- if(ms2!=0)
- g.drawString("Exp/Hr: "+(int)(expGained/(ms2/3600000)),344,274);
- g.drawString("Status: "+status,344,289);
- if(rockType.equals("Gold"))
- {
- g.drawString("Money Gained: "+numGold*rockPrice,344,304);
- if(ms2!=0)
- g.drawString("Money/Hr: "+(int)((rockPrice*numGold)/(ms2/3600000)),344,319);
- }
- else if(rockType.equals("Coal"))
- {
- g.drawString("Money Gained: "+rockPrice*numCoal,344,304);
- if(ms2!=0)
- g.drawString("Money/Hr: "+(int)((rockPrice*numCoal)/(ms2/3600000)),344,319);
- }
- g.drawString("Est. Time to Lvl: "+time2LvlHrs+":"+time2LvlMins+":"+time2LvlSec,344,334);
- //Mouse Stuff
- Point tempPoint = mouse.getLocation();
- int tempXCoordinate = (int)tempPoint.getX();
- int tempYCoordinate = (int)tempPoint.getY();
- g.setColor(new Color(0,255,0,100));
- g.drawLine(tempXCoordinate,0,tempXCoordinate,501);
- g.drawLine(0,tempYCoordinate,764,tempYCoordinate);
- //timer drawing
- for(int i = 0; i < rockPoints.length; i++){
- rockPoints[i] = calc.tileToScreen(rocks[i]);
- if(rockStatus[i]&&rockAliveTime[i]!=0){
- g.setColor(Color.GREEN);
- g.drawString((int)(rockTimeAlive[i]/1000)+"s",(int)rockPoints[i].getX(),(int)rockPoints[i].getY());
- }
- if(!rockStatus[i]&&rockDeadTime[i]!=0){
- g.setColor(Color.RED);
- g.drawString((int)(rockTimeDead[i]/1000)+"s",(int)rockPoints[i].getX(),(int)rockPoints[i].getY());
- }
- }}
- else
- {
- g.setColor(Color.RED);
- g.fillRect(448,459,(512-448),(472-459));
- g.setColor(new Color(0,0,0,255));
- g.drawRect(448,459,(512-448),(472-459));
- g.drawString("Hide/Show",450,470);
- }
- }
- //}catch (Exception e){log("Error in paint: "+e);
- // log(e.getMessage()+"");}
- }
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- public void onRepaint2(Graphics g1 , boolean fancy) {
- Graphics2D g = (Graphics2D)g1;
- if(fancy){
- g.drawImage(img1, 342, 350, null);
- g.drawImage(img2, 5, 6, null);
- g.drawImage(img4, 5, 29, null);
- }
- g.setColor(Color.RED);
- g.fillRect(448,459,(512-448),(472-459));
- g.fillRect(398,459,(448-398),(472-459));
- g.setColor(new Color(0,0,0,255));
- g.drawRect(448,459,(512-448),(472-459));
- g.drawRect(398,459,(448-398),(472-459));
- g.drawString("Hide/Show",450,470);
- if(fancy)
- g.drawString("Simple",405,470);
- else
- g.drawString("Adv.",415,470);
- }
- public void onFinish() {
- log("Exp gained: "+expGained);
- log("Levels gained: "+lvlsGained);
- log("Thanks for using Conderoga's Cavern Miner!");
- }
- public void openURL(final String url) { // Credits ZombieKnight
- //who gave credits to Dave who gave credits
- // to
- // some guy who made this.
- final String osName = System.getProperty("os.name");
- try {
- if (osName.startsWith("Mac OS")) {
- final Class<?> fileMgr = Class
- .forName("com.apple.eio.FileManager");
- final Method openURL = fileMgr.getDeclaredMethod("openURL",new Class[]{String.class});
- openURL.invoke(null, new Object[]{url});
- } else if (osName.startsWith("Windows")) {
- Runtime.getRuntime().exec(
- "rundll32 url.dll,FileProtocolHandler " + url);
- } else { // assume Unix or Linux
- final String[] browsers = {"firefox", "opera", "konqueror",
- "epiphany", "mozilla", "netscape"};
- String browser = null;
- for (int count = 0; count < browsers.length && browser == null; count++) {
- if (Runtime.getRuntime().exec(
- new String[]{"which", browsers[count]})
- .waitFor() == 0) {
- browser = browsers[count];
- }
- }
- if (browser == null) {
- throw new Exception("Could not find web browser");
- } else {
- Runtime.getRuntime().exec(new String[]{browser, url});
- }
- }
- }catch(Exception e){};
- }
- public class CCMineGUI extends JFrame {
- private static final long serialVersionUID = 1L;
- public CCMineGUI()
- {
- initComponents();
- }
- private void button2ActionPerformed(ActionEvent e)
- {
- try{
- guiWait = false;
- guiExit = true;
- dispose();
- }catch(Exception f){log("WTF.");}
- }
- private void button1ActionPerformed(ActionEvent e)
- {
- try{
- rockType = comboBox1.getSelectedItem().toString();
- quickDeposit = checkBox1.isSelected();
- evade = checkBox2.isSelected();
- fastBank = checkBox3.isSelected();
- guiExit = false;
- guiWait = false;
- dispose();
- }catch(Exception f){log("WTF.");}
- }
- private void initComponents() {
- label1 = new JLabel();
- label2 = new JLabel();
- label3 = new JLabel();
- button1 = new JButton();
- button2 = new JButton();
- checkBox1 = new JCheckBox("Quick Deposit?",false);
- checkBox2 = new JCheckBox("Evade Combat?",true);
- checkBox3 = new JCheckBox("Faster Banking?",false);
- comboBox1 = new JComboBox();
- setTitle("Conderoga's Cavern Miner");
- setResizable(false);
- setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //---- label1 ----
- label1.setText("Conderoga's Cavern Miner Settings");
- label1.setFont(new Font("Comic Sans MS", Font.PLAIN, 16));
- contentPane.add(label1);
- label1.setBounds(10, -10, 380, 70);
- //---- label2 ----
- label2.setText("Select what to mine: ");
- contentPane.add(label2);
- label2.setBounds(new Rectangle(new Point(15, 50), label2.getPreferredSize()));
- //---- comboBox1 ----
- comboBox1.setMaximumRowCount(2);
- comboBox1.setModel(new DefaultComboBoxModel(new String[] {
- "Gold",
- "Coal"
- }));
- contentPane.add(comboBox1);
- comboBox1.setBounds(175, 45, 125, 25);
- //---- label3 ----
- label3.setText("Version: "+version);
- contentPane.add(label3);
- label3.setBounds(15, 80, 124, label3.getPreferredSize().height);
- //CheckBox1-------
- checkBox1.setText("Quick Deposit?");
- contentPane.add(checkBox1);
- checkBox1.setBounds(new Rectangle(new Point(115, 75), checkBox1.getPreferredSize()));
- //CheckBox2-------
- checkBox2.setText("Evade Combat?");
- contentPane.add(checkBox2);
- checkBox2.setBounds(new Rectangle(new Point(115, 95), checkBox2.getPreferredSize()));
- //CheckBox3-------
- checkBox3.setText("Faster Banking?");
- //contentPane.add(checkBox3);
- checkBox3.setBounds(new Rectangle(new Point(115, 115), checkBox3.getPreferredSize()));
- //---- button1 ----
- button1.setText("Start!");
- button1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- button1ActionPerformed(e);
- }
- });
- contentPane.add(button1);
- button1.setBounds(40, 115, 75, 30);
- //---- button2 ----
- button2.setText("Exit");
- button2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- button2ActionPerformed(e);
- }
- });
- contentPane.add(button2);
- button2.setBounds(225, 115, 75, 30);
- { // 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);
- }
- setSize(325, 190);
- setLocationRelativeTo(getOwner());
- }
- private JLabel label1;
- private JLabel label2;
- private JComboBox comboBox1;
- private JLabel label3;
- private JButton button1;
- private JButton button2;
- private JCheckBox checkBox1;
- private JCheckBox checkBox2;
- private JCheckBox checkBox3;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement