Prashant Pundrik

Greenhorn
+ Follow
since Jan 01, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Prashant Pundrik

Is it a name specific logo ? I mean,is there a shortcut for the mean time?
Thanx
prashant
23 years ago
I cleared the SCJP yesterday.A big mega thanx to Javaranch. Great help it has been in the worst of times.There is one thing i wanted to ask although I do think that it is slightly out of context.I need to put the logo on my resume. Where can i get it from and what are the rules and regulations governing that? Any links?
Thanx
Prashant
23 years ago
Dear Mahesh,
When are you planning to appear i cleared the sme yesterday. Maybe i cud be of some help.My email id is p_pundrik@yahoo.com
Thanx
Prashant
23 years ago
Shalini,
The catch block is not mandatory if you are defining a finally block.The program will compile and run.The exception will be handled by the finally block but you will not be able to get a description of the exception which was thrown.
Shalini,
The catch block is not mandatory if you are defining a finally block.The program will compile and run.The exception will be handled by the finally block but you will not be able to get a description of the exception which was thrown.
Cristi,
I tried and was right.If you put the two lines setSize and setVisible right where the constructor is being define i.e after the line add(bCenter) you will get a frame showing five buttons arranged in a row as per the layout manager which is set to Flow.
in the first line of the constructor.
Regards
Prashant

Originally posted by Cristi Tudose:
Atin&Prashant
I admited i'm not study complet this part(AWT) but... i'm a little confused about your arguments.
If you only switch the lines which set the LayoutManager could u tell me what's output.You may compile&run,but please give
me a reson
And if you know( or anybody else) some URLs where the AWT is properly treat give me a sign.
Rgds,Cristi


Dear Cristi,
I am a new entrant and this is my first attempt at replying to anything on this forum. As far as your question is concerned, well the trick i think lies in the setVisible part.The default visibility for all components is true except for Window , Frame and Dialog classes.They must be set true explicitly for these classes at the time of creation of the instance. Since you are not doing it at that time(it is being done after the validate method is called) there is no object(frame) to be seen and then even if you try to change the layout or anything else would not work.
I hope I am right.
Thanx
prashant

Originally posted by Cristi Tudose:
this is taken from a mock exam:
import java.awt.*;
public class TestFrame extends Frame
{
Button bNorth = new Button("North");
Button bSouth = new Button("South");
Button bEast = new Button("East");
Button bWest = new Button("West");
Button bCenter = new Button("Center");
public TestFrame()
{
setLayout(new FlowLayout());
add(bNorth);
add(bSouth);
add(bWest);
add(bEast);
add(bCenter);
setLayout(new BorderLayout());
validate();
setSize(300,300);
setVisible(true);
}
public static void main(String args[])
{
TestFrame tf = new TestFrame();
}
}

Attemping to compile and run the above code

#Will cause a compilation error - a Layout cannot be set after a component has been added with a preset Layout Manager.
#Will cause a Runtime Exception - a Layout cannot be set after a component has been added with a preset Layout
Manager.
#Will compile cleanly and throw no runtime Exception. Only the button with label "Center" is visible and occupies the whole screen.
#Will compile cleanly an throw no runtime Exception. All the buttons are arranged in a single line. Any other component added in future will follow the rules of the BorderLayout Manager.
#Will compile and run cleanly, but no component is visible.
#Will compile cleanly and throw no runtime Exception. The buttons are arranged as listed below
Button Label Position
CenterCenter
Noerth North
SouthSouth
EastEast
WestWest
Could someone give the explanations for the correct answer provided(#Will compile and run cleanly, but no component is visible).
thanks in advance
Cristi