Galera, me desculpem se ja existe algum topico como esse. Muito trabalho (PHP,ASP,CFM), e num tenhu tempo pra nada. Estou me preparando para o SCJP, MCSE, TOEFL e Sat.
Unico tempo que tenho, visito o forum, o que da mais ou menos uns 20 minutos.
Tenhu uma duvida enorme de o que acontece quando eu vou compilar esse codigo aii.
A seguir, coloco o codigo eo erro, pesso que quem entender me ajude.
import java.awt.GridLayout;
import java.awt.event.*;
import java.awt.swing.*;
public class Swinger extends JFrame {
public Swinger() {
super("Swinger");
String note = "I receive a disproportionate amount of " +
"joy from being clicked. Please interact with me.";
JButton hotButton = new JButton(note);
JPanel pane = new JPanel();
pane.add(hotButton);
setContentPane(pane);
}
public static void main(String[] args) {
JFrame frame = new Swinger ();
WindowListener l = new WindowAdapter() {
public void windowsCLosing(WindowEvent e) {
System.exit(0);
}
};
frame.addWindowListener(l);
frame.pack();
frame.setVisible(true);
}
}
Vamos aos erros apresentados na hora de compilar :
C:\Java>javac Swinger.java
Swinger.java:3: package java.awt.swing does not exist
import java.awt.swing.*;
^
Swinger.java:5: cannot find symbol
symbol: class JFrame
public class Swinger extends JFrame {
^
Swinger.java:12: cannot find symbol
symbol : class JButton
location: class Swinger
JButton hotButton = new JButton(note);
^
Swinger.java:12: cannot find symbol
symbol : class JButton
location: class Swinger
JButton hotButton = new JButton(note);
^
Swinger.java:14: cannot find symbol
symbol : class JPanel
location: class Swinger
JPanel pane = new JPanel();
^
Swinger.java:14: cannot find symbol
symbol : class JPanel
location: class Swinger
JPanel pane = new JPanel();
^
Swinger.java:21: cannot find symbol
symbol : class JFrame
location: class Swinger
JFrame frame = new Swinger ();
^
7 errors
C:\Java>javac Swinger.java
Swinger.java:3: package java.awt.Swing does not exist
import java.awt.Swing.*;
^
Swinger.java:5: cannot find symbol
symbol: class JFrame
public class Swinger extends JFrame {
^
Swinger.java:12: cannot find symbol
symbol : class JButton
location: class Swinger
JButton hotButton = new JButton(note);
^
Swinger.java:12: cannot find symbol
symbol : class JButton
location: class Swinger
JButton hotButton = new JButton(note);
^
Swinger.java:14: cannot find symbol
symbol : class JPanel
location: class Swinger
JPanel pane = new JPanel();
^
Swinger.java:14: cannot find symbol
symbol : class JPanel
location: class Swinger
JPanel pane = new JPanel();
^
Swinger.java:21: cannot find symbol
symbol : class JFrame
location: class Swinger
JFrame frame = new Swinger ();
^
7 errors