0

im getting setbounds values as magic numbers. Is there a way to assign all values to a variable rather than assigning a variable to each value?

setBounds(10,0,30,200); 

thanks in advance.

1
  • 3
    Swing? please provide a context for this question Commented Oct 11, 2013 at 10:21

1 Answer 1

3

You can create an instance of the Rectangle class and pass this as argument and the Rectangle will be defined as final static constant

private final static Rectangle xBounds = new Rectangle(10,0,30,200); 

inside your code

setBounds(xBounds); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.