This discussion is archived
1 Reply Latest reply: Jul 20, 2013 7:38 AM by Jörg RSS

I could not see the cursor in my JTestField after I run when“ I add(nameField, SOUTH)” But if  I add(nameField, NORTH), everything is fine.

bd4139f1-53d2-4dae-a5a9-5932242bc677 Newbie
Currently Being Moderated

problem only appear when a add a JtestField on "South or West"  I could not see the cursor in it.  but when I typed some words in it, It accurately have these words , but I could not see them.

samething happens in IntField,  

I could no even say the testField when I  stretched the GUI ...

 

everything is ok when I added it to "west or North"

 

JDK 1.7.0_21           Eclipse SDK Version: 4.2.2

 

import acm.program.*;

import javax.swing.*;

import java.awt.event.*;

 

 

public class usingInteractor extends ConsoleProgram {

 

  public void init () {

 

  nameField = new JTextField(10);

  add(nameField, SOUTH);

  nameField.addActionListener(this);

 

  }

 

  public void actionPerformed(ActionEvent e) {

 

  if (e.getSource() == nameField)

  println("Hello, " + nameField.getText());

  }

 

  private JTextField nameField;

}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points