|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Bannato
Iscritto dal: Mar 2004
Messaggi: 171
|
[Java]Non capisco dov'è l'errore..AIUTOOOO!
Ciao!
AIUTOOOOOO!!!! Ma dov'è l'errore? a me sembra tutt ok.. E' un semplicissimo programma che sfrutta le API AWT..per creare un bottone. Una volta premuto dovrebbe stampare "Grazie".. Ecco il codice: import java.awt.*; import java.awt.event.*; class ButtonFrame extends Frame implements ActionListener { Button button; ButtonFrame(String s); { super(s); setSize(250,100); setLayout(new Flowlayout()); button = new Button("Fare clic"); add(button); button.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent event) { if (event.getActionCommand().equals("Fare clic")) System.out.println("Grazie"); } } class Test2 { public static void main(String[] args) { ButtonFrame buttonFrame = new ButtonFrame("Esempio"); } } ______________________________________ E l'errore è: C:\jena>javac Test2.java Test2.java:6: missing method body, or declare abstract ButtonFrame(String s); ^ Test2.java:7: call to super must be first statement in constructor { super(s); ^ Test2.java:9: cannot resolve symbol symbol : class Flowlayout location: class ButtonFrame setLayout(new Flowlayout()); ^ 3 errors ![]() ![]() ![]() |
![]() |
![]() |
![]() |
#2 |
Member
Iscritto dal: May 2003
Messaggi: 119
|
T dice ke manca il body al costruttore, qesto xké hai messo il ;
Inoltre FlowLayout si scrive con la L maiuscola scrivi così Codice:
ButtonFrame(String s) { super(s); setSize(250,100); setLayout(new FlowLayout()); button = new Button("Fare clic"); add(button); button.addActionListener(this); setVisible(true); } |
![]() |
![]() |
![]() |
#3 |
Bannato
Iscritto dal: Mar 2004
Messaggi: 171
|
AHHHH!!!
ECCOLO!! Grazie mille... |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 15:35.