Jump to content

Kenneh

Members
  • Posts

    218
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by Kenneh

  1. The speaker on the first one looks like you just threw it in there. The second one is okay I guess but looks really plain and something that you could make in gimp in like 2 minutes.
  2. I meant the model. To add your model to the list, do List list = new List(listModel);
  3. It's list.addElement(object);
  4. Kenneh

    Herb Snippet

    I'm just trying to help. Here's a little example. import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Created by Kenneth on 3/22/14. */ public class HerbGUI extends JFrame { public JComboBox<Herb> comboBox = new JComboBox<>(Herb.values()); public JButton startButton = new JButton("Start"); public Herb singleHerb; public HerbGUI() { getContentPane().setLayout(new FlowLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().add(comboBox); getContentPane().add(startButton); startButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { singleHerb = (Herb) comboBox.getSelectedItem(); System.out.println(singleHerb.getIdLevel()); System.out.println(singleHerb.getName()); System.out.println(singleHerb.getNotedGrimyId()); } }); pack(); setVisible(true); } public static void main(String[] args) { new HerbGUI(); } }
  5. Kenneh

    Herb Snippet

    Comboboxes have getSelectedItem() and getSelectedItemList() though.
  6. You use enums correctly here, but wrong in your own snippet xD
  7. Kenneh

    Herb Snippet

    Okay, first before you read the rest of this, I want to say thanks for providing all the IDs. But, you're using an enum wrong. ftfy
  8. Note that it's a resource waste and it won't draw paint information. It's funny to watch though
  9. Thanks, I added suggestions similar to how irc works. "dragon sc + tab" return dragon scimitar
  10. Haha, I got bored. It relys on the Gson API and I don't know if that's provided by osbot. Here's a nifty little utility I was able to make with it with little effort. should extract the picture and maybe an auto fill feature would make it nice I'm really bad at swing, so I'm not sure how to make this look decent. For the auto complete, that'd be a nifty feature, but all this does is grab what you put in the box and appends it to the end of the url. I dont think I can make it auto complete without a list of item names of some sort.
  11. Haha, I got bored. It relys on the Gson API and I don't know if that's provided by osbot. Here's a nifty little utility I was able to make with it with little effort.
  12. No wonder this site isn't progressing.
  13. I don't know what libraries are in the client by default, but this provides a bit more information package org.kenneh.framework.net; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Date; import com.google.gson.Gson; public class PriceGrabber { private static final String URL_BASE = "http://forums.zybez.net/runescape-2007-prices/api/item/"; private final int itemId; private String name; private int average; private int low; private int high; private String imageURL; private Offer[] offers; private Price price; public Offer[] getOffers() { return offers; } public Price getRaw() { return price; } public String getImageURL() { return imageURL; } public int getLow() { return low; } public int getHigh() { return high; } public int getAverage() { return average; } public int getId() { return itemId; } public String getName() { return name; } public PriceGrabber(final String itemName) { this.name = itemName; price = new Gson().fromJson(getJson(getName()), Price.class); low = (int) price.getLow(); average = (int) price.getAverage(); high = (int) price.getHigh(); name = price.getName(); imageURL = price.getImageURL(); itemId = price.getId(); offers = price.getOffers(); } public PriceGrabber(final int itemId) { this.itemId = itemId; price = new Gson().fromJson(getJson(String.valueOf(getId())), Price.class); low = (int) price.getLow(); average = (int) price.getAverage(); high = (int) price.getHigh(); name = price.getName(); imageURL = price.getImageURL(); offers = price.getOffers(); } private String getJson(String end) { try { URL url = new URL(URL_BASE + end.toLowerCase().replaceAll(" ", "%20")); URLConnection urlconn = url.openConnection(); urlconn.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36"); urlconn.setRequestProperty("Connection", "close"); BufferedReader in = new BufferedReader(new InputStreamReader(urlconn.getInputStream())); return in.readLine(); } catch(Exception a) { System.out.println("Error connecting to server."); } return null; } public static void main(String[] args) { PriceGrabber price = new PriceGrabber("amulet of fury"); System.out.println(price.getRaw()); System.out.println(price.getOffers()[0]); } private class Offer { private int selling; private int quantity; private int price; private long date; private String rs_name; private String contact; private String notes; public boolean isSelling() { return selling == 1; } public int getQuantity() { return quantity; } public int getPrice() { return price; } public String getDate() { Date d = new Date(date * 1000L); return d.toString(); } public String getRSName() { return rs_name; } public String getContact() { return contact; } public String getNotes() { return notes; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getRSName()).append(" is ").append(isSelling() ? "selling" : "buying").append(" ").append(getQuantity()); sb.append(" of the item ").append(" for ").append(getPrice()).append(" on ").append(getDate()).append("\t"); sb.append("Contact ").append(getContact()).append("\t"); sb.append("Notes: ").append(getNotes()); return sb.toString(); } } private class Price { private int id; private String name; private String image; private double average; private double recent_high; private double recent_low; private Offer[] offers; public Offer[] getOffers() { return offers; } public double getHigh() { return recent_high; } public double getLow() { return recent_low; } public String getImageURL() { return image; } public int getId() { return id; } public String getName() { return name; } public double getAverage() { return average; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("id=").append(getId()).append("\t"); sb.append("name=").append(getName()).append("\t"); sb.append("image=").append(getImageURL()).append("\t"); sb.append("average=").append(getAverage()).append("\t"); sb.append("high=").append(getHigh()).append("\t"); sb.append("low=").append(getLow()).append("\t"); sb.append("offers=").append(getOffers().length); return sb.toString(); } } }
  14. Kenneh

    Kenneh's GDK

    More profit, easier to write. I'm pretty lazy ;)
  15. Kenneh

    Kenneh's GDK

    rsbot 1 all over again lelelele osbot client 2 shit to work with, aurora is nice with devs who are active and listen and overall fun to talk to. Much better imo ;)
  16. Kenneh

    Kenneh's GDK

    re-writing the script for aurora client, osbot is just too badly programmed. req lock.
  17. :p <harrynoob_> relativity jokes are relatively bad <Drew|> fal;kdsjf;laksd <Drew|> ajlk;sdfjlaksd fuck you
×
×
  • Create New...