JTextField.TRAILING : JTextField « javax.swing « Java by API






JTextField.TRAILING

 
import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JTextField;

public class MainClass {

  public static void main(final String args[]) {
    JFrame frame = new JFrame("Alignment Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new GridLayout(0, 1));
    JTextField textField = new JTextField("Left");
    textField.setHorizontalAlignment(JTextField.LEFT);
    frame.add(textField);
    textField = new JTextField("Center");
    textField.setHorizontalAlignment(JTextField.CENTER);
    frame.add(textField);
    textField = new JTextField("Right");
    textField.setHorizontalAlignment(JTextField.RIGHT);
    frame.add(textField);
    textField = new JTextField("Leading");
    textField.setHorizontalAlignment(JTextField.LEADING);
    frame.add(textField);
    textField = new JTextField("Trailing");
    textField.setHorizontalAlignment(JTextField.TRAILING);
    frame.add(textField);
    frame.pack();
    frame.setSize(250, (int) frame.getSize().getHeight());
    frame.setVisible(true);

  }
}

           
         
  








Related examples in the same category

1.JTextField.LEFT
2.JTextField.LEADING
3.new JTextField(String text)
4.new JTextField(String text, int columns)
5.JTextField: addActionListener(ActionListener s)
6.JTextField: addFocusListener(FocusListener l)
7.JTextField: addKeyListener(KeyListener l)
8.JTextField: copy()
9.JTextField: cut()
10.JTextField: getActions()
11.JTextField: getCaretPosition()
12.JTextField: getDocument()
13.JTextField: getHorizontalVisibility()
14.JTextField: getHorizontalVisibility() (2)
15.JTextField: getInputMap()
16.JTextField: getKeymap()
17.JTextField: getScrollOffset()
18.JTextField: paste()
19.JTextField: registerKeyboardAction(ActionListener anAction,String aCommand,KeyStroke aKeyStroke,int aCondition)
20.JTextField: requestFocus()
21.JTextField: modelToView(int pos)
22.JTextField: read(Reader in, Object desc)
23.JTextField: setDocument(Document doc)
24.JTextField: setFocusAccelerator(char aKey)
25.JTextField: setHorizontalAlignment(int alignment)
26.JTextField: setInputVerifier(InputVerifier input)
27.JTextField: setPreferredSize(Dimension preferredSize)
28.JTextField: setNavigationFilter(NavigationFilter filter)
29.JTextField: setTransferHandler(TransferHandler newHandler)
30.JTextField: write(Writer out)