Different Files Open in File -> Open Workspace
I ran and saved the following file in JCreator
Code:
//Print in tabs
//Java 2 page 196 EXERCISE
public class ControlJ02Pg0196PrintTabsFile20090411{
public static void main( String args []){
int x = 4; //x initialized to 4
while( x <= 40 ){
System.out.print(x);
if( x % 7 == 0) //The number 7 here indicates the number of tabs
System.out.println();
else
System.out.print( '\t');
x += 4; //x will vary in steps of 4
}
}
}
But when I open the same file from File -> Open Workspace, the following two files open
Code:
/**
* AWT Sample application
*
* @author
* @version 1.00 09/04/11
*/
public class ControlJ02Pg0196PrintTabs20090411 {
public static void main(String[] args) {
// Create application frame.
ControlJ02Pg0196PrintTabs20090411Frame frame = new ControlJ02Pg0196PrintTabs20090411Frame();
// Show frame
frame.setVisible(true);
}
}
and
Code:
import java.awt.*;
import java.awt.event.*;
/**
* Sample application using Frame.
*
* @author
* @version 1.00 09/04/11
*/
public class ControlJ02Pg0196PrintTabs20090411Frame extends Frame {
/**
* The constructor.
*/
public ControlJ02Pg0196PrintTabs20090411Frame() {
MenuBar menuBar = new MenuBar();
Menu menuFile = new Menu();
MenuItem menuFileExit = new MenuItem();
menuFile.setLabel("File");
menuFileExit.setLabel("Exit");
// Add action listener.for the menu button
menuFileExit.addActionListener
(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
ControlJ02Pg0196PrintTabs20090411Frame.this.windowClosed();
}
}
);
menuFile.add(menuFileExit);
menuBar.add(menuFile);
setTitle("ControlJ02Pg0196PrintTabs20090411");
setMenuBar(menuBar);
setSize(new Dimension(400, 400));
// Add window listener.
this.addWindowListener
(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
ControlJ02Pg0196PrintTabs20090411Frame.this.windowClosed();
}
}
);
}
/**
* Shutdown procedure when run as an application.
*/
protected void windowClosed() {
// TODO: Check if it is safe to close the application
// Exit application.
System.exit(0);
}
}
What is happening ?? I don,t even understand the above two files.