by

Make Transparent when Drag and Drop JPanel

int xy, xx;
    private void headerPanelMousePressed(java.awt.event.MouseEvent evt) {                                         
        setOpacity((float)0.9);
        xx = evt.getX();
        xy = evt.getY();
    }                                        

    private void headerPanelMouseDragged(java.awt.event.MouseEvent evt) {                                         
        int x = evt.getXOnScreen();
        int y = evt.getYOnScreen();
        this.setLocation(x - xx, y - xy);
    }                                        

    private void headerPanelMouseReleased(java.awt.event.MouseEvent evt) {                                          
        setOpacity((float)1.0);
    }

 

Please follow and like us:

Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

News Feed