内容发布更新时间 : 2024/12/23 16:25:16星期一 下面是文章的全部内容请认真阅读。
int Red=0,Green=0,Blue=0;
Label lFind = new Label(\查找字符串:\ Label lReplace = new Label(\替换字符串:\ TextField tFind = new TextField(10); TextField tReplace = new TextField(10); Button bFind = new Button(\查找\ Button bReplace = new Button(\替换\ Button bReplaceAll=new Button(\替换所有\ Dialog dialog; Dialog findD;
public MyTextPad(String str) {
super(str);
text=new JTextArea();
text.setFont(new Font(\宋体\ jsp=new JScrollPane(text); add(\
findD=new Dialog(this);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
6
dispose(); } } );
d=new Dialog(this,\字体选择\ d.setBounds(150,150,320,200);
findD.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
findD.setVisible(false); } }
);
d.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
d.setVisible(false); } }
);
7
c1=new Choice();c2=new Choice();c3=new Choice(); GraphicsEnvironment
ge=GraphicsEnvironment.getLocalGraphicsEnvironment(); String fontName[]=ge.getAvailableFontFamilyNames(); for(int i=0;i c1.add(fontName[i]); } c2.add(\粗体\ c2.add(\斜体\ c2.add(\粗体与斜体\ c2.add(\普通\ for(int i=8;i<100;i++) { c3.add(\ } Panel p1=new Panel(); Panel p2=new Panel(); p1.add(c1); p1.add(c2); p1.add(c3); btn1=new Button(\确定\ 8 btn2=new Button(\取消\ d.setLayout(new GridLayout(5,3)); d.add(p1); p2.add(btn1); btn1.addActionListener(this); btn2.addActionListener(this); p2.add(btn2); d.add(p2); About=new Dialog(this,\关于\ About.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { About.setVisible(false); } } ); About.setBounds(300,300,150,150); About.add(new Label(\蒋俊涛的计事体1.0版本\ Menu mn=new Menu(\文件\ MenuItem miNewFile=new MenuItem(\ 新 MenuShortcut(KeyEvent.VK_N)); 9 建 \ MenuItem miOpenFile=new MenuItem(\打开\ MenuShortcut(KeyEvent.VK_O)); MenuItem miSaveFile=new MenuItem(\ 保 存 \ MenuShortcut(KeyEvent.VK_S)); MenuItem miExit=new MenuItem(\ 退 出 \ MenuShortcut(KeyEvent.VK_E)); mn.add(miNewFile); mn.add(miOpenFile); mn.add(miSaveFile); mn.addSeparator(); mn.add(miExit); miNewFile.addActionListener(this); miOpenFile.addActionListener(this); miSaveFile.addActionListener(this); miExit.addActionListener(this); Menu mn1=new Menu(\编辑\ MenuItem miSelectAll=new MenuItem(\ MenuShortcut(KeyEvent.VK_P)); MenuItem miClear=new MenuItem(\ MenuShortcut(KeyEvent.VK_S)); MenuItem miCopy=new MenuItem(\ MenuShortcut(KeyEvent.VK_C)); 10 全 选 清 空 复 制 \ \ \