• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WYSIWYG Editors in java

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
is there a simple way to write a WYSIWYG (What u see is what u get editor)
using java swings .... i tried wit JTextPane ..editor pane ..but no luck
does any one have the code for it ... or a logic as to how to embed styles so that the text gets formatted as we type ..
thanks a lot
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Yes, can be done. You need to use JTextPane and then most probably create your own DefaultStyledDocument object that the Pane uses. The trick is to subclass these classes and provide your own custom behaviour and styles where necessary.

Its a bit of a hard slog to get up to speed on it all, but you have to know all about the insertString and remove methods in the Document object to be able to do anything useful.

I suggest that you set aside a couple of hours and go through Suns Text componant tutorial and run the webstart apps to get a feel for what is possible. Use this link:

http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html

Cheers, Jared.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can begin with JRichTextEditor and develop further.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hans, welcome to JavaRanch!

I have to say, you're optimistic that an answer will still be relevant 8 years after the fact
 
Hans Oesterholt
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is another way
Look at the window builder add on for eclipse it gives very good wysiwyg editor.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic