Which of the following methods can be used to change the size of a java.awt.Component object?1. dimension()2. setSize()3. area()4. size()5. resetSize()Options4 & 51, 2, 3 & 5 1, 2 & 5only 2
Question
Which of the following methods can be used to change the size of a java.awt.Component object?1. dimension()2. setSize()3. area()4. size()5. resetSize()Options4 & 51, 2, 3 & 5 1, 2 & 5only 2
Solution
The correct answer is "only 2". The setSize() method is used to change the size of a java.awt.Component object in Java. The other methods listed (dimension(), area(), size(), resetSize()) are not valid methods for changing the size of a Component.
Similar Questions
Select the correct answerWhat will be the output of the following Java code?class rectangle { int width; int length; int area; void area(int width, int length) { this.width = width; this.length = length; } } class Output { public static void main(String args[]) { area obj = new area(); obj.area(5 , 6); System.out.println(obj.length + " " + obj.width); } }Options6 55 630 00 30
Select the correct answerWhich of these are integer constants of ComponentEvent class?OptionsCOMPONENT_RESIZECOMPONENT_MOVEDCOMPONENT_HIDDENAll of the mentioned
Which of the following options is a property of Java arrays?a.)Data items in an array cannot be changed after they have been set.b.)Data items in an array can be of different types.c.)Data items in an array need to be of the same type.d.)The array size can be changed after it has been set.
How can you change the cursor shape in Java Swing?Question 4Answera.By calling the setCursor() method on the component and passing a predefined cursor constant.b.By setting the cursor property of the component to a predefined cursor constant.c.By calling the setCursorShape() method on the component and passing a cursor shape object.d.By calling the setCursorType() method on the component and passing a cursor type constant.
How can you change the cursor shape in Java Swing?Question 6Answera.By calling the setCursor() method on the component and passing a predefined cursor constant.b.By setting the cursor property of the component to a predefined cursor constant.c.By calling the setCursorShape() method on the component and passing a cursor shape object.d.By calling the setCursorType() method on the component and passing a cursor type constant.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.