I am sending one question from Jxam exam simulators Q . We have created a Frame which is initialy invisible, by using which of the following method we can make the frame visible (select one or more) a. setBounds() b. setSize() c. setVisible() d. show() Please, answer the above question with explanation. Ans. according to Jxam is a,b,c.
Hi vipin, initially u set the bounds of a frame by calling setBounds(), Then u set the size of the frame by calling setSize(). Then u make it visible by calling setVisible(). u can make the frame visible only if u have set the bounds and the size, if u do not specify them its not use in just making the frame visible which has not set its size. Hope this Helps!
Hi, The question needs to be reworded to arrive at the solution that the author gets to! New question: We have created a Frame which is initially invisible. Which of the following methods could be combined to make the frame visible? Sai is correct in the sense that you need to use more than one command to get the frame visible. The technically correct answer would be that a program could perform the following two steps: a and then c, or b and then c. Since the setBounds method requires x, y, width, and height, it would be redundant to then call setSize because you just set the size already! On the other hand, you can just call setSize because the window system will supply x and y values for you (usually zeros ...). Regards, Manfred.