I'm going to assume your indentation got messed up on posting, but just in case, you should indent all of the code inside of the Camera
class an additional time.
First off, I like that you used constants at the top of your code! To ensure that they look and act like constants, you should make them private
, static
, final
, and named in UPPERCASE_FORMAT
. Furthermore, I would recommend separating your constants from your class variables (such as mouseLocation
and offsetX
).
I'm not entirely sure how your functions are being called. It looks like you are implementing MouseMotionListener
, so I would definitely add that to your class declaration.
If that is true, then I don't see the purpose of the drag
variable. The mouseDragged
function is only going to get called if the mouse is actually being dragged, so assigning a boolean when the mouse is pressed and released appears redundant.
Also, I'd recommend considering whether you want to use BigDecimal. If round
needs to be fast, then you don't want to use BigDecimal
at all. There are other techniques for rounding to the nth
digit that can be found here here
I'm going to assume your indentation got messed up on posting, but just in case, you should indent all of the code inside of the Camera
class an additional time.
First off, I like that you used constants at the top of your code! To ensure that they look and act like constants, you should make them private
, static
, final
, and named in UPPERCASE_FORMAT
. Furthermore, I would recommend separating your constants from your class variables (such as mouseLocation
and offsetX
).
I'm not entirely sure how your functions are being called. It looks like you are implementing MouseMotionListener
, so I would definitely add that to your class declaration.
If that is true, then I don't see the purpose of the drag
variable. The mouseDragged
function is only going to get called if the mouse is actually being dragged, so assigning a boolean when the mouse is pressed and released appears redundant.
Also, I'd recommend considering whether you want to use BigDecimal. If round
needs to be fast, then you don't want to use BigDecimal
at all. There are other techniques for rounding to the nth
digit that can be found here
I'm going to assume your indentation got messed up on posting, but just in case, you should indent all of the code inside of the Camera
class an additional time.
First off, I like that you used constants at the top of your code! To ensure that they look and act like constants, you should make them private
, static
, final
, and named in UPPERCASE_FORMAT
. Furthermore, I would recommend separating your constants from your class variables (such as mouseLocation
and offsetX
).
I'm not entirely sure how your functions are being called. It looks like you are implementing MouseMotionListener
, so I would definitely add that to your class declaration.
If that is true, then I don't see the purpose of the drag
variable. The mouseDragged
function is only going to get called if the mouse is actually being dragged, so assigning a boolean when the mouse is pressed and released appears redundant.
Also, I'd recommend considering whether you want to use BigDecimal. If round
needs to be fast, then you don't want to use BigDecimal
at all. There are other techniques for rounding to the nth
digit that can be found here
I'm going to assume your indentation got messed up on posting, but just in case, you should indent all of the code inside of the Camera
class an additional time.
First off, I like that you used constants at the top of your code! To ensure that they look and act like constants, you should make them private
, static
, final
, and named in UPPERCASE_FORMAT
. Furthermore, I would recommend separating your constants from your class variables (such as mouseLocation
and offsetX
).
I'm not entirely sure how your functions are being called. It looks like you are implementing MouseMotionListener
, so I would definitely add that to your class declaration.
If that is true, then I don't see the purpose of the drag
variable. The mouseDragged
function is only going to get called if the mouse is actually being dragged, so assigning a boolean when the mouse is pressed and released appears redundant.
Also, I'd recommend considering whether you want to use BigDecimal. If round
needs to be fast, then you don't want to use BigDecimal
at all. There are other techniques for rounding to the nth
digit that can be found here