帮忙修改JTextField 的高度
刚学习swing,做了个界面,很难看,不知道如何修改JTextField的高度,请谁帮我改改
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.event.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JPanel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.DefaultListModel;
public class weather extends JFrame {
private String[] entries={"苹果","香蕉","橘子","核桃"} ;
private JTextField country;
private JList jl;
private JTextField latitude;
private JTextField currentTime;
private JTextField wind;
private JTextField visibilityField;
private JTextField skycondition;
private JTextField dewpoint;
private JTextField relativehumidity;
private JTextField presure;
private JButton search;
private DefaultListModel listModel;
private JPanel p1,p2;
public weather() {
setUpUIComponent();
setUpEventListener();
setTitle("Weather Report ");
setSize(640, 580);
setResizable(false);
setVisible(true);
}
private void setUpUIComponent(){
p1 = new JPanel();
p2 = new JPanel();
country=new JTextField(10);
latitude=new JTextField(12);
currentTime=new JTextField(12);
wind=new JTextField(12);
visibilityField=new JTextField(12);
skycondition=new JTextField(12);
dewpoint=new JTextField(12);
relativehumidity=new JTextField(12);
presure=new JTextField(12);
search=new JButton("SEARCH");
listModel = new DefaultListModel();
jl = new JList(listModel);
// jl=new JList(entries);
JScrollPane jsp=new JScrollPane(jl);
jl.setVisibleRowCount(8);
jsp.setBounds(20,20,80,120);
p1.add(country);
p1.add(search);
p1.add(jsp);
p2.add(new JLabel("latitude"));
p2.add(latitude);
p2.add(new JLabel("time"));
p2.add(currentTime);
p2.add(new JLabel("wind"));
p2.add(wind);
p2.add(new JLabel("visibility"));
p2.add(visibilityField);
p2.add(new JLabel("skycondition"));
p2.add(skycondition);
p2.add(new JLabel("dewpoint"));
p2.add(dewpoint);
p2.add(new JLabel("relativehumidity"));
p2.add(relativehumidity);
p2.add(new JLabel("presure"));
p2.add(presure);
this.getContentPane().setLayout(new FlowLayout());
this.setLayout(new GridLayout(1,2));
p2.setLayout(new GridLayout(8, 2));
this.add(p1);
this.add(p2);
}