Reputation: 87
Here is my code:
try{
Font font1=new Font("SansSerif",Font.ITALIC,20);
JTextField levi=new JTextField(20);
levi.setBounds(107,10,246,100);
levi.setForeground(Color.black);
levi.setHorizontalAlignment(SwingConstants.BOTTOM);
levi.setFont(font1);
levi.setBorder(nue);
lin.add(levi);
} catch(Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}
When I run the program i got this exception
Upvotes: 2
Views: 2877
Reputation: 1106
If you check the javadocs for JTextField
, the only valid keys for the setHorizontalAlignment()
method are:
JTextField.LEFT JTextField.CENTER JTextField.RIGHT JTextField.LEADING JTextField.TRAILING
Passing in SwingConstants.BOTTOM
will throw an exception.
Upvotes: 2