Title says it all.
I'm loading my image with the statement below
//logo = getImage(getDocumentBase(),"http://fromdustelune.com/FD_Logo.png");
logo = getImage(getDocumentBase(),"FD_Logo.png");
*The commented one won't work until I sign this applet (or so I believe that's how it's done*
Then I call the paint method:
public void paint (Graphics g){
g.drawImage(logo, 0, 0, logo.getWidth(this), logo.getHeight(this), this);
}
When you call the paint method, is there a way to only paint that object in the location you want it? My main problem is I have about 4 labels and 2 JComboBoxes that I need to show in my applet below this image. I'll paste all of my code below but this seems to be my main problem.
Also, one other quick question. Once I get my applet working as intended, once I make the JAR and sign it, the applet will be able to function with URLs correct?
All of my program:
import java.util.*;
import javax.swing.JApplet;
import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.Desktop;
import java.awt.event.*;
import javax.swing.ImageIcon;
import javax.swing.*;
public class Ranks extends JApplet{
//Declare varibles
private String address, worldRank, realmRank;
private JLabel worldRankLabel, realmRankLabel,tierNormalLabel, tierHeroicLabel;
private JComboBox tierNormal, tierHeroic;
private Image logo;
public void init(){
Container contents = getContentPane();
contents.setLayout(new FlowLayout());
String[] bossesNormal = {"Morchok", "Yor'sahj", "Zon'ozz", "Hagara", "Ultraxion", "Blackhorn", "Spine", "Madness"};
String[] bossesHeroic = {"Morchok", "Yor'sahj"};
realmRank = new String("number1");
worldRank = new String("number2");
tierNormal = new JComboBox(bossesNormal);
tierHeroic = new JComboBox(bossesHeroic);
//Set logo to guild image
//logo = getImage(getDocumentBase(),"http://fromdustelune.com/FD_Logo.png");
logo = getImage(getDocumentBase(),"FD_Logo.png");
realmRankLabel = new JLabel("Realm Rank: " + realmRank);
worldRankLabel = new JLabel("World Rank: " + worldRank);
tierNormalLabel = new JLabel("Normal kills");
tierHeroicLabel = new JLabel("Heroic kills");
contents.add(realmRankLabel);
contents.add(worldRankLabel);
contents.add(tierNormalLabel);
contents.add(tierNormal);
contents.add(tierHeroicLabel);
contents.add(tierHeroic);
getContentPane().setBackground(Color.white);
setSize(185, 200);
//run();
}
/*
public void run(){
try{
URL url = new URL("http://www.wowprogress.com/guild/us/elune/From+Dust/json_rank");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
String data = null;
// Set data = to the only line in the input stream from the URL
data = (inputLine = in.readLine());
worldRank = data.substring(28,31);
}
catch(IOException io){}
}
*/
/*
public void paint (Graphics g){
g.drawImage(logo, 0, 0, logo.getWidth(this), logo.getHeight(this), this);
}
*/
}
Any help would be much appreciated! Thanks in advance!