📄 viewdlg.java
字号:
/*
// header - edit "Data/yourJavaHeader" to customize
// contents - edit "EventHandlers/Java file/onCreate" to customize
//
*/
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;
import java.util.zip.*;
public class ViewDlg extends JFrame
{
JTextArea ta = new JTextArea();
JScrollPane sp = new JScrollPane(ta);
JPanel p1 = new JPanel();
JButton bclose = new JButton("Close");
ViewDlg()
{
Container content = getContentPane();
p1.add(bclose);
content.add(p1,"South");
content.add(sp);
ta.setWrapStyleWord(true);
ta.setEditable(false);
setSize(200,300);
bclose.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
ta.setText("");
ViewDlg.this.setVisible(false);
}
}
);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
ta.setText("");
ViewDlg.this.setVisible(false);
}
}
);
}
public void viewText(String zipname,String entryname)
{
this.show();
setTitle(entryname);
try
{
ZipInputStream zin = new ZipInputStream(new FileInputStream(zipname));
BufferedReader br = new BufferedReader(new InputStreamReader(zin));
ZipEntry entry;
while((entry=zin.getNextEntry())!=null)
{
if(entryname.equals(entry.getName()))
{
String s;
while((s=br.readLine())!=null)
ta.append(s+"\n");
}
}
}
catch(IOException e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -