Question: I have problem incrementing this by one per click. 

```
class window extends JPanel implements MouseListener{

int a=0;

public void paint(Graphics g){
    super.paint();
    g.drawLine(5, 5, 200, 200); // TEST draw

}

@Override
public void mousePressed(MouseEvent e) {
    a++; // increment by one
    System.out.println(a);// print out 
}

@Override
public void mouseReleased(MouseEvent e) {
    // TODO Auto-generated method stub

}

}

class drawSpline_frame extends JFrame {
public drawSpline_frame(){
    setSize(500,500);
    setTitle("Spline");

    Container cp =  this.getContentPane(); // EDITED
    cp.add(window, BorderLayout.CENTER );
            window.addMouseListener(window);
}

}

class drawSpline{
public static void main(String[] args) {
    JFrame frame = new drawSpline_frame();
    frame.setVisible(true);

    }
}

```

Answer: 
You need to **instantiate** – that is, [create an instance of](http://docs.oracle.com/javase/tutorial/java/javaOO/objectcreation.html) – `DataManage`, before you can call a method on it. Everything else looks fine.

So where you currently have this:

```
DataManage object;

object.FileCreate();

```

use `new` to create a new instance:

```
DataManage object = new DataManage();

object.FileCreate();

```
In OOP programing , there are many kinds of classes you can use:
You are lookin for creating new instance for a class - which means the class is dynamic.

[There are two parts of "creating" a new instance to a class,](http://java.about.com/od/workingwithobjects/ss/designobjects_6.htm)
First - the decleration (the type and the name of the instanse)
You just did it by :

```
DataManage dataManage ;

```

now the other part is instatcing the new type we created using the "new" keyword:

```
DataManage dataManage = new DataManage();

```

By using the "new" keyword you call the constractor of DataManage (which is DataManage())

```
public void FileCreate()

```

Obviosly , the constactor can be built in a way it requires imputing parameters, so you will have to call the providing those parameters.

Then you can use the methods for the instance using the ".", just as you did before.

```
dataManage.FileCreate(); 

```

For classes that contain simple methods, called "Utility classes" you can use static classes, where you don't need to instantiate the class, and can simply call the methodes inside, But i advise you [read this first](https://stackoverflow.com/questions/205689/class-with-single-method-best-approach#206481) , it will help avoiding common design mistakes and to maintain the OOP principles.