Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    2

    Question Unanswered: help with simple code please

    Can someone help me with this. I am having a problem with my setLayout. Suggestions, hints, tips, etc would be greatly appreciated. Thanks.

    import java.awt.*;
    import java.awt.event.*;
    import java.math.*;
    //package pipeline;

    public class pipeline {
    private TextField IF=new TextField(),
    ID=new TextField(),
    EXE=new TextField(),
    MEM=new TextField(),
    WB=new TextField(),
    TI=new TextField();
    //CPIEXE=new Textarea();
    String s1=new String("IF");
    String s2=new String("ID");
    String s3=new String("EXE");
    String s4=new String("MEM");
    String s5=new String("WB");
    String s6=new String("Total Instructions");
    private Button calcB = new Button("Calculate");
    private Button exitB = new Button("Exit");
    //public pipeline() {
    public void init()
    {
    setLayout(new BorderLayout());
    Panel p=new Panel();
    p.add(s1);
    p.add(IF);
    p.add(s2);
    p.add(ID);
    p.add(EXE);
    p.add(MEM);
    p.add(WB);
    add("North", p);
    add("South", calcB, exitB);
    }
    /*public static void main(){
    //Execution = CPI x IC x CCtime
    }
    }*/
    public static void main(String[] args)
    {
    // make the JFrame
    JFrame myFrame = new JFrame();
    // make an instance of THIS class
    Pipeline myPanel = new Pipeline();
    // put the panel into the JFrame
    myFrame.getContentPane().add(myPanel);
    // set the size of the JFrame
    myFrame.setSize(400,300);
    // Make it visible
    myFrame.setVisible(true);

    myFrame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e){
    System.exit(0);
    }
    });
    }
    }

  2. #2
    Join Date
    Feb 2004
    Posts
    18
    It would be better if you could provide some information as to what problem are u getting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •