HI am new to Java Swings. I opened a new internal frame with a canvas in it for drawing. I want to zoom the canvas. I mean i need to zoom the canvas even before i draw anything. Similar to photoshop. we create a new file with so and so pixel and we can zoom the new opened file upto around 1600%. i want similarly.. zoom my canvas with scroll bars.. how can i accomplish this..
the following code creates a new internal frame with a new canvas..


import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.MouseWheelListener;

/**
*
* @author Raghavan
*/
public class MyInternalFrame extends javax.swing.JInternalFrame {

static int openFrameCount = 0;
static final int xOffset = 30, yOffset = 30;
static PaintCanvas canvas;

public MyInternalFrame(int h,int w) {
super(OpenNewBox.jTextField1.getText(),
true, //resizable
true, //closable
true, //maximizable
true);//iconifiable
canvas= new PaintCanvas();

Container content = this.getContentPane();
content.setLayout(new BorderLayout());

//canvas.setPreferredSize(new Dimension(w,h));
content.add(canvas, BorderLayout.CENTER);
//...Create the GUI and put it in the window...

//...Then set the window size or call pack...

setSize(w,h);

//Set the window's location.
setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

jScrollPane1 = new javax.swing.JScrollPane();

setBorder(javax.swing.BorderFactory.createEtchedBo rder(javax.swing.border.EtchedBorder.RAISED, null, new java.awt.Color(204, 204, 204)));
setAutoscrolls(true);
setDoubleBuffered(true);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 285, Short.MAX_VALUE)
);

pack();
}// </editor-fold>


// Variables declaration - do not modify
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration

}