100分求java编写的记事本源码 我也要一份,[email protected],先谢了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我也要一份,[email protected],先谢了! 给我发一份好吗!谢谢啦[email protected] wo yao [email protected] 能不能给我也发一份呀?ThankYou!!![email protected] 神经病啊,jdk的demo里不就有一个吗? 是的,本身JDK中就有这个例子,jb中也有,大家找一下了 我要的是象windows一样的Notpadjxhty(nifeng) 加分后继不是不加 java中文站就有呀,為什么不去下載 import javax.swing.*;import java.awt.*;import java.awt.event.*;public class TestTab{ public void init() { JFrame f=new JFrame("kevin"); final JTextArea c=new JTextArea("kevin"); JMenuBar mb=new JMenuBar(); JMenu m1=new JMenu("文件"); JMenu m2=new JMenu("编辑"); JMenuItem m2copy=new JMenuItem("复制"); m2copy.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { c.copy(); }}); JMenuItem m2cut=new JMenuItem("剪切"); m2cut.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { c.cut(); }}); JMenuItem m2paste=new JMenuItem("粘贴"); m2paste.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { c.paste(); }}); JMenu m3=new JMenu("搜索"); JMenu m4=new JMenu("视图"); JMenu m5=new JMenu("工程"); JMenu m6=new JMenu("工具"); JMenu m7=new JMenu("设置"); JMenu m8=new JMenu("窗口"); JMenu m9=new JMenu("帮助"); ImageIcon n=new ImageIcon("PP03.jpg"); ImageIcon o=new ImageIcon("Osx16.jpg"); JMenuItem mi1=new JMenuItem("新建",n); mi1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { c.setText(""); }}); JMenuItem mi2=new JMenuItem("打开",o); JMenuItem popm1=new JMenuItem("copy"); JMenuItem popm2=new JMenuItem("cut"); m1.add(mi1); m1.add(mi2); m1.add(mi2); m2.add(m2copy); m2.add(m2cut); m2.add(m2paste); mb.add(m1); mb.add(m2); mb.add(m3); mb.add(m4); mb.add(m5); mb.add(m6); mb.add(m7); mb.add(m8); mb.add(m9); ImageIcon i=new ImageIcon("office12.jpg"); ImageIcon j=new ImageIcon("office9.jpg"); ImageIcon k=new ImageIcon("Adobe16.jpg"); ImageIcon l=new ImageIcon("AquaOS.jpg"); ImageIcon m=new ImageIcon("DVD3.jpg"); JTree tree=new JTree(); JScrollPane js2=new JScrollPane(tree,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JScrollPane js=new JScrollPane(c,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JButton d=new JButton("kevin3"); JButton e=new JButton("kevin4"); JButton f1=new JButton(i); f1.setToolTipText("复制"); f1.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { c.copy(); }}); JButton f2=new JButton(j); f2.setToolTipText("剪切"); f2.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { c.cut(); }}); JButton f3=new JButton(k); f3.setToolTipText("粘贴"); f3.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { c.paste(); }}); JButton f4=new JButton(l); JButton f5=new JButton(m); JTabbedPane t=new JTabbedPane(); JToolBar jt=new JToolBar(); jt.add(f1); jt.add(f2); jt.add(f3); jt.add(f4); jt.add(f5); jt.setBackground(Color.ORANGE); t.addTab("文件目录",js2); t.addTab("文本编辑器",js); t.addTab("microsoft",d); t.addTab("kevinsoft",e); t.setBackground(Color.LIGHT_GRAY); f.getContentPane().add("Center",t); f.getContentPane().add("North",jt); f.setJMenuBar(mb); f.setSize(500,350); f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { System.exit(0); }}); f.setVisible(true); } public static void main(String [] args) { TestTab tab=new TestTab(); tab.init(); }}我刚写的好多功能都没有实现,不过,基本的复制,粘贴等功能有 JBuilder自带的DEMO有,你看一下子。。 import java.awt.*;import javax.swing.*;import java.awt.event.*;import javax.swing.border.*;import java.io.*;public class VerySimpleEditor2 extends JFrame{ JPanel topPanel; JPanel editorPanel; JScrollPane scroller; JTextArea editor; JMenuBar menuBar; JMenu fileMenu; JMenu editMenu; JMenuItem fileMenuLoad; JMenuItem fileMenuSave; JMenuItem fileMenuExit; JMenuItem editMenuCut; JMenuItem editMenuCopy; JMenuItem editMenuPaste; public VerySimpleEditor2() { topPanel=new JPanel(); topPanel.setLayout(new BorderLayout()); editorPanel= new JPanel(); editorPanel.setLayout(new BorderLayout()); editorPanel.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); scroller=new JScrollPane(); editor=new JTextArea(); editor.setColumns(40); this.setTitle("Very simple editor 2"); this.getContentPane().add(topPanel,BorderLayout.CENTER); this.addWindowListener(new java.awt.event.WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); topPanel.add(editorPanel,BorderLayout.CENTER); editorPanel.add(scroller,BorderLayout.CENTER); scroller.getViewport().add(editor); menuBar=new JMenuBar(); setJMenuBar(menuBar); addFileMenu(); addEditMenu(); pack(); setSize(400,300); setVisible(true); } private void addFileMenu(){ fileMenu= new JMenu("File"); fileMenuLoad= new JMenuItem("Load..."); fileMenuLoad.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ loadFile(); } }); fileMenu.add(fileMenuLoad); fileMenuSave=new JMenuItem("Save..."); fileMenuSave.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ saveFile(); } }); fileMenu.add(fileMenuSave); fileMenu.addSeparator(); fileMenuExit=new JMenuItem("Exit"); fileMenuExit.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ System.exit(0); } }); fileMenu.add(fileMenuExit); menuBar.add(fileMenu); } private void addEditMenu(){ editMenu= new JMenu("Edit"); editMenuCut= new JMenuItem("Cut"); editMenuCut.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ cut(); } }); editMenu.add(editMenuCut); editMenuCopy=new JMenuItem("Copy"); editMenuCopy.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ copy(); } }); editMenu.add(editMenuCopy); editMenuPaste=new JMenuItem("Paste"); editMenuPaste.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ paste(); } }); editMenu.add(editMenuPaste); menuBar.add(editMenu); } private void loadFile(){ JFileChooser fc = new JFileChooser(); int returnVal =fc.showOpenDialog(this); if(returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); try{ editor.read(new FileReader(file),null); } catch(IOException exp) {} } } private void saveFile(){ JFileChooser fc = new JFileChooser(); int returnVal =fc.showSaveDialog(this); if(returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); try{ editor.write(new FileWriter(file)); } catch(IOException exp) {} } } private void copy(){ editor.copy(); editor.requestFocus(); } private void paste(){ editor.paste(); editor.requestFocus(); } private void cut(){ editor.cut(); editor.requestFocus(); } public static void main (final String[] args){ final VerySimpleEditor2 editor= new VerySimpleEditor2(); } } 保存问题:执行更新语句失败(lis6.0) 关于子类继承父类时转型和静态变量引用的问题 请教一段代码的小问题 求助java-cgi-xml java编程思想 里的回调函数 不知怎么也找不到了。。 急!急!急!急!请高手指点,如何将二维表导入到jcombobox中?? 有一段代码看不懂,请大家帮忙看一看.(初学者) 请问哪里有可以接收HTTP格式数据请求的JAVA组件下载 简单的tomcat 问题?请教,在线等候 java swing 按钮上字在鼠标划过消失,是怎么回事。 如何在java中,而不是jsp中得到当前的工作目录? 把图片存到SQLServer里应该怎么写 拜托各位了
[email protected]
[email protected]
[email protected]
jxhty(nifeng) 加分
后继不是不加
import java.awt.*;
import java.awt.event.*;
public class TestTab
{
public void init()
{
JFrame f=new JFrame("kevin");
final JTextArea c=new JTextArea("kevin");
JMenuBar mb=new JMenuBar();
JMenu m1=new JMenu("文件");
JMenu m2=new JMenu("编辑");
JMenuItem m2copy=new JMenuItem("复制");
m2copy.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
c.copy();
}});
JMenuItem m2cut=new JMenuItem("剪切");
m2cut.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
c.cut();
}});
JMenuItem m2paste=new JMenuItem("粘贴");
m2paste.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
c.paste();
}});
JMenu m3=new JMenu("搜索");
JMenu m4=new JMenu("视图");
JMenu m5=new JMenu("工程");
JMenu m6=new JMenu("工具");
JMenu m7=new JMenu("设置");
JMenu m8=new JMenu("窗口");
JMenu m9=new JMenu("帮助");
ImageIcon n=new ImageIcon("PP03.jpg");
ImageIcon o=new ImageIcon("Osx16.jpg");
JMenuItem mi1=new JMenuItem("新建",n);
mi1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
c.setText("");
}
});
JMenuItem mi2=new JMenuItem("打开",o);
JMenuItem popm1=new JMenuItem("copy");
JMenuItem popm2=new JMenuItem("cut");
m1.add(mi1);
m1.add(mi2);
m1.add(mi2);
m2.add(m2copy);
m2.add(m2cut);
m2.add(m2paste);
mb.add(m1);
mb.add(m2);
mb.add(m3);
mb.add(m4);
mb.add(m5);
mb.add(m6);
mb.add(m7);
mb.add(m8);
mb.add(m9);
ImageIcon i=new ImageIcon("office12.jpg");
ImageIcon j=new ImageIcon("office9.jpg");
ImageIcon k=new ImageIcon("Adobe16.jpg");
ImageIcon l=new ImageIcon("AquaOS.jpg");
ImageIcon m=new ImageIcon("DVD3.jpg");
JTree tree=new JTree();
JScrollPane js2=new JScrollPane(tree,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JScrollPane js=new JScrollPane(c,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
JButton d=new JButton("kevin3");
JButton e=new JButton("kevin4");
JButton f1=new JButton(i);
f1.setToolTipText("复制");
f1.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e)
{
c.copy();
}});
JButton f2=new JButton(j);
f2.setToolTipText("剪切");
f2.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e)
{
c.cut();
}});
JButton f3=new JButton(k);
f3.setToolTipText("粘贴");
f3.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e)
{
c.paste();
}});
JButton f4=new JButton(l);
JButton f5=new JButton(m);
JTabbedPane t=new JTabbedPane();
JToolBar jt=new JToolBar();
jt.add(f1);
jt.add(f2);
jt.add(f3);
jt.add(f4);
jt.add(f5);
jt.setBackground(Color.ORANGE);
t.addTab("文件目录",js2);
t.addTab("文本编辑器",js);
t.addTab("microsoft",d);
t.addTab("kevinsoft",e);
t.setBackground(Color.LIGHT_GRAY);
f.getContentPane().add("Center",t);
f.getContentPane().add("North",jt);
f.setJMenuBar(mb);
f.setSize(500,350);
f.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
System.exit(0);
}});
f.setVisible(true);
}
public static void main(String [] args)
{
TestTab tab=new TestTab();
tab.init();
}
}
我刚写的好多功能都没有实现,不过,基本的复制,粘贴等功能有
import javax.swing.*;
import java.awt.event.*;
import javax.swing.border.*;
import java.io.*;public class VerySimpleEditor2 extends JFrame{
JPanel topPanel;
JPanel editorPanel;
JScrollPane scroller;
JTextArea editor;
JMenuBar menuBar;
JMenu fileMenu;
JMenu editMenu;
JMenuItem fileMenuLoad;
JMenuItem fileMenuSave;
JMenuItem fileMenuExit;
JMenuItem editMenuCut;
JMenuItem editMenuCopy;
JMenuItem editMenuPaste;
public VerySimpleEditor2() {
topPanel=new JPanel();
topPanel.setLayout(new BorderLayout());
editorPanel= new JPanel();
editorPanel.setLayout(new BorderLayout());
editorPanel.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
scroller=new JScrollPane();
editor=new JTextArea();
editor.setColumns(40);
this.setTitle("Very simple editor 2");
this.getContentPane().add(topPanel,BorderLayout.CENTER);
this.addWindowListener(new java.awt.event.WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
topPanel.add(editorPanel,BorderLayout.CENTER);
editorPanel.add(scroller,BorderLayout.CENTER);
scroller.getViewport().add(editor);
menuBar=new JMenuBar();
setJMenuBar(menuBar);
addFileMenu();
addEditMenu();
pack();
setSize(400,300);
setVisible(true);
}
private void addFileMenu(){
fileMenu= new JMenu("File");
fileMenuLoad= new JMenuItem("Load...");
fileMenuLoad.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
loadFile();
}
});
fileMenu.add(fileMenuLoad);
fileMenuSave=new JMenuItem("Save...");
fileMenuSave.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
saveFile();
}
});
fileMenu.add(fileMenuSave);
fileMenu.addSeparator();
fileMenuExit=new JMenuItem("Exit");
fileMenuExit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
System.exit(0);
}
});
fileMenu.add(fileMenuExit);
menuBar.add(fileMenu);
}
private void addEditMenu(){
editMenu= new JMenu("Edit");
editMenuCut= new JMenuItem("Cut");
editMenuCut.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
cut();
}
});
editMenu.add(editMenuCut);
editMenuCopy=new JMenuItem("Copy");
editMenuCopy.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
copy();
}
});
editMenu.add(editMenuCopy);
editMenuPaste=new JMenuItem("Paste");
editMenuPaste.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
paste();
}
});
editMenu.add(editMenuPaste);
menuBar.add(editMenu);
}
private void loadFile(){
JFileChooser fc = new JFileChooser();
int returnVal =fc.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
try{
editor.read(new FileReader(file),null);
}
catch(IOException exp) {}
}
}
private void saveFile(){
JFileChooser fc = new JFileChooser();
int returnVal =fc.showSaveDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
try{
editor.write(new FileWriter(file));
}
catch(IOException exp) {}
}
}
private void copy(){
editor.copy();
editor.requestFocus();
}
private void paste(){
editor.paste();
editor.requestFocus();
}
private void cut(){
editor.cut();
editor.requestFocus();
}
public static void main (final String[] args){
final VerySimpleEditor2 editor= new VerySimpleEditor2();
}
}