Thought I would post in this thread instead of creating a new one, as my question is related. The next part of the book I'm working with is to add buttons to the window created. The following is my...
Type: Posts; User: Tedstriker
Thought I would post in this thread instead of creating a new one, as my question is related. The next part of the book I'm working with is to add buttons to the window created. The following is my...
import javax.swing.*;
class Window extends JFrame
//beginning of class
{
JPanel pnl = new JPanel() ;
public static void main ( String[] args)
//beginning of main method
{...
Ok, corrected that...looks like its getting better. However, I now get the following error:
add ( pnl ) ;
^
cannot find symbol - variable pnl
Now I get this error:
public Window()
^
invalid method declaration; return type required
import javax.swing.*;
class Note extends JFrame
//beginning of class
{
public static void main ( String[] args)
//beginning of main method
{
JPanel pnl = new...
Thanks Norm, but reading that just doesn't make sense to me. When it says JPanel pnl = newJPanel(); goes before the main method, where would that be? where would the different methods begin and end....
So I've been messing around with this. While its still wrong, at least I got a different error (class, interface, or enum expected with the ^ under the word void) with this effort:
import...
Sorry Norm, but I'm having allot of trouble with this.....I gather my original code is arranged wrong due to the placement of my {s? How should they be arranged?
the book I'm using reads as follows:
1) Start a new program that imports all Swing components
import javax.swing.* ;
2)Create a subclass of the JFrame class named "Window" containing...
I tried changing the class name, but it didn't seem to make a difference.
I tried compiling it through the command prompt, and got the following results:
Window.java:7: error: ';' expected
...
import javax.swing.*;
class Window extends JFrame
{
public static void main ( String[] args)
{
JPanel pnl = new JPanel() ;
public Window()
{
super(...
import javax.swing.*;
class Window extends JFrame
{
public static void main ( String[] args)
{
JPanel pnl = new JPanel() ;
public Window()
{
super(...