[4075] in java-interest

home help back first fref pref prev next nref lref last post

How put text in a new panel ???

daemon@ATHENA.MIT.EDU (Tim Moons)
Sat Dec 9 08:08:13 1995

Date: Sat, 09 Dec 1995 12:33:58 +0100
From: Tim Moons <tim@innet.be>
To: java-interest@java.sun.com

This is a multi-part message in MIME format.

-----------------------------18781610019734
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello all,

How can you put text in a new panel ???
I made a panel with forms(TextFields) and I want to write in front of 
the forms:
name :
password :

(If you want to see what I mean, just compile and run the attached 
example !!!)
(If you use WIN95, just wait 2 minutes, because it starts slowely)

In the basic panel you can use drawString, but what in a self-made panel 
???

Thanks, and until later ....;

        Tim Moons  .. :-)

Email : tim@innet.be
Phone : (on monday and thusday) +32 3 281 49 83

-----------------------------18781610019734
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="submit.java"

/* Submition for username and password !!! */
/* 09-12-1995      Tim Moons    INnet n.v. */


import java.awt.*;
import java.applet.*;

public class submit extends Applet {
  Panel infobar;
  Panel mainbar;
  TextField name;
  TextField password;

  public void init() {
    resize(250,125);
    setLayout(new BorderLayout());
    setBackground(Color.gray);
    setFont(new Font("Helvetica", Font.BOLD, 12));
  }

  public void start() {
    name = new TextField();
    password = new TextField();

    Panel p = new Panel();
    p.setLayout(new BorderLayout());
    p.add("North", name);
    p.add("South", password);

    mainbar = new Panel();
    mainbar.setLayout(new BorderLayout());
    mainbar.add("Center", p);
    add("Center", mainbar);

    Button Submit = new Button("Submit");
    Button Clear = new Button("Clear");

    infobar = new Panel();
    infobar.add(Submit);
    infobar.add(Clear);
    add("South", infobar);
  }

  public boolean action(Event evt, Object arg) {
    if("Submit".equals(arg)) {
      showStatus("If this worked... the data would be submitting");
      return true;
    } else if("Clear".equals(arg)) {
        name.setText("");
        password.setText("");
        return true;
      }
    return false;
  }
}

-----------------------------18781610019734--

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post