热门

最新

红包

立Flag

投票

同城

我的

发布
weixin_46214592
weixin_46214592
6 年前
trueweixin_46214592

请问这是怎么回事呀 JPanel p =new JPanel(); p.add(lb); p.add(jtf); p.add(b1); p.add(b2); p.add(jta); add(p); setSize(600,500); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); setLocationRelativeTo(null); } public static void main(String[] args) { Test2019043231 tt =new Test2019043231(); }}class QueryListener implements ActionListener{ public void actionPerformed(ActionEvent ae){ String id =jtf.getText(); String line =""; boolean find = false; try { Scanner sc = new Scanner(new File("data1.txt")); while (sc.hasNextLine()){ line = sc.nextLine(); if (line.indexOf(id)>=0) {find =true;break;} }if(find) jta.setText(line);else JOptionPane.showMessageDialog(null,"查无此人");}catch (Exception ex){} } } } class CloseListener implements ActionListener{ public void actionPerformed(ActionEvent ae){System.exit(0);} }

CSDN App 扫码分享
分享
评论
5
打赏
  • 复制链接
  • 举报
下一条:
万字长文在这里看看 同花顺笔面试考啥
立即登录