java电子词典笔记代码 java英汉互译电子词典完整版含数据库( 四 )


{
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];

推荐阅读