Explore BrainMass

Explore BrainMass

    Java program to move a rectangle on mouse click

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write an application that draws a rectangle within a panel as shown in the attachment p10.png .

    When user clicks in a point left of the rectangle, it moves 10px to left. It also moves to right by 10px if user clicks on a point right to the rectangle. Clicking in any other areas such as above, inside or below the rectangle will do nothing.

    I have to compile and execute the program at commandline in Java.

    © BrainMass Inc. brainmass.com November 30, 2021, 6:35 am ad1c9bdddf
    https://brainmass.com/computer-science/graphics/java-program-move-rectangle-mouse-click-565681

    Attachments

    Solution Preview

    Please rename 565681-DrawRect.java as DrawRect.java before you compile and execute the ...

    Solution Summary

    Java compiler and Java version "1.7.0_21" were used during development and testing of the attached program. Response includes instructions to compile and execute the program at commandline.

    $2.49

    ADVERTISEMENT