Right justified JTextfield contentTag(s): Swing


import javax.swing. *;
import java.awt.*;

public class Test extends JApplet {
  JTextField textfield;
  public void init() {
    getContentPane().setLayout(new FlowLayout());
    textfield = new JTextField(10);
    // Right-justify the text
    textfield.setHorizontalAlignment(JTextField.RIGHT);
    getContentPane().add(textfield);
    }
}

blog comments powered by Disqus