import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class Test extends JFrame{
JLabel label = new JLabel("Leann will come again");
JButton yesButton = new JButton("Yes");
JButton noButton = new JButton("Yes");
JPanel panel = new JPanel();
public Test(){
panel.add(label);
panel.add(yesButton);
panel.add(noButton);
add(panel);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
addAction();
}
public void addAction(){
yesButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(null, "Are you sure?");
}
});
noButton.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(null, "Too bad!");
}
});
}
public static void main(String args[]){
Test app = new Test();
}
}
когда я запускаю это на своем компьютере с Ubuntu с помощью eclipse, он останавливается (завершается) без ошибок В консоли также нет ошибок. И никаких синтаксических ошибок.
Что не так? Это потому что я запускаю openjdk?