rendered paste bodyimport java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.*;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.util.Filter;
import org.rsbot.script.Script;
import javax.imageio.ImageIO;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.io.IOException;
import java.net.URL;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSPath;
import org.rsbot.script.wrappers.RSTile;
@ScriptManifest(authors = { "Wei Su" }, name = "Ultimate Smither & Smelter!", version = 1.2, description = "Smelts, and smiths!", keywords = {
"smith", "plate", "hammer" })
public class UltimateSmither extends Script implements PaintListener,
MessageListener, ActionListener, MouseMotionListener, MouseListener {
// make componentID2 the component
Rectangle close = new Rectangle(7, 344, 499, 465);
Point p;
boolean hide = false;
public int componentID2 = 1;
public int componentID3 = 14;
// 300 is mandatory
public String smeltBar;
public String actionType;
public String paintLocation;
public int componentID1 = 300;
public long xpHour;
public String barType = null;
public String making = null;
public int barID;
public String place = null;
public int hammerID;
public String hammerType;
public double random1;
public double random2;
// 14112 sacred 2347hammer
RSTile bankingTile = null;
public long startTime, millis, hours, minutes, seconds, last;
RSTile anvilTile = null;
public String smeltingLocation;
public int bankBoothID;
public int[] bankBoothIDS = { 782, 25808, 2213, 35647, 26972, 11758 };
// how many to withdraw set on what they are smithing
public int withdrawX = 0;
public int nullCheck;
public int anvilID;
public int minBars;
RSTile bankboothtile = new RSTile(3190, 3435);
public int greaterY;
public int lowerY;
public int greaterX;
public int lowerX;
public int barID2;
public int withdrawX2;
public int barID3;
public int currExp;
public double division;
public int startExp;
@Override
public boolean onStart() {
gui GUI = new gui();
GUI.setVisible(true);
while (GUI.isVisible()) {
sleep(50);
}
mouse.setSpeed(3);
startTime = System.currentTimeMillis();
startExp = skills.getCurrentExp(skills.getIndex("Smithing"));
if (actionType == "Smelting") {
hammerType = "Golden Hammer";
componentID1 = 900;
making = barType;
if (barType == "Bronze") {
barID3 = 2349;
random1 = 6.2;
random2 = 1;
}
if (barType == "Iron") {
barID3 = 2351;
random1 = 12.5;
random2 = 1;
}
if (barType == "Steel") {
barID3 = 2353;
random1 = 17.5;
random2 = 1;
}
if (barType == "Mithril") {
barID3 = 2359;
random1 = 30;
random2 = 1;
}
if (barType == "Gold") {
barID3 = 2357;
random1 = 56.2;
random2 = 1;
}
if (barType == "Silver") {
barID3 = 2355;
random1 = 13.8;
random2 = 1;
}
if (barType == "Adamant") {
barID3 = 2361;
random1 = 37.5;
random2 = 1;
}
if (barType == "Rune") {
barID3 = 2363;
random1 = 50;
random2 = 1;
}
if (smeltingLocation == "Al Kharid") {
bankingTile = new RSTile(3269, 3169);
anvilTile = new RSTile(3274, 3186);//
bankBoothID = 35647;
anvilID = 11666;//
greaterY = 3170;
lowerY = 3168;
paintLocation = "Al Kharid";
}
if (smeltingLocation == "Edgeville") {
bankingTile = new RSTile(3097, 3496);
anvilTile = new RSTile(3108, 3502);//
bankBoothID = 26972;
anvilID = 26814;//
greaterX = 3098;
lowerX = 3096;
paintLocation = "Edgeville";
}
if (smeltingLocation == "Falador East Bank") {
bankingTile = new RSTile(2946, 3368);
anvilTile = new RSTile(2975, 3369);//
bankBoothID = 11758;
anvilID = 11666;//
greaterX = 2947;
lowerX = 2945;
paintLocation = "Falador";
}
if (smeltBar == "Bronze") {
barID = 438;
barID2 = 436;
withdrawX = 14;
withdrawX2 = 14;
minBars = 1;
componentID2 = 14;
}
if (smeltBar == "Iron") {
barID = 440;
barID2 = 440;
withdrawX = 28;
withdrawX2 = 28;
minBars = 1;
componentID2 = 16;
}
if (smeltBar == "Silver") {
barID = 442;
barID2 = 442;
withdrawX = 28;
withdrawX2 = 28;
minBars = 1;
componentID2 = 17;
}
if (smeltBar == "Steel") {
barID = 453;
barID2 = 440;
withdrawX = 18;
withdrawX2 = 9;
minBars = 2;
componentID2 = 18;
}
if (smeltBar == "Gold") {
barID = 444;
barID2 = 444;
withdrawX = 28;
withdrawX2 = 28;
minBars = 1;
componentID2 = 19;
}
if (smeltBar == "Mithril") {
barID = 447;
barID2 = 453;
withdrawX = 5;
withdrawX2 = 20;
minBars = 1;
componentID2 = 20;
}
if (smeltBar == "Adamant") {
barID = 449;
barID2 = 453;
withdrawX = 4;
withdrawX2 = 24;
minBars = 1;
componentID2 = 21;
}
if (smeltBar == "Rune") {
barID = 451;
barID2 = 453;
withdrawX = 3;
withdrawX2 = 24;
minBars = 1;
componentID2 = 22;
}
}
if (actionType == "Smithing") {
if (hammerType == "Hammer") {
hammerID = 2347;
} else if (hammerType == "Sacred Hammer") {
hammerID = 14112;
} else if (hammerType == "Golden Hammer") {
hammerID = 2949;
}
if (place == "Varrock West") {
bankingTile = new RSTile(3189, 3435);
anvilTile = new RSTile(3189, 3426);
bankBoothID = 782;
anvilID = 2783;
greaterY = 3436;
lowerY = 3434;
paintLocation = "Varrock West";
}
if (place == "Varrock East") {
bankingTile = new RSTile(3253, 3420);
anvilTile = new RSTile(3229, 3434);
bankBoothID = 782;
anvilID = 2783;
greaterX = 3254;
lowerX = 3252;
paintLocation = "Varrock Eeast";
}
if (place == "Camelot") {
bankingTile = new RSTile(2724, 3493);
anvilTile = new RSTile(2712, 3494);
bankBoothID = 25808;
anvilID = 2783;
lowerX = 2723;
greaterX = 2725;
paintLocation = "Camelot";
}
if (place == "Yanille") {
bankingTile = new RSTile(2613, 3091);
anvilTile = new RSTile(2612, 3081);
bankBoothID = 2213;
anvilID = 2783;
greaterY = 3092;
lowerY = 3090;
paintLocation = "Yanille";
}
if (barType == "Bronze") {
barID = 2349;
barID2 = 2349;
random1 = 1;
}
if (barType == "Iron") {
barID = 2351;
barID2 = 2351;
random1 = 2;
}
if (barType == "Steel") {
barID = 2353;
barID2 = 2353;
random1 = 3;
}
if (barType == "Mithril") {
barID = 2359;
barID2 = 2359;
random1 = 4;
}
if (barType == "Adamanite") {
barID = 2361;
barID2 = 2361;
random1 = 5;
}
if (barType == "Rune") {
barID = 2363;
barID = 2363;
random1 = 6;
}
if (making == "Dagger") {
componentID2 = 19;
random2 = 12.5;
}
if (making == "Hatchet") {
componentID2 = 27;
random2 = 12.5;
}
if (making == "Mace") {
componentID2 = 35;
random2 = 12.5;
}
if (making == "Medium Helm") {
componentID2 = 43;
random2 = 12.5;
}
if (making == "Crossbow Bolts") {
componentID2 = 51;
random2 = 12;
}
if (making == "Sword") {
componentID2 = 59;
random2 = 12.5;
}
if (making == "Dart Tips") {
componentID2 = 67;
random2 = 12.5;
}
if (making == "Nails") {
componentID2 = 75;
random2 = 12.5;
}
if (making == "Wire") {
componentID2 = 83;
random2 = 12.5;
}
if (making == "Arrow Tips") {
componentID2 = 107;
random2 = 12.5;
}
if (making == "Scimitar") {
componentID2 = 115;
random2 = 25;
}
if (making == "Crossbow Limbs") {
componentID2 = 123;
random2 = 12.5;
}
if (making == "Long Sword") {
componentID2 = 131;
random2 = 25;
}
if (making == "Throwing Knife") {
componentID2 = 139;
random2 = 12.5;
}
if (making == "Full Helm") {
componentID2 = 147;
random2 = 25;
}
if (making == "Square Shield") {
componentID2 = 155;
random2 = 25;
}
if (making == "Bullseye Lantern") {
componentID2 = 163;
}
if (making == "Grapple") {
componentID2 = 171;
}
if (making == "Warhammer") {
componentID2 = 179;
random2 = 37.5;
}
if (making == "Battle Axe") {
componentID2 = 187;
random2 = 37.5;
}
if (making == "Chain Body") {
componentID2 = 195;
random2 = 37.5;
}
if (making == "Kite Shield") {
componentID2 = 203;
random2 = 37.5;
}
if (making == "Claws") {
componentID2 = 211;
random2 = 25;
}
if (making == "Two Handed Sword") {
componentID2 = 219;
random2 = 37.5;
}
if (making == "Plate Skirt") {
componentID2 = 227;
random2 = 37.5;
}
if (making == "Plate Legs") {
componentID2 = 235;
random2 = 37.5;
}
if (making == "Plate Body") {
componentID2 = 243;
random2 = 62.5;
}
if (componentID2 == 67 || componentID2 == 75 || componentID2 == 83
|| componentID2 == 91 || componentID2 == 107
|| componentID2 == 139 || componentID2 == 163
|| componentID2 == 171 && hammerType != "Golden Hammer") {
withdrawX = 27;
minBars = 1;
}
if (componentID2 == 67 || componentID2 == 75 || componentID2 == 83
|| componentID2 == 91 || componentID2 == 107
|| componentID2 == 139 || componentID2 == 163
|| componentID2 == 171 && hammerType == "Golden Hammer") {
withdrawX = 28;
minBars = 1;
}
if (componentID2 == 131 || componentID2 == 147
|| componentID2 == 155 || componentID2 == 211
&& hammerType != "Golden Hammer") {
withdrawX = 26;
minBars = 2;
}
if (componentID2 == 131 || componentID2 == 147
|| componentID2 == 155 || componentID2 == 211
&& hammerType == "Golden Hammer") {
withdrawX = 28;
minBars = 2;
}
if (componentID2 == 179 || componentID2 == 187
|| componentID2 == 195 || componentID2 == 203
|| componentID2 == 219 || componentID2 == 227
|| componentID2 == 235) {
withdrawX = 27;
minBars = 3;
}
if (componentID2 == 243) {
withdrawX = 25;
minBars = 5;
}
}
return true;
}
public int loop() {
try {
if (getMyPlayer().getAnimation() == -1) {
nullCheck++;
} else {
nullCheck = 1;
}
if (interfaces.getComponent(componentID1, componentID3).isValid()) {
nullCheck = 0;
}
switch (getCase()) {
case 1:
walkingBank();
return random(50, 100);
case 2:
useBank();
return random(50, 100);
case 3:
walkingAnvil();
return random(50, 100);
case 4:
useAnvil();
return random(50, 100);
case 5:
doInterface();
return random(50, 100);
}
} catch (Exception ignore) {
}
return random(50, 100);
}
public int getCase() {
if ((needBars() || needHammer()) && !atBank()) {
return 1;
}
if ((needBars() || needHammer()) && atBank()) {
return 2;
}
if (!needBars() && !needHammer() && !atAnvil()) {
return 3;
}
if (needAnvil() && atAnvil() && (!needBars() && !needHammer())) {
return 4;
}
if (interfaces.getComponent(componentID1, componentID3).isValid()
&& (!needBars() && !needHammer())) {
return 5;
}
return -1;
}
public boolean atAnvil() {
if (calc.distanceTo(anvilTile) < 3) {
return true;
} else {
return false;
}
}
public boolean needBars() {
if (!inventory.contains(barID)
|| (inventory.getCount(barID) < minBars && inventory
.getCount(barID) != minBars)
|| !inventory.contains(barID2)
|| inventory.getCount(barID2) <= 0) {
return true;
} else {
return false;
}
}
public void walkingBank() {
RSPath path = null;
if (path == null) {
path = walking.getPath(bankingTile);
}
path.traverse();
}
public void walkingAnvil() {
RSPath path = null;
if (path == null) {
path = walking.getPath(anvilTile);
}
path.traverse();
}
public boolean needHammer() {
if (!inventory.contains(hammerID) && hammerType != "Golden Hammer") {
return true;
} else {
return false;
}
}
public boolean atBank() {
if (calc.distanceTo(bankingTile) < 5) {
return true;
} else {
return false;
}
}
public RSObject getRSObject() {
final Filter<RSObject> filter = new Filter<RSObject>() {
@Override
public boolean accept(RSObject n) {
return ((n.getLocation().getX() < greaterX && n.getLocation()
.getX() > lowerX) || (validBooth(n)
&& n.getLocation().getY() < greaterY && n.getLocation()
.getY() > lowerY));
}
};
return objects.getNearest(filter);
}
public boolean validBooth(RSObject n) {
if (n != null) {
for (int id : bankBoothIDS) {
if (id == n.getID())
return true;
}
}
return false;
}
public void useBank() {
RSObject bankBooth = getRSObject();
camera.turnTo(bankBooth);
if (actionType == "Smelting") {
if (bankBooth.isOnScreen()) {
if (!bank.isOpen()) {
bankBooth.doAction("Use-q");
sleep(random(1200, 1300));
} else {
if (bank.getCount(barID) < 28){
env.saveScreenshot(true);
stopScript(true);
}
if (inventory.contains(barID3)) {
bank.depositAll();
}
if (inventory.getCount(barID) != withdrawX
&& inventory.getCount(barID) > withdrawX) {
bank.depositAll();
sleep(random(1000, 1050));
} else if (inventory.getCount(barID) != withdrawX
&& inventory.getCount(barID) < withdrawX
&& inventory.getCount(barID) > 0) {
bank.depositAll();
sleep(random(1000, 1050));
} else if (inventory.getCount(barID) <= 0) {
bank.withdraw(barID, withdrawX);
sleep(random(1000, 1050));
}
if (inventory.getCount(barID2) != withdrawX2
&& inventory.getCount(barID2) > withdrawX2
&& inventory.getCount(barID2) > 0) {
bank.depositAll();
sleep(random(1000, 1050));
} else if (inventory.getCount(barID2) != withdrawX2
&& inventory.getCount(barID2) < withdrawX2
&& inventory.getCount(barID2) > 0) {
bank.depositAll();
sleep(random(1000, 1050));
} else if (inventory.getCount(barID2) <= 0) {
bank.withdraw(barID2, withdrawX2);
sleep(random(1000, 1050));
}
}
}
}
if (actionType == "Smithing") {
if (bankBooth.isOnScreen()) {
if (!bank.isOpen()) {
bankBooth.doAction("Use-q");
sleep(random(1200, 1300));
} else {
if (bank.getCount(barID) < 28){
env.saveScreenshot(true);
stopScript(true);
}
if (!inventory.contains(hammerID)) {
bank.withdraw(hammerID, 1);
sleep(random(800, 1000));
}
if (inventory.getCount(barID) < minBars || inventory.getCount(barID) < 5) {
bank.depositAllExcept(hammerID);
bank.withdraw(barID, withdrawX);
sleep(random(800, 1200));
if (inventory.getCount(barID2) < minBars) {
bank.depositAllExcept(hammerID);
bank.withdraw(barID2, withdrawX2);
sleep(random(800, 1200));
}
}
}
}
}
}
public void useAnvil() {
RSObject anvil = objects.getNearest(anvilID);
RSItem bar = inventory.getItem(barID);
if (actionType == "Smelting") {
if (nullCheck >= 20) {
camera.turnTo(anvil);
anvil.doAction("Smelt");
sleep(600);
interfaces.getComponent(905, componentID2).getComponent(57)
.doClick();
sleep(3000);
nullCheck=0;
}
}
if (actionType == "Smithing") {
camera.turnTo(getRSObject());
camera.setPitch(100);
bar.doClick(true); sleep(random(100,200)); anvil.doClick(true);
sleep(random(1000, 1200));
}
}
public void doInterface() {
if (actionType == "Smelting") {
interfaces.getComponent(905, componentID2).getComponent(57)
.doClick();
}
if (actionType == "Smithing") {
if (componentID2 > 190) {
interfaces.getComponent(300, 16).getComponent(5).doClick();
interfaces.getComponent(300, 16).getComponent(5).doClick();
interfaces.getComponent(300, 16).getComponent(5).doClick();
interfaces.getComponent(300, 16).getComponent(5).doClick();
sleep(random(300, 400));
interfaces.getComponent(componentID1, componentID2).doAction(
"Make all");
sleep(random(1500, 1600));
} else {
interfaces.getComponent(300, 16).getComponent(4).doClick();
interfaces.getComponent(300, 16).getComponent(4).doClick();
interfaces.getComponent(300, 16).getComponent(4).doClick();
interfaces.getComponent(300, 16).getComponent(4).doClick();
interfaces.getComponent(componentID1, componentID2).doAction(
"Make all");
sleep(random(1500, 1600));
}
}
}
public boolean needAnvil() {
if ((!interfaces.getComponent(componentID1, componentID3).isValid() || !interfaces
.getComponent(916, 1).isValid()) && nullCheck > 15) {
return true;
} else {
return false;
}
}
@Override
public void onFinish() {
}
// START: Code generated using Enfilade's Easel
public void mouseClicked(MouseEvent e) {
p = e.getPoint();
if(close.contains(p) && !hide){
hide = true;
} else if(close.contains(p) && hide){
hide = false;
}
}
// END: Code generated using Enfilade's Easel
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseDragged(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseMoved(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void messageReceived(MessageEvent arg0) {
}
// START: Code generated using Enfilade's Easel
private Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch (IOException e) {
return null;
}
}
private final Color color1 = new Color(255, 0, 51);
private final Font font1 = new Font("Arial", 1, 13);
private final Image img1 = getImage("http://img7.imageshack.us/img7/7618/unled2p.png");
public void onRepaint(Graphics g1) {
Graphics2D g = (Graphics2D) g1;
if(!hide) {
currExp = skills.getCurrentExp(skills.getIndex("Smithing")) - startExp;
division = random1*random2;
double barsused;
double barsperhour;
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;
final long totalSeconds = ((System.currentTimeMillis() - startTime) / 1000);
int xpPerHour = 0;
if (totalSeconds == 0) {
xpPerHour = 0;
} else {
xpPerHour = (int) ((currExp * 3600) / totalSeconds);
}
float xpsec = 0;
if ((minutes > 0 || hours > 0 || seconds > 0) && currExp > 0) {
xpsec = ((float) currExp)
/ (float) (seconds + (minutes * 60) + (hours * 60 * 60));
}
float xpmin = xpsec * 60;
float xphour = xpmin * 60;
barsperhour = xphour/ division;
barsused = currExp / division;
g.drawImage(img1, 2, 274, null);
g.setFont(font1);
g.setColor(color1);
g.drawString("Time elapsed : " + hours + ":" + minutes + ":" + seconds+" Gained xp: "+currExp,
14, 384);
g.drawString("Exp/ hour : " + (int) xphour+" "+"Items made: "+barsused, 14, 406);
g.drawString("Location : " + paintLocation+" "+"Items/hr: "+barsperhour, 14, 426);
g.drawString("Making: " +barType+" "+ making, 14, 446);
final int percent = skills.getPercentToNextLevel(Skills.SMITHING); // Everything
// down
// to
// the
// }
// is
// a
// progress
// bar.
g.setColor(Color.red);
g.fillRoundRect(5, 309, 100, 10, 15, 15); // these must be on same
// cordinates
g.setColor(Color.green);
g.fillRoundRect(5, 309, percent, 10, 15, 15); // these must be on same
// cordinates
g.setColor(Color.black);
g.drawString("" + percent + "%", 45, 310); // this must be on the center
// of the bar
g.drawRoundRect(5, 309, 100, 10, 15, 15);
g.drawRoundRect(5, 309, percent, 10, 15, 15);
}
if(hide){
final Color color1 = new Color(255, 0, 0);
final Color color2 = new Color(102, 255, 0);
final Color color3 = new Color(255, 255, 255, 0);
g.setFont(font1);
g.setColor(color2);
g.drawString("SHOW", 203, 367);
g.setColor(color3);
g.fillRect(198, 134, 80, 43);//this is a clear square box i made for the close box in the ints
}
}
// END: Code generated using Enfilade's Easel
public class gui extends JFrame {
public gui() {
initComponents();
}
private void button2ActionPerformed(ActionEvent e) {
actionType = "Smelting";
smeltBar = comboBox6.getSelectedItem().toString();
barType = comboBox6.getSelectedItem().toString();
smeltingLocation = comboBox5.getSelectedItem().toString();
dispose();
}
private void button1ActionPerformed(ActionEvent e) {
barType = comboBox1.getSelectedItem().toString();
hammerType = comboBox4.getSelectedItem().toString();
making = comboBox2.getSelectedItem().toString();
place = comboBox3.getSelectedItem().toString();
actionType = "Smithing";
dispose();
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY
// //GEN-BEGIN:initComponents
comboBox1 = new JComboBox();
comboBox2 = new JComboBox();
comboBox3 = new JComboBox();
comboBox4 = new JComboBox();
button1 = new JButton();
comboBox5 = new JComboBox();
comboBox6 = new JComboBox();
button2 = new JButton();
label1 = new JLabel();
label2 = new JLabel();
label3 = new JLabel();
label4 = new JLabel();
label5 = new JLabel();
label6 = new JLabel();
// ======== this ========
setTitle("Wei Su's ULTIMATE smithing script!");
Container contentPane = getContentPane();
contentPane.setLayout(null);
comboBox1
.setModel(new DefaultComboBoxModel(new String[] { "Bronze",
"Iron", "Steel", "Mithril", "Adamanite", "Rune" }));
contentPane.add(comboBox1);
comboBox1.setBounds(40, 115, 105, 55);
comboBox2.setModel(new DefaultComboBoxModel(new String[] {
"Dagger", "Hatchet", "Mace", "Medium Helm",
"Crossbow Bolts", "Sword", "Dart Tips", "Nails", "Wire",
"Arrow Tips", "Scimitar", "Crossbow Limbs", "Long Sword",
"Throwing Knife", "Full Helm", "Square Shield",
"Bullseye Lantern", "Grapple Tip", "Warhammer",
"Battle Axe", "Chain Body", "Kite Shield", "Claws",
"Two Handed Sword", "Plate Skirt", "Plate Legs",
"Plate Body" }));
contentPane.add(comboBox2);
comboBox2.setBounds(40, 185, 105, 55);
comboBox3.setModel(new DefaultComboBoxModel(new String[] {
"Varrock West", "Varrock East", "Camelot", "Yanille" }));
contentPane.add(comboBox3);
comboBox3.setBounds(150, 115, 105, 55);
comboBox4.setModel(new DefaultComboBoxModel(new String[] {
"Hammer", "Sacred Hammer", "Golden Hammer" }));
contentPane.add(comboBox4);
comboBox4.setBounds(150, 185, 105, 55);
// ---- button1 ----
button1.setText("Smith Items");
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button1ActionPerformed(e);
}
});
contentPane.add(button1);
button1.setBounds(260, 165, 90, button1.getPreferredSize().height);
comboBox5.setModel(new DefaultComboBoxModel(new String[] {
"Al Kharid", "Edgeville", "Falador East Bank" }));
contentPane.add(comboBox5);
comboBox5.setBounds(40, 35, 105, 50);
comboBox6.setModel(new DefaultComboBoxModel(new String[] {
"Bronze", "Iron", "Silver", "Steel", "Gold", "Mithril",
"Adamant", "Rune" }));
contentPane.add(comboBox6);
comboBox6.setBounds(150, 35, 105, 50);
// ---- button2 ----
button2.setText("Smelt Bars");
button2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button2ActionPerformed(e);
}
});
contentPane.add(button2);
button2.setBounds(260, 45, 90, button2.getPreferredSize().height);
// ---- label1 ----
label1.setText("Bar type");
contentPane.add(label1);
label1.setBounds(new Rectangle(new Point(40, 20), label1
.getPreferredSize()));
// ---- label2 ----
label2.setText("Location");
contentPane.add(label2);
label2.setBounds(new Rectangle(new Point(150, 20), label2
.getPreferredSize()));
// ---- label3 ----
label3.setText("Bar type");
contentPane.add(label3);
label3.setBounds(new Rectangle(new Point(40, 100), label3
.getPreferredSize()));
// ---- label4 ----
label4.setText("Location");
contentPane.add(label4);
label4.setBounds(new Rectangle(new Point(150, 100), label4
.getPreferredSize()));
// ---- label5 ----
label5.setText("Item to smith");
contentPane.add(label5);
label5.setBounds(new Rectangle(new Point(40, 170), label5
.getPreferredSize()));
// ---- label6 ----
label6.setText("Type of hammer");
contentPane.add(label6);
label6.setBounds(new Rectangle(new Point(150, 170), label6
.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 JComboBox comboBox1;
private JComboBox comboBox2;
private JComboBox comboBox3;
private JComboBox comboBox4;
private JButton button1;
private JComboBox comboBox5;
private JComboBox comboBox6;
private JButton button2;
private JLabel label1;
private JLabel label2;
private JLabel label3;
private JLabel label4;
private JLabel label5;
private JLabel label6;
// JFormDesigner - End of variables declaration //GEN-END:variables
}
/*
* public class SmitherGUI extends JFrame { public SmitherGUI() {
* initComponents(); }
*
* private void button1ActionPerformed(ActionEvent e) { barType =
* comboBox1.getSelectedItem().toString(); hammerType =
* comboBox4.getSelectedItem().toString(); making =
* comboBox2.getSelectedItem().toString(); place =
* comboBox3.getSelectedItem().toString(); actionType = "Smithing";
* dispose();
*
* }
*
* private void button2ActionPerformed(ActionEvent e) { actionType =
* "Smelting"; smeltBar = comboBox6.getSelectedItem().toString(); barType =
* comboBox6.getSelectedItem().toString(); smeltingLocation =
* comboBox5.getSelectedItem().toString(); dispose(); // /get bar id and
* location info }
*
* private void initComponents() { // JFormDesigner - Component
* initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents comboBox1 =
* new JComboBox(); comboBox2 = new JComboBox(); label1 = new JLabel();
* label2 = new JLabel(); label3 = new JLabel(); button1 = new JButton();
* label4 = new JLabel(); label5 = new JLabel(); comboBox3 = new
* JComboBox(); label6 = new JLabel(); comboBox4 = new JComboBox(); label7 =
* new JLabel(); comboBox5 = new JComboBox(); comboBox6 = new JComboBox();
* label8 = new JLabel(); label9 = new JLabel(); button2 = new JButton();
*
* // ======== this ======== Container contentPane = getContentPane();
* contentPane.setLayout(null);
*
* // ---- comboBox1 ---- comboBox1 .setModel(new DefaultComboBoxModel(new
* String[] { "Bronze", "Iron", "Steel", "Mithril", "Adamanite", "Rune" }));
* contentPane.add(comboBox1); comboBox1.setBounds(50, 200, 125, 50);
*
* // ---- comboBox2 ---- comboBox2.setModel(new DefaultComboBoxModel(new
* String[] { "Dagger", "Hatchet", "Mace", "Medium Helm", "Crossbow Bolts",
* "Sword", "Dart Tips", "Nails", "Wire", "Arrow Tips", "Scimitar",
* "Crossbow Limbs", "Long Sword", "Throwing Knife", "Full Helm",
* "Square Shield", "Bullseye Lantern", "Grapple Tip", "Warhammer",
* "Battle Axe", "Chain Body", "Kite Shield", "Claws", "Two Handed Sword",
* "Plate Skirt", "Plate Legs", "Plate Body" }));
* contentPane.add(comboBox2); comboBox2.setBounds(50, 270, 125, 50);
*
* // ---- label1 ---- label1.setText("Item to smith");
* contentPane.add(label1); label1.setBounds(new Rectangle(new Point(50,
* 255), label1 .getPreferredSize()));
*
* // ---- label2 ---- label2.setText("Bar Type"); contentPane.add(label2);
* label2.setBounds(new Rectangle(new Point(50, 185), label2
* .getPreferredSize()));
*
* // ---- label3 ----
* label3.setText("Wei Su & his ultimate smither/Smelter!");
* label3.setFont(new Font("Monotype Corsiva", Font.ITALIC, 22));
* contentPane.add(label3); label3.setBounds(new Rectangle(new Point(55,
* 10), label3 .getPreferredSize()));
*
* // ---- button1 ---- button1.setText("Smith Items");
* button1.addActionListener(new ActionListener() { public void
* actionPerformed(ActionEvent e) { button1ActionPerformed(e); } });
* contentPane.add(button1); button1.setBounds(135, 330, 125,
* button1.getPreferredSize().height); contentPane.add(label4);
* label4.setBounds(new Rectangle(new Point(205, 205), label4
* .getPreferredSize()));
*
* // ---- label5 ---- label5.setText(" .");
* contentPane.add(label5); label5.setBounds(new Rectangle(new Point(340,
* 330), label5 .getPreferredSize()));
*
* // ---- comboBox3 ---- comboBox3.setModel(new DefaultComboBoxModel(new
* String[] { "Varrock West", "Varrock East", "Camelot", "Yanille" }));
* contentPane.add(comboBox3); comboBox3.setBounds(205, 200, 125, 50);
*
* // ---- label6 ---- label6.setText("Anvil location");
* contentPane.add(label6); label6.setBounds(new Rectangle(new Point(205,
* 185), label6 .getPreferredSize()));
*
* // ---- comboBox4 ---- comboBox4.setModel(new DefaultComboBoxModel(new
* String[] { "Hammer", "Sacred Hammer", "Golden Hammer" }));
* contentPane.add(comboBox4); comboBox4.setBounds(205, 270, 125, 50);
*
* // ---- label7 ---- label7.setText("Type of hammer");
* contentPane.add(label7); label7.setBounds(new Rectangle(new Point(205,
* 255), label7 .getPreferredSize()));
*
* // ---- comboBox5 ---- comboBox5.setModel(new DefaultComboBoxModel(new
* String[] { "Al Kharid", "Edgeville", "Falador East Bank" }));
* contentPane.add(comboBox5); comboBox5.setBounds(200, 70, 125, 50);
*
* // ---- comboBox6 ---- comboBox6.setModel(new DefaultComboBoxModel(new
* String[] { "Bronze", "Iron", "Silver", "Steel", "Gold", "Mithril",
* "Adamant", "Rune" })); contentPane.add(comboBox6);
* comboBox6.setBounds(50, 70, 125, 50);
*
* // ---- label8 ---- label8.setText("Bar Type"); contentPane.add(label8);
* label8.setBounds(new Rectangle(new Point(50, 55), label8
* .getPreferredSize()));
*
* // ---- label9 ---- label9.setText("Furnace location");
* contentPane.add(label9); label9.setBounds(new Rectangle(new Point(200,
* 55), label9 .getPreferredSize()));
*
* // ---- button2 ---- button2.setText("Smelt Bars");
* button2.addActionListener(new ActionListener() { public void
* actionPerformed(ActionEvent e) { button2ActionPerformed(e); } });
* contentPane.add(button2); button2.setBounds(130, 145, 125,
* button2.getPreferredSize().height);
*
* { // 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 JComboBox comboBox1; private JComboBox
* comboBox2; private JLabel label1; private JLabel label2; private JLabel
* label3; private JButton button1; private JLabel label4; private JLabel
* label5; private JComboBox comboBox3; private JLabel label6; private
* JComboBox comboBox4; private JLabel label7; private JComboBox comboBox5;
* private JComboBox comboBox6; private JLabel label8; private JLabel
* label9; private JButton button2; // JFormDesigner - End of variables
* declaration //GEN-END:variables }
*/
}