rect answerWhich 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()Options1, 2, 3 & 5 1, 2 & 54 & 5only 2
Question
rect answerWhich 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()Options1, 2, 3 & 5 1, 2 & 54 & 5only 2
Solution
The correct method to change the size of a java.awt.Component object is setSize(). So, the correct answer is "only 2".
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
Method OverridingGiven below is the code for the Rectangle class.Define a new class named Square and override the methods area() and perimeter() to calculate the area and perimeter of a square.public class Rectangle { private double width; private double height; Rectangle(double width, double height){ this.width = width; this.height = height; } public double getWidth() { return width; } public double getHeight() { return height; } public void area() { System.out.println("Area of Rectangle is: " + (width * height) ) ; } public void perimeter() { System.out.println("Perimeter of Rectangle is: " + ( (2* width) + (2* height) ) ) ; }}
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.
Select the correct answerWhich of these are integer constants of ComponentEvent class?OptionsCOMPONENT_RESIZECOMPONENT_MOVEDCOMPONENT_HIDDENAll of the mentioned
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.