Re: Adding two applets in an applet
I am trying to write a short code which should cover all the necessary
details :
Class A extends Japplet, MouseListener.... {
public void init() {
loadInterface();
}
private void loadInterface() {
addMouseListener(this);
addMouseMotionListener(this);
addMouseWheelListener(this);
setLayout(new BorderLayout());
tck = new Thick(...);
dc = new DrawingCanvas(...);
dc.setPreferredSize(new Dimension(this.getWidth()-50,
this.getHeight()));
dc.setMaximumSize(new Dimension(this.getWidth()-30,
this.getHeight()));
tck.setMinimumSize(new Dimension(30,this.getHeight()-80));
tck.setPreferredSize(new Dimension(50,this.getHeight()-70));
tck.setMaximumSize(new Dimension(50, this.getHeight()-60));
add(tck, BorderLayout.EAST);
add(dc, BorderLayout.CENTER);
}
}
//different file
public class DrawingCanvas extends JComponent {
/* In this class I draw a large number of polygons and lines */
}
//different file
public class Thick extends JComponent {
/* In this I draw a rectangle of a given size*/
}
It won,t be possible for me to give a self compilable code showing the
same features and which would fail, because its really hard to
replicate some of the stuff. If you could show me some way to get out
of this problem it would be of great help!!
Rohit