{
String temp=jtf.getText();
int s=value.indexOf(temp,start);
if(value.indexOf(temp,start)!=-1)
{
jta.setSelectionStart(s);
jta.setSelectionEnd(s+temp.length());
jta.setSelectedTextColor(Color.GREEN);
start=s+1;
jb.setText("下一个");
//value=https://www.04ip.com/post/value.substring(s+temp.length());//不能截取字串
}
else
{
JOptionPane.showMessageDialog(jf, "查找完毕!", "提示", 0, ic);
jf.dispose();
}
}
else if("替换为".equals(comm))
{
String temp=jtf.getText();
int s=value.indexOf(temp,start);
if(value.indexOf(temp,start)!=-1)
{
jta.setSelectionStart(s);
jta.setSelectionEnd(s+temp.length());
jta.setSelectedTextColor(Color.GREEN);
start=s+1;
jta.replaceSelection(jt.getText());
}
else
{
JOptionPane.showMessageDialog(jf, "查找完毕!", "提示", 0, ic);
jf.dispose();
}
}
else if("全部替换".equals(comm))
{
String temp=jta.getText();
temp=temp.replaceAll(jtf.getText(), jt.getText());
jta.setText(temp);
}
}
public String read()
{
String temp="";
try
{
FileInputStream fis = new FileInputStream(f.getAbsolutePath());
byte[] b=new byte[1024];
while(true)
{
int num=fis.read(b);
if(num==-1)
break;
temp=temp+new String(b,0,num);
}
fis.close();
}
catch (Exception e1)
{
e1.printStackTrace();
}
return temp;
}
public void write()
{
try
{
FileOutputStream fos=new FileOutputStream(f);
fos.write(jta.getText().getBytes());
fos.close();
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void newNew()
{
frame.dispose();
new MyNotepad();
flag=true;
}
public MyNotepad()
{
JMenuBar jmb=new JMenuBar();
String[] menuLab={"文件","编辑","帮助"};
String[][] menuItemLab={{"新建","打开","保存","另存","退出"},
{"撤销","剪切","复制","粘贴","删除","全选","查找","替换"},
{"版本"}};
for(int i=0;imenuLab.length;i++)
{
JMenu menu=new JMenu(menuLab[i]);
jmb.add(menu);
for(int j=0;jmenuItemLab[i].length;j++)
{
JMenuItem jmi=new JMenuItem(menuItemLab[i][j]);
menu.add(jmi);
jmi.addActionListener(this);
}
}
frame.setJMenuBar(jmb);
jta.setLineWrap(true);//自动换行
JScrollPane jsp=new JScrollPane(jta);//滚动窗口面板
frame.add(jsp);
jb.addActionListener(this);
jbt.addActionListener(this);
jba.addActionListener(this);
frame.setLocation(200,50);
frame.setSize(620,660);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args)
{
new MyNotepad();
}
}
Java程序设计电子英汉词典,帮忙根据我的程序写一个frame主类程序,在线等 , 急?。。?/h2>Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("pop3");
store.connect(host, username, password);
Folder folder = store.getFolder("INBOX");
folder.open(Folder.READ_ONLY);
FetchProfile profile = new FetchProfile();
profile.add(UIDFolder.FetchProfileItem.UID);
profile.add(FetchProfile.Item.ENVELOPE);
if (folder instanceof POP3Folder) {
POP3Folder inbox = (POP3Folder) folder;
Message message[] = inbox.getMessages();
System.out.println("Messages's length: " + message.length);
for (int i = 0; imessage.length; i++) {
MimeMessage mimeMessage = (MimeMessage) message[i];
推荐阅读
- excel如何排序数字,怎样排序excel表中的数字
- sap系统导入生产订单,sap生产订单入库
- 能玩的网络游戏下载安装,能玩的游戏大全
- 外国照片视频直播软件,外国照片视频直播软件有哪些
- vb.net中hex的简单介绍
- chatgpt对体制内工作帮助,体制内工作的优缺点
- 手机传奇单机游戏,手机传奇单机游戏排行榜
- go语言重构java项目 go语言struct
- 拍摄电视时瘴气是什么,拍电视放烟的作用