Solved

button to a frame?

Posted on 2001-06-22
3
231 Views
Last Modified: 2010-03-31
how can i add a textfield and buuton to aframe?
0
Comment
Question by:mca1
3 Comments
 

Accepted Solution

by:
anmadhu earned 75 total points
ID: 6217324
create objects for the field, button and frame.
for eg

Frame a =new Frame("asdf");
TextField b=new TextField("qwer",30);
Button c=new Button("button");
a.setSize(200,200);
a.add("North",c);
a.add("Center",b);
a.setVisible(true);
0
 
LVL 3

Expert Comment

by:rjackman
ID: 6217327
simple
add following in ur code
java.awt.Frame f = new java.awt.Frame();
java.awt.Button but = new java.awt.Button("myButton");
f.add(but);
java.awt.TextField tf = new java.awt.TextField(10);
f.add(tf);
f.pack();
f.setVisible(true);

cheers
RJ
0
 

Expert Comment

by:RajeshTandel
ID: 6218172
make an instance of textfield or button, get the content type of the frame and add the component to it.
code as follows.

Frame fm = new Frame();
Button btn = new Button("Hello");
fm.getContentPane().add(btn);
fm.setSize(400,400);
fm.show();
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question