Advertisement
phl0w

iTFletcher v1.2

Apr 15th, 2012
1,603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 19.48 KB | None | 0 0
  1. import java.awt.AlphaComposite;
  2. import java.awt.Color;
  3. import java.awt.Dimension;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7. import java.awt.Rectangle;
  8. import java.awt.Toolkit;
  9. import java.awt.event.ActionEvent;
  10. import java.awt.event.ActionListener;
  11. import java.util.logging.Level;
  12. import java.util.logging.Logger;
  13.  
  14. import javax.swing.DefaultComboBoxModel;
  15. import javax.swing.GroupLayout;
  16. import javax.swing.JButton;
  17. import javax.swing.JComboBox;
  18. import javax.swing.JFrame;
  19. import javax.swing.JLabel;
  20. import javax.swing.JRadioButton;
  21. import javax.swing.LayoutStyle;
  22. import javax.swing.SwingUtilities;
  23. import javax.swing.UIManager;
  24. import javax.swing.UnsupportedLookAndFeelException;
  25.  
  26. import org.powerbot.concurrent.Task;
  27. import org.powerbot.concurrent.strategy.Strategy;
  28. import org.powerbot.game.api.ActiveScript;
  29. import org.powerbot.game.api.Manifest;
  30. import org.powerbot.game.api.methods.Tabs;
  31. import org.powerbot.game.api.methods.Widgets;
  32. import org.powerbot.game.api.methods.input.Mouse;
  33. import org.powerbot.game.api.methods.interactive.Players;
  34. import org.powerbot.game.api.methods.node.Menu;
  35. import org.powerbot.game.api.methods.node.SceneEntities;
  36. import org.powerbot.game.api.methods.tab.Inventory;
  37. import org.powerbot.game.api.methods.tab.Skills;
  38. import org.powerbot.game.api.methods.widget.Camera;
  39. import org.powerbot.game.api.util.Filter;
  40. import org.powerbot.game.api.util.Random;
  41. import org.powerbot.game.api.util.Time;
  42. import org.powerbot.game.api.wrappers.node.Item;
  43. import org.powerbot.game.api.wrappers.node.SceneObject;
  44. import org.powerbot.game.api.wrappers.widget.Widget;
  45. import org.powerbot.game.api.wrappers.widget.WidgetChild;
  46. import org.powerbot.game.bot.event.MessageEvent;
  47. import org.powerbot.game.bot.event.listener.MessageListener;
  48. import org.powerbot.game.bot.event.listener.PaintListener;
  49.  
  50. @Manifest(authors = { "Flow_HRS" }, name = "iTFletcher", description = "Will cut or string your logs/bows for you. - By Flow_HRS.", version = 1.2)
  51. public class iTFletcher extends ActiveScript implements PaintListener,
  52.         MessageListener {
  53.  
  54.     private boolean guiInitialized;
  55.     private boolean[] selected = new boolean[2];
  56.     private int bowType, // 0 = shortbow, 1 = longbow
  57.             action, logType, fails, actions, startLevel, startXp; // 0 = cut, 1
  58.     // = string
  59.     private String status = "waiting for gui";
  60.     private long startTime;
  61.  
  62.     @Override
  63.     protected void setup() {
  64.         SwingUtilities.invokeLater(new Runnable() {
  65.             @Override
  66.             public void run() {
  67.                 JFrame ui = new GUI();
  68.                 ui.setVisible(true);
  69.             }
  70.         });
  71.         provide(new WaitForGuiTask());
  72.         provide(new Sleep());
  73.         provide(new Cutting());
  74.         provide(new Stringing());
  75.         provide(new Bank());
  76.         provide(new AntiBan());
  77.         provide(new OpenBank());
  78.         provide(new CloseBank());
  79.         startTime = System.currentTimeMillis();
  80.         startLevel = Skills.getLevels()[9];
  81.         startXp = Skills.getExperiences()[9];
  82.     }
  83.  
  84.     private enum LogTypes {
  85.         Normal(1511), Oak(1521), Willow(1519), Maple(1517), Yew(1515), Magic(
  86.                 1513);
  87.  
  88.         int logId;
  89.  
  90.         private LogTypes(int logId) {
  91.             this.logId = logId;
  92.         }
  93.  
  94.     }
  95.  
  96.     private enum BowData {
  97.         Normal(50, 48, 1511), Oak(54, 56, 1521), Willow(60, 58, 1519), Maple(
  98.                 64, 62, 1517), Yew(68, 66, 1515), Magic(72, 70, 1513);
  99.         int log, unstrungLb, unstrungSb;
  100.  
  101.         BowData(int unstrungSb, int unstrungLb, int log) {
  102.             this.unstrungSb = unstrungSb;
  103.             this.unstrungLb = unstrungLb;
  104.             this.log = log;
  105.         }
  106.     }
  107.  
  108.     @Override
  109.     public void messageReceived(MessageEvent arg0) {
  110.         String msg = arg0.getMessage();
  111.         if (msg.contains("carefully cut") || msg.contains("add a string")) {
  112.             actions++;
  113.         }
  114.     }
  115.  
  116.     private int getLogForName(String name) {
  117.         for (LogTypes lt : LogTypes.values()) {
  118.             if ((lt.name() + " log").equals(name)) {
  119.                 return lt.logId;
  120.             }
  121.         }
  122.         return -1;
  123.     }
  124.  
  125.     private int getUnstrung(int log, boolean longbow) {
  126.         for (BowData bd : BowData.values()) {
  127.             if (bd != null) {
  128.                 if (bd.log == log) {
  129.                     return longbow ? bd.unstrungLb : bd.unstrungSb;
  130.                 }
  131.             }
  132.         }
  133.         return -1;
  134.     }
  135.  
  136.     private final boolean playerHasItem(int id) {
  137.         for (Item i : Inventory.getItems()) {
  138.             if (i.getId() == id) {
  139.                 return true;
  140.             }
  141.         }
  142.         return false;
  143.     }
  144.  
  145.     private AlphaComposite makeComposite(float alpha) {
  146.         int type = AlphaComposite.SRC_OVER;
  147.         return (AlphaComposite.getInstance(type, alpha));
  148.     }
  149.  
  150.     @Override
  151.     public void onRepaint(Graphics g) {
  152.         Graphics2D g2d = (Graphics2D) g;
  153.  
  154.         Font title = new Font("Monotype Corsiva", Font.PLAIN, 25);
  155.         Font author = new Font("Monotype Corsiva", Font.PLAIN, 16);
  156.         Font info = new Font("Book Antiqua", Font.PLAIN, 15);
  157.  
  158.         int expGained = Skills.getExperiences()[Skills.FLETCHING] - startXp;
  159.         int expHour = (int) ((expGained) * 3600000D / (System
  160.                 .currentTimeMillis() - startTime));
  161.         int perHour = (int) ((actions) * 3600000D / (System.currentTimeMillis() - startTime));
  162.  
  163.         Rectangle bg = new Rectangle(10, 23, 250, 155);
  164.         Rectangle border = new Rectangle(8, 21, 254, 159);
  165.         g2d.setColor(Color.CYAN);
  166.         g2d.setComposite(makeComposite(0.5f));
  167.         g2d.fill(bg);
  168.         g2d.setColor(Color.BLACK);
  169.         g2d.fill(border);
  170.         g2d.setComposite(makeComposite(1.0f));
  171.  
  172.         g2d.setColor(Color.WHITE);
  173.  
  174.         g2d.fill(new Rectangle(Mouse.getX() + 1, Mouse.getY() - 4, 2, 15));
  175.         g2d.fill(new Rectangle(Mouse.getX() - 6, Mouse.getY() + 2, 16, 2));
  176.  
  177.         g2d.setFont(title);
  178.         g2d.drawString("iTFletcher", 20, 50);
  179.         g2d.setFont(author);
  180.         g2d.drawString("By: Flow_HRS", 20, 65);
  181.  
  182.         g2d.setFont(info);
  183.         g2d.drawString("Fletching level: " + Skills.getLevels()[9] + "/"
  184.                 + startLevel + ".", 20, 85);
  185.         g2d.drawString("Fletching experience gained: " + expGained + ".", 20,
  186.                 100);
  187.         g2d.drawString("Fletching experience/hour: " + expHour + ".", 20, 115);
  188.         g2d.drawString("Successfully did " + actions + " actions. (" + perHour
  189.                 + "/hour)", 20, 130);
  190.         g2d.drawString("Status: " + status + ".", 20, 145);
  191.         g2d.drawString("Action: " + (action == 0 ? "cutting" : "stringing")
  192.                 + (bowType == 0 ? " shortbow" : " longbow") + ".", 20, 160);
  193.         g2d.drawString("Time running: "
  194.                 + formatTime(System.currentTimeMillis() - startTime) + ".", 20,
  195.                 175);
  196.     }
  197.  
  198.     public String formatTime(final long milliseconds) {
  199.         final long t_seconds = milliseconds / 1000;
  200.         final long t_minutes = t_seconds / 60;
  201.         final long t_hours = t_minutes / 60;
  202.         final long seconds = t_seconds % 60;
  203.         final long minutes = t_minutes % 60;
  204.         final long hours = t_hours % 500;
  205.         return hours + ":" + minutes + ":" + seconds;
  206.     }
  207.  
  208.     private final class Sleep extends Strategy implements Task {
  209.  
  210.         @Override
  211.         public boolean validate() {
  212.             return guiInitialized && Players.getLocal().getAnimation() != -1;
  213.         }
  214.  
  215.         @Override
  216.         public void run() {
  217.             Time.sleep(100);
  218.         }
  219.     }
  220.  
  221.     private final class Cutting extends Strategy implements Task {
  222.  
  223.         @Override
  224.         public boolean validate() {
  225.             return guiInitialized && Players.getLocal().getAnimation() == -1
  226.                     && playerHasItem(logType) && action == 0;
  227.         }
  228.  
  229.         @Override
  230.         public void run() {
  231.             if (Tabs.getCurrent() != Tabs.INVENTORY) {
  232.                 Tabs.INVENTORY.open();
  233.                 Time.sleep(600);
  234.             }
  235.             for (Item i : Inventory.getItems()) {
  236.                 if (i.getId() == logType && Random.nextInt(0, 3) == 1) {
  237.                     i.getWidgetChild().click(true);
  238.                     Time.sleep(400);
  239.                 }
  240.                 break;
  241.             }
  242.             if (Widgets.get(1179, 12).visible()) {
  243.                 Widgets.get(1179, 12).click(true);
  244.                 Time.sleep(600);
  245.             }
  246.             if (Widgets.get(905, bowType == 0 ? 14 : 15).validate()) {
  247.                 Widgets.get(905, bowType == 0 ? 14 : 15).click(true);
  248.                 status = "cutting";
  249.                 Time.sleep(1000);
  250.             }
  251.         }
  252.     }
  253.  
  254.     private final class Stringing extends Strategy implements Task {
  255.  
  256.         @Override
  257.         public boolean validate() {
  258.             return guiInitialized && Players.getLocal().getAnimation() == -1
  259.                     && playerHasItem(getUnstrung(logType, bowType == 1))
  260.                     && action == 1 && playerHasItem(1777);
  261.         }
  262.  
  263.         @Override
  264.         public void run() {
  265.             if (Tabs.getCurrent() != Tabs.INVENTORY) {
  266.                 Tabs.INVENTORY.open();
  267.                 Time.sleep(600);
  268.             }
  269.             for (Item i : Inventory.getItems()) {
  270.                 if (i.getId() == 1777 && !selected[0]) {
  271.                     i.getWidgetChild().click(true);
  272.                     selected[0] = true;
  273.                 } else if (i.getId() == getUnstrung(logType, bowType == 1)
  274.                         && !selected[1]) {
  275.                     i.getWidgetChild().click(true);
  276.                     selected[1] = true;
  277.                 }
  278.             }
  279.             if (Widgets.get(905, 14).visible()) {
  280.                 Widgets.get(905, 14).click(true);
  281.                 status = "stringing";
  282.                 Time.sleep(500);
  283.             }
  284.         }
  285.     }
  286.  
  287.     private class AntiBan extends Strategy implements Task {
  288.  
  289.         @Override
  290.         public boolean validate() {
  291.             return guiInitialized && Players.getLocal().getAnimation() != -1;
  292.         }
  293.  
  294.         @Override
  295.         public void run() {
  296.             if (Random.nextInt(1, 15) <= 2) {
  297.                 executeAntiBan();
  298.             }
  299.             Time.sleep(1000);
  300.         }
  301.  
  302.         private final void executeAntiBan() {
  303.             Camera.setAngle(Random.nextInt(20, 300));
  304.         }
  305.     }
  306.  
  307.     private final class WaitForGuiTask extends Strategy implements Task {
  308.  
  309.         @Override
  310.         public boolean validate() {
  311.             return !guiInitialized;
  312.         }
  313.  
  314.         @Override
  315.         public void run() {
  316.             Time.sleep(100);
  317.         }
  318.     }
  319.  
  320.     private class CloseBank extends Strategy implements Task {
  321.  
  322.         @Override
  323.         public boolean validate() {
  324.             return guiInitialized && Widgets.get(762, 1).visible()
  325.                     && Inventory.getCount(action == 0 ? logType : 1777) > 0;
  326.         }
  327.  
  328.         @Override
  329.         public void run() {
  330.             Widgets.get(762, 45).interact("Close");
  331.             Time.sleep(Random.nextInt(300, 700));
  332.         }
  333.     }
  334.  
  335.     private class OpenBank extends Strategy implements Task {
  336.  
  337.         private SceneObject bankChest() {
  338.             return SceneEntities.getNearest(new Filter<SceneObject>() {
  339.                 public boolean accept(final SceneObject ENTITY) {
  340.                     return ENTITY.getId() == 42192;
  341.                 }
  342.             });
  343.         }
  344.  
  345.         @Override
  346.         public boolean validate() {
  347.             return guiInitialized
  348.                     && Inventory.getCount(action == 0 ? logType : 1777) == 0
  349.                     && !Widgets.get(762, 1).visible();
  350.         }
  351.  
  352.         @Override
  353.         public void run() {
  354.             if (Tabs.getCurrent() != Tabs.INVENTORY) {
  355.                 Tabs.INVENTORY.open();
  356.             }
  357.             if (bankChest() != null) {
  358.                 status = "banking";
  359.                 bankChest().interact("Use");
  360.                 Time.sleep(Random.nextInt(800, 1200));
  361.             }
  362.         }
  363.     }
  364.  
  365.     private class Bank extends Strategy implements Task {
  366.  
  367.         private final void deposit() {
  368.             Widgets.get(762, 34).click(true);
  369.         }
  370.  
  371.         private SceneObject bankChest() {
  372.             return SceneEntities.getNearest(new Filter<SceneObject>() {
  373.                 public boolean accept(final SceneObject ENTITY) {
  374.                     return ENTITY.getId() == 42192;
  375.                 }
  376.             });
  377.         }
  378.  
  379.         @Override
  380.         public boolean validate() {
  381.             return guiInitialized && Widgets.get(762, 1).validate()
  382.                     && Inventory.getCount(action == 0 ? logType : 1777) == 0;
  383.         }
  384.  
  385.         @Override
  386.         public void run() {
  387.             if (bankChest() != null) {
  388.                 status = "banking";
  389.                 selected[0] = false;
  390.                 selected[1] = false;
  391.                 if (!(Inventory.getCount() <= 1)) {
  392.                     deposit();
  393.                     // Widgets.get(762, 34).click(true);
  394.                     Time.sleep(Random.nextInt(1000, 1200));
  395.                 } else {
  396.                     if (action == 0) {
  397.                         if (!playerHasItem(logType)) {
  398.                             withdraw(logType);
  399.                         }
  400.                     } else {
  401.                         if (!playerHasItem(1777)) {
  402.                             withdraw(1777);
  403.                         }
  404.                         if (!playerHasItem(getUnstrung(logType, bowType == 1))) {
  405.                             withdraw(getUnstrung(logType, bowType == 1));
  406.                         }
  407.                     }
  408.                     Time.sleep(Random.nextInt(172, 257));
  409.                     Widgets.get(762, 45).click(true);
  410.                 }
  411.             }
  412.             if (!playerHasItem(action == 0 ? logType : getUnstrung(logType,
  413.                     bowType == 1))) {
  414.                 fails++;
  415.             } else if (action == 1 && !playerHasItem(1777)) {
  416.                 fails++;
  417.             } else {
  418.                 fails = 0;
  419.             }
  420.             if (fails == 4) {
  421.                 stop();
  422.             }
  423.         }
  424.     }
  425.  
  426.     private final boolean withdraw(int item) {
  427.         Widget bank = Widgets.get(762);
  428.         WidgetChild items = bank.getChild(95);
  429.         int baseX = items.getAbsoluteX(), baseY = items.getAbsoluteY();
  430.         for (WidgetChild child : items.getChildren()) {
  431.             if (child.getChildId() == item) {
  432.                 Mouse.click(child.getRelativeX() + baseX
  433.                         + (child.getWidth() / 2), child.getRelativeY() + baseY
  434.                         + (child.getHeight() / 2), false);
  435.                 return Menu
  436.                         .select(action == 0 ? "Withdraw-All" : "Withdraw-14");
  437.             }
  438.         }
  439.         return false;
  440.     }
  441.  
  442.     public class GUI extends JFrame {
  443.  
  444.         private static final long serialVersionUID = 1L;
  445.  
  446.         public GUI() {
  447.             initComponents();
  448.         }
  449.  
  450.         private void initComponents() {
  451.             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
  452.             int w = getSize().width;
  453.             int h = getSize().height;
  454.             int x = (dim.width - w) / 2;
  455.             int y = (dim.height - h) / 2;
  456.             setLocation(x, y);
  457.             try {
  458.                 for (UIManager.LookAndFeelInfo info : UIManager
  459.                         .getInstalledLookAndFeels()) {
  460.                     if ("Nimbus".equals(info.getName())) {
  461.                         UIManager.setLookAndFeel(info.getClassName());
  462.                         break;
  463.                     }
  464.                 }
  465.             } catch (ClassNotFoundException ex) {
  466.                 Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null,
  467.                         ex);
  468.             } catch (InstantiationException ex) {
  469.                 Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null,
  470.                         ex);
  471.             } catch (IllegalAccessException ex) {
  472.                 Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null,
  473.                         ex);
  474.             } catch (UnsupportedLookAndFeelException ex) {
  475.                 Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null,
  476.                         ex);
  477.             }
  478.  
  479.             jLabel1 = new JLabel();
  480.             jComboBox1 = new JComboBox();
  481.             jLabel2 = new JLabel();
  482.             jRadioButton1 = new JRadioButton();
  483.             jRadioButton2 = new JRadioButton();
  484.             jButton1 = new JButton();
  485.             jRadioButton3 = new JRadioButton();
  486.             jRadioButton4 = new JRadioButton();
  487.             jLabel3 = new JLabel();
  488.  
  489.             setTitle("Fletcher");
  490.  
  491.             jLabel1.setText("Select your log type:");
  492.  
  493.             jComboBox1.setModel(new DefaultComboBoxModel(new String[] {
  494.                     "Normal log", "Oak log", "Willow log", "Maple log",
  495.                     "Yew log", "Magic log" }));
  496.  
  497.             jLabel2.setText("Select your bow type:");
  498.  
  499.             jRadioButton1.setText("String");
  500.             // jRadioButton1.setEnabled(false);
  501.             jRadioButton1.addActionListener(new ActionListener() {
  502.                 public void actionPerformed(ActionEvent evt) {
  503.                     jRadioButton1ActionPerformed(evt);
  504.                 }
  505.             });
  506.  
  507.             jRadioButton2.setText("Cut");
  508.             jRadioButton2.setSelected(true);
  509.             jRadioButton2.addActionListener(new ActionListener() {
  510.                 public void actionPerformed(ActionEvent evt) {
  511.                     jRadioButton2ActionPerformed(evt);
  512.                 }
  513.             });
  514.  
  515.             jButton1.setText("Start");
  516.             jButton1.addActionListener(new ActionListener() {
  517.                 public void actionPerformed(ActionEvent evt) {
  518.                     jButton1ActionPerformed(evt);
  519.                 }
  520.             });
  521.  
  522.             jRadioButton3.setText("Shortbow");
  523.             jRadioButton3.addActionListener(new ActionListener() {
  524.                 public void actionPerformed(ActionEvent evt) {
  525.                     jRadioButton3ActionPerformed(evt);
  526.                 }
  527.             });
  528.  
  529.             jRadioButton4.setSelected(true);
  530.             jRadioButton4.setText("Longbow");
  531.             jRadioButton4.addActionListener(new ActionListener() {
  532.                 public void actionPerformed(ActionEvent evt) {
  533.                     jRadioButton4ActionPerformed(evt);
  534.                 }
  535.             });
  536.  
  537.             jLabel3.setText("Select your action:");
  538.  
  539.             GroupLayout layout = new GroupLayout(getContentPane());
  540.             getContentPane().setLayout(layout);
  541.             layout.setHorizontalGroup(layout
  542.                     .createParallelGroup(GroupLayout.Alignment.LEADING)
  543.                     .addGroup(
  544.                             layout.createSequentialGroup()
  545.                                     .addContainerGap()
  546.                                     .addGroup(
  547.                                             layout.createParallelGroup(
  548.                                                     GroupLayout.Alignment.LEADING)
  549.                                                     .addGroup(
  550.                                                             layout.createSequentialGroup()
  551.                                                                     .addGroup(
  552.                                                                             layout.createParallelGroup(
  553.                                                                                     GroupLayout.Alignment.LEADING)
  554.                                                                                     .addComponent(
  555.                                                                                             jRadioButton2)
  556.                                                                                     .addComponent(
  557.                                                                                             jRadioButton1))
  558.                                                                     .addGap(0,
  559.                                                                             0,
  560.                                                                             Short.MAX_VALUE))
  561.                                                     .addGroup(
  562.                                                             layout.createSequentialGroup()
  563.                                                                     .addGroup(
  564.                                                                             layout.createParallelGroup(
  565.                                                                                     GroupLayout.Alignment.LEADING)
  566.                                                                                     .addComponent(
  567.                                                                                             jComboBox1,
  568.                                                                                             0,
  569.                                                                                             GroupLayout.DEFAULT_SIZE,
  570.                                                                                             Short.MAX_VALUE)
  571.                                                                                     .addGroup(
  572.                                                                                             layout.createSequentialGroup()
  573.                                                                                                     .addGroup(
  574.                                                                                                             layout.createParallelGroup(
  575.                                                                                                                     GroupLayout.Alignment.LEADING)
  576.                                                                                                                     .addComponent(
  577.                                                                                                                             jRadioButton4)
  578.                                                                                                                     .addComponent(
  579.                                                                                                                             jLabel1)
  580.                                                                                                                     .addComponent(
  581.                                                                                                                             jLabel2)
  582.                                                                                                                     .addComponent(
  583.                                                                                                                             jRadioButton3)
  584.                                                                                                                     .addComponent(
  585.                                                                                                                             jLabel3))
  586.                                                                                                     .addGap(0,
  587.                                                                                                             57,
  588.                                                                                                             Short.MAX_VALUE))
  589.                                                                                     .addComponent(
  590.                                                                                             jButton1,
  591.                                                                                             GroupLayout.DEFAULT_SIZE,
  592.                                                                                             GroupLayout.DEFAULT_SIZE,
  593.                                                                                             Short.MAX_VALUE))
  594.                                                                     .addContainerGap()))));
  595.             layout.setVerticalGroup(layout.createParallelGroup(
  596.                     GroupLayout.Alignment.LEADING).addGroup(
  597.                     layout.createSequentialGroup()
  598.                             .addContainerGap()
  599.                             .addComponent(jLabel1)
  600.                             .addPreferredGap(
  601.                                     LayoutStyle.ComponentPlacement.RELATED)
  602.                             .addComponent(jComboBox1,
  603.                                     GroupLayout.PREFERRED_SIZE,
  604.                                     GroupLayout.DEFAULT_SIZE,
  605.                                     GroupLayout.PREFERRED_SIZE)
  606.                             .addPreferredGap(
  607.                                     LayoutStyle.ComponentPlacement.RELATED)
  608.                             .addComponent(jLabel2)
  609.                             .addPreferredGap(
  610.                                     LayoutStyle.ComponentPlacement.RELATED)
  611.                             .addComponent(jRadioButton4)
  612.                             .addPreferredGap(
  613.                                     LayoutStyle.ComponentPlacement.RELATED)
  614.                             .addComponent(jRadioButton3)
  615.                             .addPreferredGap(
  616.                                     LayoutStyle.ComponentPlacement.RELATED)
  617.                             .addComponent(jLabel3)
  618.                             .addPreferredGap(
  619.                                     LayoutStyle.ComponentPlacement.RELATED)
  620.                             .addComponent(jRadioButton2)
  621.                             .addPreferredGap(
  622.                                     LayoutStyle.ComponentPlacement.RELATED)
  623.                             .addComponent(jRadioButton1)
  624.                             .addPreferredGap(
  625.                                     LayoutStyle.ComponentPlacement.RELATED)
  626.                             .addComponent(jButton1)
  627.                             .addContainerGap(GroupLayout.DEFAULT_SIZE,
  628.                                     Short.MAX_VALUE)));
  629.  
  630.             pack();
  631.         }
  632.  
  633.         private void jButton1ActionPerformed(ActionEvent evt) {
  634.             logType = getLogForName(jComboBox1.getSelectedItem().toString());
  635.             System.out.println(logType);
  636.             bowType = jRadioButton3.isSelected() ? 0 : 1;
  637.             action = jRadioButton1.isSelected() ? 1 : 0;
  638.             guiInitialized = true;
  639.             dispose();
  640.         }
  641.  
  642.         private void jRadioButton4ActionPerformed(ActionEvent evt) {
  643.             jRadioButton3.setSelected(false);
  644.         }
  645.  
  646.         private void jRadioButton3ActionPerformed(ActionEvent evt) {
  647.             jRadioButton4.setSelected(false);
  648.         }
  649.  
  650.         private void jRadioButton2ActionPerformed(ActionEvent evt) {
  651.             jRadioButton1.setSelected(false);
  652.         }
  653.  
  654.         private void jRadioButton1ActionPerformed(ActionEvent evt) {
  655.             jRadioButton2.setSelected(false);
  656.         }
  657.  
  658.         private JButton jButton1;
  659.         private JComboBox jComboBox1;
  660.         private JLabel jLabel1;
  661.         private JLabel jLabel2;
  662.         private JLabel jLabel3;
  663.         private JRadioButton jRadioButton1;
  664.         private JRadioButton jRadioButton2;
  665.         private JRadioButton jRadioButton3;
  666.         private JRadioButton jRadioButton4;
  667.     }
  668. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement