Thanks Matt for your reply...
My applet is as follows :
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Cust extends Applet implements ActionListener{
Label Msg= new Label("");
TextField tf = new TextField("hi",10);
Panel PanMain,pNorth,pCenter;
BorderLayout blMain;
Button bAdd,bEdit,bDel,bView,EditChk,AddChk;
public void init() {
PanMain = new Panel();
blMain = new BorderLayout();
PanMain.setLayout(blMain);
String PanMainCol= "#17518b";
add(PanMain);
pNorth = new Panel();
PanMain.add(pNorth,blMain.NORTH);
pNorth.setBackground(new Color("#fccffc".hashCode()));
bAdd = new Button("ADD");
bEdit = new Button("EDIT");
bDel = new Button("DELETE");
bView = new Button("VIEW");
pNorth.add(bAdd);
pNorth.add(bEdit);
pNorth.add(bDel);
pNorth.add(bView);
pNorth.add(tf);
bAdd.addActionListener(this);
bEdit.addActionListener(this);
bDel.addActionListener(this);
bView.addActionListener(this);
tf.addActionListener(this);
addPanel("789789789");
}
public void actionPerformed (ActionEvent ae) {
if (ae.getSource()==bAdd) {
tf.setText("Adding Records");
pCenter.removeAll();
addPanel("567567567");
pCenter.validate();
}
if (ae.getSource()==bEdit) {
tf.setText("Editing Records");
pCenter.removeAll();
addPanel("123123123");
pCenter.validate();
}
}
public void addPanel(String ColorVal) {
pCenter= new Panel();
PanMain.add(pCenter,blMain.SOUTH);
pCenter.setBackground(new Color(ColorVal.hashCode()));
pCenter.add(new Button(ColorVal));
}
}
Originally posted by Matthew Gaunt:
Do you mean change that each button changes a certain region of the border layout (ie-North South East West Center).
It is a little difficult to understand what section of the panel is supposed to change when you press the buttons. And where are the buttons positioned?
Best Regards
Matt
[This message has been edited by Stephanie Grasson (edited March 13, 2001).]
[This message has been edited by Stephanie Grasson (edited March 13, 2001).]