ネタ心者歓迎!今更ながらにJava相談室 その4
■ このスレッドは過去ログ倉庫に格納されています
0687厨房ですよ!
NGNGボタンをクリックするごとにカウントアップするアプリケーションを作ってるんですが。
コンパイルエラーが出てしまいます、理由が解りません教えて下さい。
以下ソースです。
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class SampleD8L31 extends JFrame{
int intCount=0;
public SampleD8L31(String title){
super(title);
JButton mybtn=new JButton("カウントアップ");
JButton Clrbtn=new JButton("クリア");
final JLabel myLabel=new JLabel(intCount+"回クリックされました。",JLabel.CENTER);
mybtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
intCount=intCount+1;
myLabel.setText(intCount+"回クリックされました。");
}
});
Clrbtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
intCount=0;
myLabel.setText(intCount+"回クリックされました。");
}
});
JPanel myPanel=new JPanel();
myPanel.setLayout(new GridLayout(1,2));
myPanel.add(mybtn);
myPanel.add(Clrbtn);
this.getContentPane().add(myPanel,BorderLayout.NORTH);
this.getContentPane().add(myLabel,BorderLayout.CENTER);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
try{
UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.motif.MotifLookAndFeel");
SwingUtilities.updateComponentTreeUI(this);
}catch (Exception e){
}
this.setSize(350,350);
this.setVisible(true);
public static void main(String args[]){ //ここにエラーがでます。
SampleD8L31 myApp=new SampleD8L31("Click Counter") ;
} //ここにもエラー
} //ここにもエラー
■ このスレッドは過去ログ倉庫に格納されています