Consider the following code :
/**
* Main class
* @author X2
*
*/
class DrawingPanel extends JPanel implements MouseListener, MouseMotionListener ,KeyListener
{
/**
* private variables
*/
// dimensions of the window
private static final long serialVersionUID = 1L;
private static final Dimension MIN_DIM = new Dimension(300, 300);
private static final Dimension PREF_DIM = new Dimension(500, 500);
/**
* Setting the dimensions of the window
*/
public Dimension getMinimumSize() { return MIN_DIM; }
public Dimension getPreferredSize() { return PREF_DIM; }
/**
* The constructor
*/
DrawingPanel()
{
super();
addMouseListener(this);
addMouseMotionListener(this);
addKeyListener(this);
setFocusable(true);
requestFocusInWindow();
}
public void paintComponent(Graphics g)
{
// code
}
public void mouseClicked(MouseEvent evt)
{ // code
}
// more code
How can I add a panel to my window , where I need the options for opening and saving files .
At the moment the window looks like that :
Thanks