public void mouseClicked(MouseEvent e) {
        //if (e.getClickCount() == 2 && !e.isConsumed()) {
        if(e.getButton()==MouseEvent.BUTTON3){
            //e.consume();
            Color color=last;
            color =
                  JColorChooser.showDialog( this,
                     "Choose a color", color );
            if(color==null){
                return;
            }
            last=color;
            if(m!=null){
                if(e.isControlDown()) type=1;
                if(e.isShiftDown()) type=2;
                m.setColor(color, 1);
            }
            drawLast();
            repaint();
        }
        else{
            set(e);
        }
    }