Hello, I was wondering how to edit the characteristics for the picture. I'm trying to make it so that I can specify a width, height, and location where the image appears. Here's my Main class...
package JavaGame; import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import JavaGame.movingsprite; public class Main { //movingsprite ='s Garrets playa public static void main(String[] args) { JFrame f = new JFrame("Girl Trauma"); Container fc = f.getContentPane(); f.setSize(800, 800); f.setLocation(100, 100); fc.setBackground(Color.cyan); f.setVisible(true); movingsprite tim = new movingsprite(); } }
and here's my code for the movingsprite class...
package JavaGame; import javax.swing.*; public class movingsprite extends javax.swing.JFrame{ public movingsprite() { a = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); a.setIcon(new javax.swing.ImageIcon("C:/Documents and Settings/apcompsci/My Documents/NetBeansProjects/JavaApplication42/src/JavaGame/bball.jpg")); add(a); pack(); } public static void main(String args[]){ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new movingsprite().setVisible(true); } }); } private javax.swing.JLabel a; }