Solved

button to a frame?

Posted on 2001-06-22
3
202 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumHeights  challenge 17 61
Java Message handling in Service Layer 3 37
@SBGen Method 3 25
Java array passed to SQL where clause 23 41
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now