Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.AlphaComposite;
- import java.awt.Color;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Point;
- import java.awt.Polygon;
- import java.awt.Rectangle;
- import java.awt.Toolkit;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.net.URL;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.GroupLayout;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JRadioButton;
- import javax.swing.LayoutStyle;
- import javax.swing.SwingUtilities;
- import org.powerbot.concurrent.Task;
- 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.Settings;
- 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.NPCs;
- import org.powerbot.game.api.methods.interactive.Players;
- 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.Filter;
- import org.powerbot.game.api.util.Random;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.util.Timer;
- import org.powerbot.game.api.wrappers.Tile;
- import org.powerbot.game.api.wrappers.interactive.NPC;
- import org.powerbot.game.api.wrappers.interactive.Player;
- import org.powerbot.game.api.wrappers.node.Item;
- import org.powerbot.game.bot.event.MessageEvent;
- import org.powerbot.game.bot.event.listener.MessageListener;
- import org.powerbot.game.bot.event.listener.PaintListener;
- @Manifest(authors = { "_phl0w" }, name = "iTBarbFisher", version = 1.6, description = "Does the barbarian fishing training! - Have barbarian rod in your toolbelt & start near the fishing spots!", website = "http://www.powerbot.org/community/topic/697455-itbarbfisher-fastest-fishing-xp-in-the-game-fishingagility-xp-50k-xph/")
- public class iTBarbFisher extends ActiveScript implements PaintListener,
- MessageListener {
- private int caughtSturgeons, caughtSalmons, caughtTrouts,
- startFishingLevel, startFishingExp, startAgilityLevel,
- startAgilityExp, pouch = -1, urnsCompleted;
- private long startTime;
- private boolean isDropping, quickDrop = true, debug = false, urns = false,
- guiInitialized;
- private String status = "waiting for gui";
- private Timer inactivityTimer;
- private Tile startTile = null;
- private final Pattern UPDATER_VERSION_PATTERN = Pattern
- .compile("version\\s*=\\s*([0-9.]+)");
- private Object[][] data = { { "None", -1 },
- { "Granite crab (16 summoning)", 12009 },
- { "Ibis (56 summoning)", 12531 },
- { "Granite lobster (74 summoning)", 12069 } };
- private int getPouch(String str) {
- for (int i = 0; i < data.length; i++) {
- if (data[i][0].equals(str)) {
- return (Integer) data[i][1];
- }
- }
- return -1;
- }
- public double getVersion() {
- return iTBarbFisher.class.getAnnotation(Manifest.class).version();
- }
- @Override
- protected void setup() {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- GUI g = new GUI();
- g.setVisible(true);
- }
- });
- startTime = System.currentTimeMillis();
- startFishingLevel = Skills.getLevel(Skills.FISHING);
- startFishingExp = Skills.getExperience(Skills.FISHING);
- startAgilityLevel = Skills.getLevel(Skills.AGILITY);
- startAgilityExp = Skills.getExperience(Skills.AGILITY);
- inactivityTimer = new Timer(0);
- startTile = new Tile(2499, 3508, 0);
- if (!debug) {
- provide(new Fish());
- provide(new Drop());
- provide(new Walker());
- provide(new Antiban());
- provide(new SummonPouch());
- provide(new ClickUrn());
- provide(new TeleportUrn());
- }
- doUpdates("http://phl0w.site88.net/scripts/barb.php");
- }
- private class Walker extends Strategy implements Task {
- NPC spot = getNearestSpot();
- @Override
- public void run() {
- if (Calculations.distance(Players.getLocal().getLocation(),
- startTile) >= 16) {
- Walking.findPath(startTile).traverse();
- }
- Walking.findPath(spot.getLocation()).traverse();
- }
- @Override
- public boolean validate() {
- return guiInitialized
- && spot != null
- && !spot.isOnScreen()
- && Calculations.distance(new Tile(2520, 3518, 0),
- spot.getLocation()) > 5;
- }
- }
- public class Fish extends Strategy implements Task {
- @Override
- public void run() {
- if (Tabs.getCurrent() != Tabs.INVENTORY) {
- Tabs.INVENTORY.open();
- Time.sleep(Random.nextInt(300, 600));
- }
- while (!getNearestSpot().interact("Use-rod")) {
- Time.sleep(Random.nextInt(80, 120));
- }
- status = "fishing";
- Time.sleep(Random.nextInt(1200, 1800));
- }
- @Override
- public boolean validate() {
- return guiInitialized
- && (!isDropping && !isFishing()
- && Inventory.getCount() < 28 && getBait() != null
- && getBait().getStackSize() > 0
- && !Players.getLocal().isMoving()
- && getNearestSpot() != null && getNearestSpot()
- .isOnScreen())
- || inactivityTimer.getElapsed() >= 30000;
- }
- private boolean isFishing() {
- return Players.getLocal().getAnimation() != -1
- && Players.getLocal().getInteracting() != null
- && Players.getLocal().getInteracting() instanceof NPC;
- }
- }
- private class Drop extends Strategy implements Task {
- @Override
- public void run() {
- status = "dropping";
- isDropping = true;
- if (quickDrop) {
- int[] path = { 0, 4, 8, 12, 16, 20, 24, 25, 21, 17, 13, 9, 5,
- 1, 2, 6, 10, 14, 18, 22, 26, 27, 23, 19, 15, 11, 7, 3 };
- for (int slot = 0; slot < path.length; slot++) {
- Item x = Inventory.getItemAt(path[slot]);
- if (x.getId() == 11328 || x.getId() == 11330
- || x.getId() == 11332 || x.getId() == 229) {
- int xPos = x.getWidgetChild().getAbsoluteX()
- + Random.nextInt(0, 5);
- int yPos = x.getWidgetChild().getAbsoluteY()
- + Random.nextInt(0, 5);
- Mouse.hop(xPos, yPos);
- Mouse.click(false);
- Time.sleep(10, 25);
- Mouse.hop(xPos, yPos + (path[slot] >= 24 ? 28 : 60));
- Mouse.click(true);
- }
- }
- getNearestSpot().interact("Use-rod");
- Time.sleep(500, 1000);
- } else {
- for (Item i : Inventory.getItems()) {
- if (i.getId() == 11328 || i.getId() == 11330
- || i.getId() == 11332 || i.getId() == 229) {
- while (!i.getWidgetChild().interact("Drop")) {
- Time.sleep(Random.nextInt(20, 50));
- }
- }
- }
- }
- isDropping = false;
- }
- public boolean validate() {
- return guiInitialized && Inventory.getCount() == 28;
- }
- }
- private class Antiban extends Strategy implements Task {
- @Override
- public boolean validate() {
- return true;
- }
- @Override
- public void run() {
- if (Random.nextInt(1, 250) < 14) {
- executeAntiban();
- }
- Time.sleep(Random.nextInt(1000, 2000));
- }
- public void executeAntiban() {
- int dx, dy;
- int r = Random.nextInt(0, 4);
- switch (r) {
- case 0:
- case 1:
- status = "moving camera";
- Camera.setAngle(Random.nextInt(20, 300));
- break;
- case 2:
- case 3:
- status = "moving mouse";
- dx = Random.nextInt(-30, 30);
- dy = Random.nextInt(-30, 30);
- Mouse.move(Mouse.getX() + dx, Mouse.getY() + dy);
- Time.sleep(Random.nextInt(20, 150));
- break;
- case 4:
- status = "checking player";
- Player player = Players.getNearest(new Filter<Player>() {
- @Override
- public boolean accept(Player p) {
- return !p.equals(Players.getLocal());
- }
- });
- if (player != null) {
- player.click(false);
- Time.sleep(Random.nextInt(400, 1000));
- dx = Random.nextInt(-16, 16);
- dy = Random.nextInt(-60, -20);
- Mouse.move(Mouse.getX() + dx, Mouse.getY() + dy);
- }
- Time.sleep(Random.nextInt(20, 150));
- break;
- }
- status = "fishing";
- }
- }
- private class SummonPouch extends Strategy implements Task {
- @Override
- public boolean validate() {
- return guiInitialized && Settings.get(448) == -1
- || Widgets.get(662, 1).getModelId() == -1 && pouch != -1
- && Inventory.getCount(pouch) > 0;
- }
- @Override
- public void run() {
- if (Skills.getLevel(Skills.SUMMONING) < 10) {
- if (canDrink()) {
- drink();
- }
- } else {
- while (!Inventory.getItem(pouch).getWidgetChild()
- .interact("Summon")) {
- Time.sleep(Random.nextInt(80, 120));
- }
- Time.sleep(Random.nextInt(300, 400));
- }
- }
- private boolean canDrink() {
- int potCount = 0;
- int[] pots = { 12140, 12142, 12144, 12146, 3024, 3026, 3028, 3030 };
- for (int pot : pots) {
- if (Inventory.getCount(pot) > 0) {
- potCount++;
- }
- }
- return potCount > 0;
- }
- private void drink() {
- int[] pots = { 12140, 12142, 12144, 12146, 3024, 3026, 3028, 3030 };
- for (int pot : pots) {
- if (Inventory.getItem(pot) != null) {
- while (!Inventory.getItem(pot).getWidgetChild()
- .interact("Drink")) {
- Time.sleep(Random.nextInt(80, 120));
- }
- Time.sleep(Random.nextInt(300, 400));
- }
- }
- }
- }
- private class ClickUrn extends Strategy implements Task {
- @Override
- public boolean validate() {
- return urns && Inventory.getCount(20348) > 0
- && !Widgets.get(905, 14).validate();
- }
- @Override
- public void run() {
- Inventory.getItem(20348).getWidgetChild().interact("Teleport");
- while (!Widgets.get(905, 14).validate()) {
- Time.sleep(50, 100);
- }
- }
- }
- private class TeleportUrn extends Strategy implements Task {
- @Override
- public boolean validate() {
- return Widgets.get(905, 14).validate() && urns
- && Inventory.getCount(20348) > 0;
- }
- @Override
- public void run() {
- Widgets.get(905, 14).interact("Teleport all");
- Time.sleep(2000, 3000);
- }
- }
- private AlphaComposite makeComposite(float alpha) {
- int type = AlphaComposite.SRC_OVER;
- return (AlphaComposite.getInstance(type, alpha));
- }
- @Override
- public void onRepaint(Graphics g) {
- Graphics2D g2d = (Graphics2D) g;
- Font title = new Font("Monotype Corsiva", Font.PLAIN, 25);
- Font author = new Font("Monotype Corsiva", Font.PLAIN, 16);
- Font info = new Font("Book Antiqua", Font.PLAIN, 15);
- Rectangle bg = new Rectangle(10, 23, 245, 200);
- Rectangle border = new Rectangle(8, 21, 245, 204);
- g2d.setColor(Color.DARK_GRAY);
- g2d.setComposite(makeComposite(0.5f));
- g2d.fill(bg);
- g2d.setColor(Color.BLACK);
- g2d.fill(border);
- g2d.setComposite(makeComposite(1.0f));
- g2d.setColor(Color.WHITE);
- g2d.fill(new Rectangle(Mouse.getX() + 1, Mouse.getY() - 4, 2, 15));
- g2d.fill(new Rectangle(Mouse.getX() - 6, Mouse.getY() + 2, 16, 2));
- int fishExpGained = Skills.getExperiences()[Skills.FISHING]
- - startFishingExp;
- int fishExpHour = (int) ((fishExpGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- int agilityExpGained = Skills.getExperiences()[Skills.AGILITY]
- - startAgilityExp;
- int agilityExpHour = (int) ((agilityExpGained) * 3600000D / (System
- .currentTimeMillis() - startTime));
- int sturgeonsHour = (int) ((caughtSturgeons) * 3600000D / (System
- .currentTimeMillis() - startTime));
- int salmonsHour = (int) ((caughtSalmons) * 3600000D / (System
- .currentTimeMillis() - startTime));
- int troutsHour = (int) ((caughtTrouts) * 3600000D / (System
- .currentTimeMillis() - startTime));
- int urnsHour = (int) ((urnsCompleted) * 3600000D / (System
- .currentTimeMillis() - startTime));
- g2d.setFont(title);
- g2d.drawString("iTBarbFisher v" + getVersion(), 12, 43);
- g2d.setFont(author);
- g2d.drawString("By: _phl0w", 12, 58);
- g2d.setFont(info);
- g2d.drawString(
- "Fishing: "
- + Skills.getLevels()[Skills.FISHING]
- + "(+"
- + (Skills.getLevels()[Skills.FISHING] - startFishingLevel)
- + "). TTL: "
- + getTimeTillLevel(Skills.FISHING, fishExpGained,
- fishExpHour) + " ("
- + getPercentToNextLevel(Skills.FISHING) + "%).", 12, 78);
- g2d.drawString(
- "Agility: "
- + Skills.getLevels()[Skills.AGILITY]
- + "(+"
- + (Skills.getLevels()[Skills.AGILITY] - startAgilityLevel)
- + "). TTL: "
- + getTimeTillLevel(Skills.AGILITY, agilityExpGained,
- agilityExpHour) + " ("
- + getPercentToNextLevel(Skills.AGILITY) + "%).", 12, 93);
- g2d.drawString("Fishing XP gained: " + fishExpGained + ". ("
- + fishExpHour + "/h)", 12, 108);
- g2d.drawString("Agility XP gained: " + agilityExpGained + ". ("
- + agilityExpHour + "/h)", 12, 123);
- g2d.drawString("Fished " + caughtSturgeons + " sturgeons. ("
- + sturgeonsHour + "/h)", 12, 138);
- g2d.drawString("Fished " + caughtSalmons + " salmons. (" + salmonsHour
- + "/h)", 12, 153);
- g2d.drawString("Fished " + caughtTrouts + " trouts. (" + troutsHour
- + "/h)", 12, 168);
- g2d.drawString("Teleported " + urnsCompleted + " urns. (" + urnsHour
- + "/h)", 12, 183);
- g2d.drawString("Status: " + status + ".", 12, 198);
- g2d.drawString(
- "Time running: "
- + Time.format(System.currentTimeMillis() - startTime)
- + ".", 12, 213);
- drawInfo(g2d, 2722);
- }
- public void drawInfo(Graphics2D g, final int npcId) {
- try {
- for (NPC npc : NPCs.getLoaded(new Filter<NPC>() {
- @Override
- public boolean accept(NPC n) {
- return n.getId() == npcId
- && Calculations.distance(n.getLocation(), Players
- .getLocal().getLocation()) <= 40;
- }
- })) {
- if (npc != null) {
- /* Draw the points */
- g.setColor(Players.getLocal().getInteracting() != null ? Players
- .getLocal().getInteracting().equals(npc) ? Color.YELLOW
- : Color.GREEN
- : Color.GREEN);
- Point p = npc.getLocation().getMapPoint();
- g.fillOval(p.x - 2, p.y - 2, 4, 4);
- /* Draw the tiles */
- Tile t = npc.getLocation();
- for (Polygon poly : t.getBounds()) {
- boolean drawThisOne = true;
- for (int i = 0; i < poly.npoints; i++) {
- Point po = new Point(poly.xpoints[i],
- poly.ypoints[i]);
- if (!Calculations.isOnScreen(po)) {
- drawThisOne = false;
- }
- }
- if (drawThisOne) {
- Color col1 = Players.getLocal().getInteracting() != null ? Players
- .getLocal().getInteracting().equals(npc) ? Color.YELLOW
- : Color.GREEN
- : Color.GREEN;
- Color col2 = new Color(col1.getRed(),
- col1.getGreen(), col1.getBlue(), 80);
- g.setColor(col2);
- g.fillPolygon(poly);
- g.setColor(col1);
- g.drawPolygon(poly);
- }
- }
- }
- }
- } catch (Exception ignored) {
- }
- }
- private NPC getNearestSpot() {
- return NPCs.getNearest(new Filter<NPC>() {
- @Override
- public boolean accept(NPC n) {
- return n != null
- && n.getId() == 2722
- && Calculations.distance(startTile, n.getLocation()) <= 20;
- }
- });
- }
- private Item getBait() {
- return Inventory.getCount(313) > 0 ? Inventory.getItem(313)
- : (Inventory.getCount(314) > 0 ? Inventory.getItem(314) : null);
- }
- private String getTimeTillLevel(int skill, int expGained, int expPerHour) {
- int currentLevel = Skills.getLevel(skill);
- int expTillNextLevel = Skills.getExperienceToLevel(skill,
- currentLevel + 1);
- if (expGained > 0) {
- return Time.format((long) ((double) expTillNextLevel
- / (double) expPerHour * 3600000));
- }
- return "0:0:0";
- }
- private int getPercentToNextLevel(int index) {
- int lvl = Skills.getRealLevel(index);
- if (lvl == 99) {
- return 100;
- }
- int xpTotal = Skills.XP_TABLE[lvl + 1] - Skills.XP_TABLE[lvl];
- if (xpTotal == 0) {
- return 0;
- }
- int xpDone = Skills.getExperience(index) - Skills.XP_TABLE[lvl];
- return 100 * xpDone / xpTotal;
- }
- private void doUpdates(String url) {
- try {
- double currentVersion = getVersion();
- double newVersion = -1;
- URL site = new URL(url);
- BufferedReader in = new BufferedReader(new InputStreamReader(
- site.openStream()));
- String line;
- Matcher m;
- while ((line = in.readLine()) != null) {
- if ((m = UPDATER_VERSION_PATTERN.matcher(line)).find()) {
- newVersion = Double.parseDouble(m.group(1));
- break;
- }
- }
- if (newVersion < 0) {
- log.info("Unable to find the new version number. Update failed");
- } else if (currentVersion == newVersion) {
- log.info("You already have the latest version of the script.");
- } else {
- log.info("You do not have the most recent version! Check the forums for version "
- + newVersion);
- }
- in.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- @Override
- public void messageReceived(MessageEvent arg0) {
- String msg = arg0.getMessage();
- if (msg.contains("leaping sturgeon")) {
- caughtSturgeons++;
- inactivityTimer = new Timer(0);
- } else if (msg.contains("leaping salmon")) {
- caughtSalmons++;
- inactivityTimer = new Timer(0);
- } else if (msg.contains("leaping trout")) {
- caughtTrouts++;
- inactivityTimer = new Timer(0);
- } else if (msg.contains("it is teleported away")) {
- urnsCompleted++;
- }
- }
- private class GUI extends JFrame {
- private static final long serialVersionUID = 1L;
- public GUI() {
- initComponents();
- }
- private void initComponents() {
- jLabel1 = new JLabel();
- jRadioButton1 = new JRadioButton();
- jRadioButton2 = new JRadioButton();
- jLabel2 = new JLabel();
- jComboBox1 = new JComboBox();
- jLabel3 = new JLabel();
- jLabel4 = new JLabel();
- jButton1 = new JButton();
- jLabel5 = new JLabel();
- jLabel6 = new JLabel();
- jRadioButton3 = new JRadioButton();
- jRadioButton4 = new JRadioButton();
- setTitle("iTBarbFisher");
- jLabel1.setText("Dropping");
- jRadioButton1.setSelected(true);
- jRadioButton1.setText("Fast dropping");
- jRadioButton1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- jRadioButton1ActionPerformed(evt);
- }
- });
- jRadioButton2.setText("Slow dropping");
- jRadioButton2.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- jRadioButton2ActionPerformed(evt);
- }
- });
- jLabel2.setText("Summoning");
- jComboBox1.setModel(new DefaultComboBoxModel(new String[] { "None",
- "Granite crab (16 summoning)", "Ibis (56 summoning)",
- "Granite lobster (74 summoning)" }));
- jLabel3.setText("Have summong/super restore potions");
- jLabel4.setText("if summoning is enabled!");
- jButton1.setText("Start!");
- jButton1.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- jLabel5.setText("Script made by _phl0w on PB");
- jLabel6.setText("Decorated fishing urn");
- jRadioButton3.setText("Enabled");
- jRadioButton3.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- jRadioButton3ActionPerformed(evt);
- }
- });
- jRadioButton4.setSelected(true);
- jRadioButton4.setText("Disabled");
- jRadioButton4.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- jRadioButton4ActionPerformed(evt);
- }
- });
- GroupLayout layout = new GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(layout
- .createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(
- layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(
- layout.createParallelGroup(
- GroupLayout.Alignment.LEADING)
- .addGroup(
- layout.createSequentialGroup()
- .addGroup(
- layout.createParallelGroup(
- GroupLayout.Alignment.LEADING,
- false)
- .addComponent(
- jRadioButton2)
- .addComponent(
- jRadioButton1)
- .addComponent(
- jLabel1)
- .addComponent(
- jLabel2)
- .addComponent(
- jComboBox1,
- GroupLayout.PREFERRED_SIZE,
- GroupLayout.DEFAULT_SIZE,
- GroupLayout.PREFERRED_SIZE)
- .addComponent(
- jLabel3,
- GroupLayout.DEFAULT_SIZE,
- GroupLayout.DEFAULT_SIZE,
- Short.MAX_VALUE)
- .addComponent(
- jLabel4)
- .addComponent(
- jButton1,
- GroupLayout.DEFAULT_SIZE,
- GroupLayout.DEFAULT_SIZE,
- Short.MAX_VALUE))
- .addContainerGap())
- .addGroup(
- GroupLayout.Alignment.TRAILING,
- layout.createSequentialGroup()
- .addGap(0,
- 0,
- Short.MAX_VALUE)
- .addComponent(
- jLabel5)
- .addGap(29,
- 29,
- 29))
- .addGroup(
- layout.createSequentialGroup()
- .addGroup(
- layout.createParallelGroup(
- GroupLayout.Alignment.LEADING)
- .addComponent(
- jRadioButton4)
- .addComponent(
- jLabel6)
- .addComponent(
- jRadioButton3))
- .addGap(0,
- 0,
- Short.MAX_VALUE)))));
- layout.setVerticalGroup(layout.createParallelGroup(
- GroupLayout.Alignment.LEADING).addGroup(
- layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel1)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jRadioButton1)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jRadioButton2)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel6)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jRadioButton3)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jRadioButton4)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED,
- GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jLabel2)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jComboBox1,
- GroupLayout.PREFERRED_SIZE,
- GroupLayout.DEFAULT_SIZE,
- GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel3)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel4)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton1)
- .addPreferredGap(
- LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel5).addContainerGap()));
- Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
- int w = getSize().width;
- int h = getSize().height;
- int x = (dim.width - w) / 2;
- int y = (dim.height - h) / 2;
- setLocation(x, y);
- pack();
- }
- private void jButton1ActionPerformed(ActionEvent evt) {
- urns = jRadioButton3.isSelected() ? true : false;
- quickDrop = jRadioButton1.isSelected() ? true : false;
- pouch = getPouch(jComboBox1.getSelectedItem().toString());
- guiInitialized = true;
- dispose();
- }
- private void jRadioButton1ActionPerformed(ActionEvent evt) {
- jRadioButton1.setSelected(true);
- jRadioButton2.setSelected(false);
- }
- private void jRadioButton2ActionPerformed(ActionEvent evt) {
- jRadioButton1.setSelected(false);
- jRadioButton2.setSelected(true);
- }
- private void jRadioButton3ActionPerformed(ActionEvent evt) {
- jRadioButton3.setSelected(true);
- jRadioButton4.setSelected(false);
- }
- private void jRadioButton4ActionPerformed(ActionEvent evt) {
- jRadioButton3.setSelected(false);
- jRadioButton4.setSelected(true);
- }
- private JButton jButton1;
- private JComboBox jComboBox1;
- private JLabel jLabel1;
- private JLabel jLabel2;
- private JLabel jLabel3;
- private JLabel jLabel4;
- private JLabel jLabel5;
- private JLabel jLabel6;
- private JRadioButton jRadioButton1;
- private JRadioButton jRadioButton2;
- private JRadioButton jRadioButton3;
- private JRadioButton jRadioButton4;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement