import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
/***
* 2011-AUG-24
* @author houwen
*
*/
public class View {
private int row ;
private int rows;
private int pages;
private JFrame window = new JFrame("@DB:192.168.0.20:tarena:sd0704_TomLin records");
private JTextArea output = new JTextArea(20,50);
private JScrollPane jsp = new JScrollPane(output);
private JTextField jpage = new JTextField(2);
private JLabel jl1 = new JLabel("第");
private JLabel jl2 = new JLabel("页");
private JButton jb1 = new JButton("goto");
private JButton jb2 = new JButton("选择每页显示行数");
private JButton jb3 = new JButton("上一页");
private JButton jb4 = new JButton("下一页");
private JButton jb5 = new JButton("退出");
private JPanel jp1 = new JPanel(new FlowLayout());
private JPanel jp2 = new JPanel(new FlowLayout());
private JPanel jp3 = new JPanel(new FlowLayout());
class ActionLis implements ActionListener{
public void actionPerformed(ActionEvent e) {
if(e.getSource()==jb1){
int page = Integer.parseInt(jpage.getText());
}else if(e.getSource()==jb2){
int row = Integer.parseInt(
JOptionPane.showInputDialog(window, "请输入行数:"));
}else if(e.getSource()==jb3){
pages--;
}else if(e.getSource()==jb4){
output.setText(pages+++"");
}else if(e.getSource()==jb5){
System.exit(0);
}
}
}
public View(){
window.setLayout(new FlowLayout());
jp1.add(jsp);
jp2.add(jb2);
jp2.add(jl1);
jp2.add(jpage);
jp2.add(jl2);
jp2.add(jb1);
jp3.add(jb3);
jp3.add(jb4);
jp3.add(jb5);
ActionLis listener = new ActionLis();
jb1.addActionListener(listener);
jb2.addActionListener(listener);
jb3.addActionListener(listener);
jb4.addActionListener(listener);
jb5.addActionListener(listener);
window.add(jp1);
window.add(jp2);
window.add(jp3);
window.setSize(600,500);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);
}
public static void main(String[] args){
new View();
}
}