Results 1 to 7 of 7
- 12-22-2008, 04:14 AM #1
Member
- Join Date
- Jun 2008
- Posts
- 13
- Rep Power
- 0
-
Sure, I'll help you if I can, but you'll need to post the code you have first. Best of luck.
Last edited by Fubarable; 12-22-2008 at 04:35 AM.
- 12-22-2008, 04:35 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 25
Lol this is not a code bank, this is a forum where discussions take place. You must put an effort first of all. If you stuck on something post your full details question here.
HINT: Read about Undo Manager.
- 12-22-2008, 11:58 AM #4
Member
- Join Date
- Jun 2008
- Posts
- 13
- Rep Power
- 0
well, i have used the undo manager to do it, but i need to build it from internal i.e. using Stack for example..
Java Code:import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import javax.swing.undo.*; import javax.swing.text.*; import javax.swing.event.*; public class UndoOp extends JFrame { private JTextPane t1; private UndoManager undo; public UndoOp() { super("Undo Operation"); t1 = new JTextPane(); undo = new UndoManager(); Document doc = t1.getDocument(); JPanel p1 = new JPanel(); JPanel p2 = new JPanel(); JButton b1 = new JButton("Undo"); p1.setLayout(new GridLayout(1,1)); p1.add(new JScrollPane(t1)); p2.add(b1); this.getContentPane().add(p1, BorderLayout.CENTER); this.getContentPane().add(p2, BorderLayout.SOUTH); setSize(300, 200); show(); doc.addUndoableEditListener(new UndoableEditListener() { public void undoableEditHappened(UndoableEditEvent evt) { undo.addEdit(evt.getEdit()); } }); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent h) { try { if (undo.canUndo()) { undo.undo(); } } catch (CannotUndoException e) { } } }); } public static void main( String args[] ) { UndoOp app = new UndoOp(); app.addWindowListener( new WindowAdapter() { } ); } }
- 04-19-2009, 05:51 PM #5
Member
- Join Date
- Apr 2009
- Posts
- 1
- Rep Power
- 0
Need help... Need a text editor code
Hello enyone.
Im new in Java. I have to create a simply text editor in java with these menu bar:
File:
Edit:
Cut, Copy, Paste
Foramt:
Font -> Times new Roman, Arial, Tahoma, Courier
Size -> 12pt, 14pt, 16pt
Bold
Italic
Colour -> Red, Blue, Black
The file that savet by these text editor need to save to .txt
Plese hellp me.
Thnx.
-
what in particular do you need help with?
- 04-20-2009, 02:46 AM #7
einer08, please do not hijack someone's thread.
USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
Similar Threads
-
Drag out text editor pane
By p4ndaman in forum EclipseReplies: 3Last Post: 07-21-2008, 05:19 PM -
SWT Text Editor Demo
By Java Tip in forum SWT TipsReplies: 0Last Post: 07-11-2008, 05:35 PM -
SWT Text Editor
By Java Tip in forum SWT TipsReplies: 0Last Post: 07-07-2008, 05:43 PM -
how to post a long text in an editor
By bachtoutou in forum New To JavaReplies: 3Last Post: 06-06-2008, 03:00 AM -
Problem in Text Editor
By mustahsan4u in forum New To JavaReplies: 2Last Post: 03-26-2008, 03:34 PM
Bookmarks