java 记事本本源代码.

 
  1. //search.java
  2. package abc.jdm;
  3. import java.awt.*;
  4. import abc.jdm.*;
  5. import java.awt.event.*;
  6. import javax.swing.*;
  7. import javax.swing.border.Border;
  8. public class search{
  9.     JLabel searchlabel=new JLabel("查找(S)"),replace=new JLabel("替换(R)");
  10.     JButton okbutton=new JButton("确定"),cancelbutton=new JButton("取消");
  11.     JTextField oldstring=new JTextField(10),newstring=new JTextField(10);
  12.     public search(){
  13.         JFrame f=new JFrame("查找与替换");
  14.         searchlabel.setSize(20,20);
  15.         f.setLayout(new GridLayout(3,2));
  16.         f.add(searchlabel);
  17.         okbutton.setSize(1010);
  18.         //okbutton.setLocation(60, 10);
  19.         f.add(oldstring);
  20.         f.add(replace);
  21.         f.add(newstring);
  22.         f.add(okbutton);
  23.         okbutton.addActionListener(new replace());
  24.         f.add(cancelbutton);
  25.         f.setSize(250100);
  26.         f.setLocation(1010);
  27.         f.setVisible(true);
  28.         f.setResizable(false);
  29.         
  30.         //JFramesetResizable(false)方法可以禁用缩放,
  31.         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  32.         cancelbutton.addActionListener(new cancelbutton());
  33.         
  34.         
  35.     }
  36.     
  37. }
  38. class cancelbutton implements ActionListener{
  39.     public void actionPerformed(ActionEvent e){
  40.         System.exit(0);
  41.         
  42.     }
  43. }
  44. class replace implements ActionListener{
  45.     public void actionPerformed(ActionEvent e){
  46.         /*String oldstr=oldstring.getText();
  47.         String newstr=newstring.getText();
  48.         int result=(mytext.getText().indexOf(oldstr));
  49.         if(result!=0){
  50.             
  51.         }*/
  52.     }
  53. }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值