Package Stars;
Import the Java. The awt. Event. An ActionEvent;
Import the Java. The awt. Event. ActionListener;
The import javax.mail. Swing. JButton;
The import javax.mail. Swing. JFrame;
The import javax.mail. Swing. JPanel;
Public class StarFrame_01 extends JFrame {
/* *
* planet simulation start panel*/
private static final long serialVersionUID=1L;
Star center=new Star (450250);//define the center planet
Stars p1=new Stars (450 + 250250 + 150, center);//around the center of the planet
JButton jb1=new JButton (" start ");
JButton jb2=new JButton (" pause ");
JButton jb3=new JButton (" accelerate ");
JButton jb4=new JButton (" decelerate ");
EnlargeTrack JButton jb5=new JButton (" ");
ReduceTrack JButton jb6=new JButton (" ");
AddTrack JButton jb7=new JButton (" ");
JPanel jp.
JFrame jf.
Public StarFrame_01 () {
Jf=new JFrame (" planetary motion simulation ");
Jp=new JPanel ();
jp.add(jb1);
jp.add(jb2);
Jp. Add (jb3);
Jp. Add (jb4);
Jp. Add (jb5);
Jp. Add (jb6);
Jp. Add (jb7);
Jf. Add (jp, "South");
Jf. Add (p1);
//jf. Add (p2);
Jb1. AddActionListener (new ActionListener () {
Public void actionPerformed (an ActionEvent e) {
//TODO Auto - generated method stub
P1. The start ();
}
}
);
Jb2. AddActionListener (new ActionListener () {
Public void actionPerformed (an ActionEvent e) {
//TODO Auto - generated method stub
P1. Pause ();
}
});
Jb3. AddActionListener (new ActionListener () {
Public void actionPerformed (an ActionEvent e) {
//TODO Auto - generated method stub
P1. Accelerate ();
}
});
Jb4. AddActionListener (new ActionListener () {
Public void actionPerformed (an ActionEvent e) {
//TODO Auto - generated method stub
P1. Decelerate ();
}
});
Jb5. AddActionListener (new ActionListener () {
Public void actionPerformed (an ActionEvent e) {
//TODO Auto - generated method stub
P1. Enlarge ();
}
});
Jb6. AddActionListener (new ActionListener () {
Public void actionPerformed (an ActionEvent e) {
//TODO Auto - generated method stub
P1. The reduce ();
}
});
Jb7. AddActionListener (new ActionListener () {
Public void actionPerformed (an ActionEvent e) {
//TODO Auto - generated method stub
Stars p2=new Stars (450 + 200250 + 100, center);
Jf. Add (p2);
}
});
Jf. SetSize (900, 600);
Jf. SetVisible (true);
}
Public static void main (String [] args) {
@ SuppressWarnings (" unused ")
StarFrame_01 f=new StarFrame_01 ();
}
}