Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't reposition One textfiled in Java AWT
    primarykey
    data
    text
    <p>I am trying to make a login form using Java AWT. And i made it. But when i click button, all filed except "Pin" displayed in correct places. "Pin" was displayed in the same dimension as of "Name". I can't re-position the "Pin" text-field. why? This is the code:</p> <pre><code> import java.awt.*; import java.awt.event.*; import java.applet.*; public class Loginform extends Frame implements ActionListener { Label l1=new Label("Name"); Label l2=new Label("Street"); Label l3=new Label("City"); Label l4=new Label("Pin"); Label l5=new Label(" "); Label l6=new Label(" "); Label l7=new Label(" "); Label l8=new Label(" "); TextField t1=new TextField(); TextField t2=new TextField(); TextField t3=new TextField(); TextField t4=new TextField(); Button b= new Button("Submit"); public Loginform() { add(l1); add(t1); add(l2); add(t2); add(l3); add(t3); add(l4); add(t4); add(b); add(l5); add(l6); add(l7); add(l8); l1.setBounds(20,45,70,20); t1.setBounds(180,45,200,20); l2.setBounds(20,95,70,20); t2.setBounds(180,95,200,20); l3.setBounds(20,135,70,20); t3.setBounds(180,135,200,20); l4.setBounds(20,175,70,20); t4.setBounds(180,175,200,20); l5.setBounds(20,300,70,20); l6.setBounds(20,320,70,20); l7.setBounds(20,340,70,20); l8.setBounds(20,360,70,20); b.setBounds(410,245,70,20); b.addActionListener(this); addWindowListener(new mwa()); } public void actionPerformed(ActionEvent e) { l5.setText("Name: "+t1.getText()); l6.setText("Street: "+t2.getText()); l7.setText("City: "+t3.getText()); l8.setText("Pin: "+t4.getText()); } public static void main(String s[]) { Loginform l=new Loginform(); l.setSize(new Dimension(600,600)); l.setTitle("REGISTRATION"); l.setVisible(true); } } class mwa extends WindowAdapter { public mwa(){} public void windowClosing(WindowEvent e) { System.exit(0); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload