I am new to JFrame, components and the such, but I'm trying to change a size of a specific text field so you can actually see what you put into it. Here's the code:
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class InterestCalculator extends JFrame{
private static final long serialVersionUID = 1L;
JLabel desc = new JLabel("This is a simple interest calculator.\n"
+ " Enter three fields to get the fourth.");
JLabel inteLabel = new JLabel("\nInterest: ");
JTextField inte = new JTextField();
public static void main(String [] args) {
InterestCalculator comp = new InterestCalculator();
comp.FrameHandler();
}
public void FrameHandler() {
setSize(500, 500);
setTitle("Template");
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setLayout(new FlowLayout());
add(desc);
add(inteLabel);
add(inte);
inte.setSize(new Dimension(100,15));
validate();
}
}
This is what comes out: https://i.stack.imgur.com/ldwed.png So, how can I fix this?