Ok, 2 questions.

1. I have an applet, but it is IN the page, like, part of the HTML I think, how do I get it to like "pop up" and be its own window. It will eventually become a game tool, so it would be easier to use if it was accessible outside of its window.
On that same note, if you drag the applet itself (like where the menu bar is), it moves the applet outside of its viewing box, not sure why it does that either.

Here is my applet: http://www.dawnofvengeance.com/applications/launch.html

Thanks everyone,

P.S. Unless really wants to walk me through it, because i have searched and it seems like a massive pain to do with netbeans, can someone give me exact steps to insert a background image on the JPanel, I think I have to override a lot of things, and I am still new'ish to Java, so if mess up I will probably end up ruining my whole applet.

Thanks again,

6 Years
Discussion Span
Last Post by adams161

typically if you want the applet to open in its own window, within the applets init method you create a JFrame, you give it a size or you maximize it and you set it visible, then write your code in the frame class and its panel.

within the paintComponents method of that panel that is added to the frame, i have for example in one of my panel paint components methods,

public void paintComponent (Graphics g) {
 		int width = getWidth();
		int height = getHeight();
  if(sharedVariables.wallpaperImage != null)
   g.drawImage(sharedVariables.wallpaperImage, 0, 0,  width, height, this);

so if in my case, an image exists on that variables ( its not null) i draw that image full width and height of screen, otherwise i set it to whatever the MainBackColor that is chosen.

google java paint components if you havent heard of it. just a method you attach in a panel, and any time the screen draws its called, or you can force a redraw with repaint(); said at the panel level.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.