Confuced when import packages...
Code :
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class MyFrame extends JFrame{
JButton btYes;
JButton btNo;
JButton btCancel;
MyFrame(){
setLayout(new FlowLayout());
btYes=new JButton("Yes");
btYes.addActionListener(new MyAction());
btNo =new JButton("No");
btCancel=new JButton("Cancel");
add(btCancel);
add(btNo);
add(btYes);
pack();
}
public static void main(String args[]){
new MyFrame().setVisible(true);
}
}
class MyAction implements ActionListener{
public void actionPerformed(ActionEvent evt){
JOptionPane.showMessageDialog(null,"You pressed Yes Button");
}
}
:confused:
Dear java friends; I'm confused when import package using * .
When we import awt package by import java.awt.*; as I know it imports all the classes in awt package. If so why we have to call import java.awt.event.*; in this program. Please be kind to help me to solve this problem.
Re: Confuced when import packages...
Re: Confuced when import packages...
More here (link below)
Packages
db