用Java编写的记事本程序 - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-20
////// GraphicsEnvironment gl=GraphicsEnvironment.getLocalGraphicsEnvironment(); String fontName[]=gl.getAvailableFontFamilyNames(); // int fontX[]={Font.BOLD,Font.ITALIC,Font.PLAIN}; for(int i=0;i<fontName.length;i++){ list1.add(fontName[i]); } String fontx[]={"常规","斜体","粗体","粗斜体"}; for(int i=0;i<fontx.length;i++){ list2.add(fontx[i]); } list1.select(0); list2.select(0); /////////////////////////////////////////////// this.getContentPane().setLayout(flowLayout1); this.getContentPane().add(txtStr,flowLayout1); this.getContentPane().add(list1,flowLayout1); this.getContentPane().add(this.txt2,flowLayout1); this.getContentPane().add(this.list2,flowLayout1); this.getContentPane().add(btnOk,flowLayout1); this.getContentPane().add(btnNo,flowLayout1); } FontSet(){ this(null,"",false); } void btnOk_actionPerformed(ActionEvent e){ this.flag=true; this.font1=this.list1.getSelectedItem(); this.type=this.list2.getSelectedIndex(); this.dispose(); } void btnNo_actionPerformed(ActionEvent e){ this.flag=false; this.dispose(); } public String font1(){ return this.font1; } public int font2(){ return this.type; } } class btnOk_actionAdapter implements java.awt.event.ActionListener{ FontSet adaptee; btnOk_actionAdapter(FontSet adaptee){ this.adaptee=adaptee; } public void actionPerformed(ActionEvent e){ adaptee.btnOk_actionPerformed(e); } } class btnNo_actionAdapter implements java.awt.event.ActionListener{ FontSet adaptee; btnNo_actionAdapter(FontSet adaptee){ this.adaptee=adaptee; } public void actionPerformed(ActionEvent e){ adaptee.btnNo_actionPerformed(e); } } /************************************************************** *------------------------------------------------------------- * ReplaceDlg.java * jeason * 04-12-23 *------------------------------------------------------------- **************************************************************/ package jeason; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ReplaceDlg extends JDialog{ private String findStr="",replaceStr=""; /////////////////////////////////////// JLabel txt1=new JLabel("查找:"); JLabel txt2=new JLabel("替换为:"); JTextField txtFind=new JTextField(" "); JTextField txtReplace=new JTextField(" "); JButton btn=new JButton("替换"); FlowLayout flowLayout1=new FlowLayout(); ReplaceDlg(Frame frame,String title,boolean modal){ super(frame,title,modal); this.setTitle("替换为"); this.setSize(200,90); this.setModal(true); txt1.setSize(40,60); txt2.setSize(40,60); txtFind.setSize(50,60); txtReplace.setSize(50,60); btn.setSize(200,20); btn.addActionListener(new btn_actionAdapter(this)); this.getContentPane().setLayout(flowLayout1); this.getContentPane().add(txt1,flowLayout1); this.getContentPane().add(this.txtFind,flowLayout1); this.getContentPane().add(this.txt2,flowLayout1); this.getContentPane().add(this.txtReplace,flowLayout1); |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于用Java编写的记事本程序 - 编程入门网的所有评论