public void mouseDragged(MouseEvent e) 
        {
            currentX = e.getX();
            currentY = e.getY();

             if (SHAPE_TOOLS.contains(currentshape) ) // flag == false)  // only to show shape while drawing rect /line
            {
                repaintRect(startX, startY, prevX, prevY);                            //no permanent
                repaintRect(startX, startY, currentX, currentY);
            }
            
            else if (currenttool == tool.eraser)
            {
                dragging = false;
                Graphics g = buffer.getGraphics();
                g.setColor(fillColor);

                Packet p=new Packet(diffrentShapes.RECT_FILL,fillColor,prevX,prevY,17,17);
                try {
                        oos.writeObject(p);
                        oos.flush();
                    } catch (Exception ex) {
                        System.err.println("Object output error: " + ex);
               }
                g.fillRect(prevX, prevY,17,17);
                repaint(prevX, prevY, currentX, currentY);
                g.dispose();
            }
            
            else if (currenttool == tool.brush)
            {
                dragging = false;
                Graphics g = buffer.getGraphics();
                g.setColor(currentColor);
       
                Packet p=new Packet(diffrentShapes.OVAL_FILL,currentColor,prevX,prevY,17,17);
                try {
                        oos.writeObject(p);
                        oos.flush();
                    } catch (Exception ex) {
                        System.err.println("Object output error: " + ex);
               }
                g.fillOval(prevX, prevY, 17, 17);
                repaint(prevX, prevY, currentX, currentY);
                g.dispose();
            }

            else if(currenttool==tool.pencil)
            {   
                Graphics g = buffer.getGraphics();
                g.setColor(currentColor);
                //packet create korte hbe
                Packet p= new Packet(diffrentShapes.LINE,currentColor,prevX, prevY,currentX,currentY);
                try {
                        oos.writeObject(p);
                        oos.flush();
                    } catch (Exception ex) {
                        System.err.println("Object output error: " + ex);
               }
                g.drawLine(prevX, prevY, currentX, currentY);
                g.dispose();
                repaintRect(prevX, prevY, currentX, currentY);
            }
            prevX = currentX;
            prevY = currentY;
        }