• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display in the panels

 
sbezawada
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to solve a problem in my project,related to the display in the panels.The problem is as follows..
We have two panels in an applet,the top panel will have buttons and two text fields,and the bottom panel is blank.when the user enter the company name in the text field and press submit button,
the homepage of the company entered should be displayed in the lower panel,but when we try to do the same it displays the output in a new browser window.
we are using the code appletcontext.showDocument(urlof company,lower panel).
This is very urgent.
Thanks in advance
 
Max
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,
See may be this will help?
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class EvenPanel extends Applet implements ActionListener
{
Button b;
TextField tf1;
TextField tf2;
Panel p1;
Panel p2;
public void init()
{
this.setLayout(new BorderLayout());
tf1 = new TextField("", 20);
tf2 = new TextField("", 20);
b = new Button("OK");
p1 = new Panel();
p2 = new Panel();
p1.add(tf1);
p1.add(b);
p2.add(tf2);
this.add(p1, BorderLayout.NORTH);
this.add(p2, BorderLayout.SOUTH);
b.addActionListener(this);
}

public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();// Get the source of the Event
if(source == b)
{
tf2.setText(tf1.getText());
}
}
}
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sbezawada and Max,
Thanks for posting your messages. Please be sure to register with proper names. See here for details: http://www.javaranch.com/name.jsp
If you do not register properly, your accounts will be disabled. I would hate to see that happen.
Thank you.
Stephanie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic