[SOLVED] [newbie] ??.setTitle()
I'm following this tutorial and hope someone can let me know what is wrong with this code. Unfortunately the API is not very helpful if you don't really know the packages.
:confused:
Code:
ImageFrame.java
import javax.swing.JFrame;
import java.awt.*;
public class ImageFrame {
public ImageFrame()
{
[B]setTitle("ImageTest"); //what did he mean?[/B]
setSize("DEFAULT_WIDTH, DEFAULT_HEIGHT"); //what did he mean?
//add component to the frame
ImageComponent component = new ImageComponent();
add(component);
}
public static final int DEFAULT_WIDTH=300;
public static final int DEFAULT_HEIGHT=200;
}
Error (argh):
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems:
The method setTitle(String) is undefined for the type ImageFrame
The method setSize(String) is undefined for the type ImageFrame
The method add(ImageComponent) is undefined for the type ImageFrame
at ImageFrame.<init>(ImageFrame.java:7)
at Test$1.run(Test.java:17)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)