资源简介
与windows记事本类似功能的Java记事本,附带实验报告以及代码等详细信息。
代码片段和文件信息
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
public class MyText {
public static void main(String[] args) {
new FWindow(“未命名文档“);
}
}
class FWindow extends Jframe implements ActionListenerItemListener{
JMenuBar menub;
JPanel panelpanel0;
JMenu mFilemEditemFamatmHelpmView;
JMenuItem itOpenitNewitSaveitOSaveitEnditCopyitCopy0itCutitCut0itPasteitPaste0itSAllitClsitHelpitFontitFColoritBColoritHuanhitToolsitFamats;
JTextArea text;
JTextField t;
JScrollPane Jpane;
JComboBox listFontlistFSize;
FWindow(String s){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent arg0) {
endF();
}
});
settitle(s);
this.setDefaultCloseOperation(Jframe.DO_NOTHING_ON_CLOSE);
setSize(800600);
setVisible(true);
/*字体字号设置1*/
GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
String fontName[]=ge.getAvailableFontFamilyNames();
listFont=new JComboBox(fontName);
listFSize=new JComboBox();
listFont.setSelectedIndex(135);
for (int i=1;i<=72;i++)
listFSize.addItem(i);
listFSize.setPreferredSize(new Dimension(8030));
listFSize.setSelectedIndex(11);
FlowLayout flow =new FlowLayout();
FlowLayout flow2 =new FlowLayout();
panel=new JPanel();
panel0=new JPanel();
panel.setLayout(flow);
flow.setAlignment(FlowLayout.LEFT);
panel0.setLayout(flow2);
flow2.setAlignment(FlowLayout.LEFT);
JButton newBopenBsaveBcopyBcutBpasteBfontBcolorBqingxieBjiacuBlockBunlockB;
newB=new JButton(new ImageIcon(“tb2/NEW.GIF“));
openB=new JButton(new ImageIcon(“tb2/OPEN.GIF“));
saveB=new JButton(new ImageIcon(“tb2/SAVE.GIF“));
copyB=new JButton(new ImageIcon(“tb2/COPY.GIF“));
cutB=new JButton(new ImageIcon(“tb2/CUT.GIF“));
pasteB=new JButton(new ImageIcon(“tb2/PASTE.GIF“));
fontB=new JButton(new ImageIcon(“tb2/font.gif“));
colorB=new JButton(new ImageIcon(“tb2/color.gif“));
jiacuB=new JButton(new ImageIcon(“tb2/jiacu.gif“));
qingxieB=new JButton(new ImageIcon(“tb2/qingxie.gif“));
lockB=new JButton(new ImageIcon(“tb/lock2.gif“));
unlockB=new JButton(new ImageIcon(“tb/lock.gif“));
newB.setPreferredSize(new Dimension(2423));
openB.setPreferredSize(new Dimension(2423));
saveB.setPreferredSize(new Dimension(2423));
copyB.setPreferredSize(new Dimension(2423));
cutB.setPreferredSize(new Dimension(2423));
pasteB.setPreferredSize(new Dimension(2423));
fontB.setPreferredSize(new Dimension(2423));
colorB.setPreferredSize(new Dimension(2423));
jiacuB.setPreferredSize(new Dimension(2423));
qingxieB.setPreferredSize(new Dimension(2423));
lockB.setPreferredSize(new Dimension(2423));
unlockB.setPreferredSize(new Dimension(2423));
t=new JTextField(15);
t.setHorizontalAlignment(JTextField.LEFT);
t.setEditable(false);
panel.add(newB);
pa
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 232 2008-12-30 17:57 MyText\.classpath
....... 382 2008-12-30 17:57 MyText\.project
....... 823 2008-12-30 17:57 MyText\bin\fontText$1.class
....... 823 2008-12-30 17:57 MyText\bin\fontText$2.class
....... 650 2008-12-30 17:57 MyText\bin\fontText$3.class
....... 650 2008-12-30 17:57 MyText\bin\fontText$4.class
....... 650 2008-12-30 17:57 MyText\bin\fontText$5.class
....... 7527 2008-12-30 17:57 MyText\bin\fontText.class
....... 608 2008-12-30 17:57 MyText\bin\FWindow$1.class
....... 636 2008-12-30 17:57 MyText\bin\FWindow$10.class
....... 637 2008-12-30 17:57 MyText\bin\FWindow$11.class
....... 635 2008-12-30 17:57 MyText\bin\FWindow$12.class
....... 634 2008-12-30 17:57 MyText\bin\FWindow$13.class
....... 634 2008-12-30 17:57 MyText\bin\FWindow$14.class
....... 594 2008-12-30 17:57 MyText\bin\FWindow$2.class
....... 909 2008-12-30 17:57 MyText\bin\FWindow$3.class
....... 632 2008-12-30 17:57 MyText\bin\FWindow$4.class
....... 632 2008-12-30 17:57 MyText\bin\FWindow$5.class
....... 632 2008-12-30 17:57 MyText\bin\FWindow$6.class
....... 705 2008-12-30 17:57 MyText\bin\FWindow$7.class
....... 704 2008-12-30 17:57 MyText\bin\FWindow$8.class
....... 706 2008-12-30 17:57 MyText\bin\FWindow$9.class
....... 15315 2008-12-30 17:57 MyText\bin\FWindow.class
....... 441 2008-12-30 17:57 MyText\bin\MyText.class
文件 6844 2009-12-30 12:02 MyText\src\fontText.class
文件 481 2009-12-30 12:02 MyText\src\FWindow$1.class
文件 511 2009-12-30 12:02 MyText\src\FWindow$10.class
文件 512 2009-12-30 12:02 MyText\src\FWindow$11.class
文件 510 2009-12-30 12:02 MyText\src\FWindow$12.class
文件 509 2009-12-30 12:02 MyText\src\FWindow$13.class
............此处省略80个文件信息
评论
共有 条评论