Development of a non-conventional modal text editor: can I use "JTextPane?
Hello everyone, my name is Jason and I am a new Java programmer. Although Java isn't my first programming language, I have very little experience with GUI design and development is, so Swing is exciting and a little daunting to me.I started on my own project: a modal minimum with a GUI text editor designed to keep your hands on the keyboard. My question relates to the design of the GUI: I wonder if I should use a 'JTextPane", or roll my own component.
This will be the main features of the program:
* It will be modal, rather like vi, that it has a mode in which the text is inserted and another separate mode in which all keystrokes are interpreted as commands.
* In General, the command mode will have orders to move the caret, scrolling of the window and change the text, each more or less with respect to the following units: character, Word, sentence, paragraph, line.
* All the keystrokes of the order will be fully customizable and, by default, to comply with a provision which is great for being able to edit, but quite unconventional.
* All text will be displayed in the same police, but if I'm about to implement syntax highlighting that could change. At the very least, I want to be able to change the color of the text.
* Unlimited undo/redo.
* Capable of editing files of any size.
I went through the Java tutorial on "text components using the" (http://docs.oracle.com/javase/tutorial/uiswing/components/text.html) and got a bit familiar with the components that are available. For my program, "JTextPane" seems a good choice at first sight, but I do not know...
(1) I read that "JTextPane" s are running well with great content. (Maybe I could get around this by breaking a large file into several pieces.) I can't verify if it's true or not, but I've read that people who develop JEdit rolled their own solution to work around this problem.
(2) "s JTextPane" are not modal.
(3) it seems overall, I do a lot of customization on a 'JTextPane"so that he can accomplish as I want.
So, here are my questions:
Do you think that a "JTextPane' is a good choice? I have to learn the "JTextPane' inside and outside in order to know how"bend to my will?
Or I better off rolling my own solution, would use a "JPanel" and a "KeyListener" or something like that?
And if you think I should use a 'JTextPane", if you could kindly give me some general advice about where I could start with the customization required, would be great.
Thank you for taking the time to read this long post and thank you in advance for any help!
Published by: Jujubi on April 8, 2012 17:25
Published by: Jujubi on April 8, 2012 17:26
I would say that this is not the right choice. It is slow with large files (several megabytes). It assumes several functions (pieces of text with different font sizes) calculation is slow so you don't really.
I would choose JTextArea with view to support colored pieces. You, the calculations of sizes are really faster because you have monospaced police and all the pieces the same size of tank.
To highlight, you can use highlighter/HighlightPainters.
If you always the JTextPane is good to read the article of http://java-sl.com/JEditorPanePerformance.html on improving the performance.
JTextArea or JTextPane are modal. You can place them in a modal JDialog.
Tags: Java
Similar Questions
-
Once we pay non-recurring charges for images, can be used indefinitely images on our Web site at not-for-profit?
Yes, you can use this image for any future web and the material printed for the same client / yourself.
-
There is no text editor when you type a description of the items I sell on ebay with Firefox, but there is an editor (toolbar) using IE. Firefox fix or complements for ebay sellers?
Your string UserAgent in Firefox is marred by another program you have installed. Maybe eBay cannot know that you use Firefox 3.6.23.
http://en.Wikipedia.org/wiki/USER_AGENTtype of topic: config in the URL bar and press ENTER.
If you see the warning, you can confirm that you want to access this page.
Filter = general.useragent.
Right click the preferences that are "BOLD", a line at a time, select reset.
Then restart Firefox -
I bought a model site. It has a css file, /styles/screen.css
It also has a template page 'home' with the link to the style sheet within the < head > section:
"< link href="/styles/screen.css "rel ="stylesheet"type =" text/css"media ="screen"> < / link > I am tempted to change screen.css, by editing the file in the 'Develop' administration Console and pressing the 'Save' button on the file when changes are made.
However, the changes do not appear in the preview of the Page template.
However, if I do a < style > section in the head <>of the page template and put the change, it displays correctly.
It's like the Page template does not recognize changes to the screen.css.
I press "Save draft" and "Update" before you press 'Preview' to check for changes.
My question is how to fix the Page Template styles that do not respond to changes in CSS files in the text editor of 'Developing' administration Console.
I am a new user of BC and I agree it is likely a result of not knowing how the css BC.
Thanks in advance for any assistance with my issue!
Hello
I think that you too complicate the thinking problem that BC is a non-standard way of processing applications to a css file. This looks more like a cache or perhaps a code problem. However, I would be happy to take a look at your code and see if I can remember where is the problem. Try Skype me and screen-sharing and I'll see what I can do. It is probably fixed quickly :-) My ID:s 'noviumdesign '.
Anton
-
Keys do not work in the native text editor (field Textbox)
Hi all
I'm porting an application for one of the blackberry device, in that soft key mapping I used the api to the RIM so that I can map LSK button Menu and the RSK to return key. But in the field application TextBox is also there, when I open the native text editor (Textbox) and try to input by keyboard that none of the keys work.
Can anyone suggest a few ideas for the keys work in the native text editor.
Note: This problem only occurs when I use some RIM api.
Your method keyDown() "eat" all the key events. You should return 'false' for all the events that are not managed.
-
Update of the rich TEXT Editor
I, like many others, have it searched the internet looking for rich TEXT editor that can handle the full feature set of a RTF file. There is only one project there and is not open source, nor is there a true documentation which can explain how to use this custom Publisher RTF kit.
I ask the name of the community that Oracle develop a RFTEditorKit capable of handling the full set of features of the RTF standard. I want to be able to open a file with images in Java. I would also like to create a simple demo program to illustrate the new RTF kit.
This forum seems to have more features than the current RTFEditorKit, I think that level of those looking for this feature indicates the level of need.
Thank you and have a nice day.
Post edited by: Mike Goff RTF file, I should proof read.
Mike Goff wrote:
Hello
The requested page is; FAQ at the bottom is says «if you have any comments or questions, please visit...» "Also the page; " Help: frequently asked Questions said"I have a question that is not answered here. Y at - it email address "customer service"? Lol Please ask your question in the Discussion Forum for Feedback: Member of ... "There has been a lot of threads and messages asking this feature to deal with and if they get solved these problems don't really get resolved.
If this is not the place to report threads and messages not getting no real resolutions can you point me to the correct place?
Hmmm, I think you have misinterpreted it.
On the FAQ Page, it says:
If you have any comments or questions, please visit OTN Community Feedback (no product Questions). If you have any suggestions or ideas for the Betterment of the community, please visit Oracle community ideas.
in the context of the issues frequent threads/documents. Not any question, otherwise people might ask ' my mother to get the bus n ° 99 in town one Saturday morning.
Also on the Help: frequently asked Questions page:
I have a question that is not answered here. Y at - it email address 'customer service '?
Lol Please ask your question in the for the Feedback Discussion Board: Member, which is monitored frequently. Note that this forum is intended for comments on Oracle Technology Network services only.
And of course, the Discussion Forum of member feedback points here... but it is in the context of the questions that help with the help of the community. No specific product of the Oracle. It is not as clearly "Note this forum is intended for comments on Oracle Technology Network services only"
Your question is related to Java and Swing (so you informed me), then you would be best to ask your question in most cases space under Java (I let you decide which is best)...
The list of secondary areas are here: Java
-
Rich Text Editor - limit the characters to type in
Hello
I'm having a little trouble, and pehaps can someone help out me.
I use APEX 4.2
In the Web page that I have developed, I have a rich text editor, which is intended to be limited by words, rather than characters.
I installed a single view point, that correctly displays the amount of words being there, that the problem is that I don't know how to do to limit the amount of this words, so when they hit 50 (for example), it stops leaving the user to type more than words.
Does anyone know how can achieve this?
Thank you!
Ok.
Because nobody could hint on that, and I've tried several things until finally got a solution.
I will post the solution I did (it's not very clean, but since I have a date deadline and things always work on...):
First of all, APEX page jscript on charge:
lEditor = CKEDITOR.instances.Pxx_ITEM;
lEditor.on ('contentDom', function() {}
lEditor.document.on ("keyup", Function {}
wCountLimit (lEditor.getData ());
});
});
lEditor is a global variable of my javascript to html header.
The header:
var lEditor;
var word_count;
function wCountLimit(cData){
//Help variable to control
var lEditorHelp;
// Content of the rich text editor
var rteAnswer = cData; //lEditor.getData();
// Word counter
var wCounter = document.getElementById("PXX_WORD_COUNT_DISPLAY");
//Regular expression to strip the HTML tags from a String
var stripHTML = /<\S[^><]*>/g;
var text = rteAnswer.replace(stripHTML, '');
text = text.replace(/'/g, "");
text = text.replace(/\s| \s| +/g, " ");
var wordCount = text.match(/\b/g);
word_count = ((wordCount) ? (wordCount.length / 2) : 0);
if (word_count<=500){
wCounter.innerHTML = "Word Count: " + word_count + " of 500";
} else {
wCounter.innerHTML = "Word Count: 500 of 500";
// we need to start checking how many words does this text have and stop it when we reach the 500
for (i=cData.length;i--;i==0)
{
lEditorHelp = cData.substr(0,i);
wCountInf(lEditorHelp);
if (word_count == 500) {
lEditor.setData(lEditorHelp);
break;
}
}
alert("You've reached the 500 words, you are not allowed to insert any more.");
}
}
function wCountInf(cData){
// Content of the rich text editor
var rteAnswer = cData;
//Regular expression to strip the HTML tags from a String
var stripHTML = /<\S[^><]*>/g;
var text = rteAnswer.replace(stripHTML, '');
text = text.replace(/'/g, "");
text = text.replace(/\s| \s| +/g, " ");
var wordCount = text.match(/\b/g);
word_count = ((wordCount) ? (wordCount.length / 2) : 0);
}
I hope it helps anyone who needs this and has searched the Internet as much as I did.
Kind regards.
-
How to style text editor Forum?
Good then BC told me that there is no way to the style of the Forum text editor. I hope that im not describe this wrong, you know
the module that allows users to type and write a post in the forum. Then without further ADO my site Web is mainly black
This thing is basically completely white, I'm looking for a way to change the background color, but there is absolutely no way of
style and with a style sheet or style tags. Another thing I'd like is the change in width. I was able to do all these things in the
Google inspect / developer tools. Although there is no way for me to get these styles already predefined.
Tag finds im trying to style
forums page / post page! as {tag_editor}
/ * Here is a link to give visual effects * /.
Things good and final, I wouldn't even mind using a 3rd party editor but if I can't fix that I could just put in a forum 3rd party service which I certainly don't want to do since it's practically over.
Thank you very much for your time and reading this.
Sincerely, Auzurial Prints
Hey there,
Simply you can not do anything with that. Forums are the old basic things, if you need an appropriate forum use a 3rd party domain and sub 10 years there.
-
workaround for the rich with images embedded text editor
Hello
I had the requirement of users they would like to manage content formatted by themselves. I used the rich text editor component that works great with text, but users would like to add a few images in the content. I understand that the rich text editor component does not currently support images incorporated; However, is there anyone with a work around for this requirement. Moreover, I saw 'Insert Image' and 'Insert video' button on the screen, I wrote this discussion, but they are not yet activated. That means Oracle is currently developing this feature?
I use jDeveloper 11.1.2.4.0.
Thank you.
NAT
"If you switch to the"Source Editing Mode"and insert something like: http://www.w3schools.com/images/w3schools_green.jpg" >
and go back to "Rich Text Editing Mode", you will get picture.
So you can probably add this programmaticaly, but the tricky part is to determine the insertion position (you will probably need the javascript).
Moreover, I saw 'Insert Image' and 'Insert video' button on the screen, I wrote this discussion, but they are not yet activated. That means Oracle is currently developing this feature?
Note that the forum RTO is not written in Oracle ADF
Dario
-
A long list of links (200 +) editing with a text editor
I run a number of Muse site for a non-profit and we export our HTML files end a FLASHLIGHT battery where the scripts are used to extract data from our database.
For example a possible hyperlink would be http://dev.myrewards.com/phone/rewards.cgi?category=electronics
This will display a list of awards electronic on phone users when they click on a button or menu item that is attached to the hyperlink inside the Muse
For the moment, we have about 300 award catergories, which change ALL the time. From now on we must change hyperlinks manually inside the Muse, often leading to transcription errors and missing rewards.
Is it possible to access the list of hyperlink of Muse in a text file, edit it in a standard text editor, and then returns a list of hyperlink edited to the Muse?
Hello
If you use any document, image for the hyperlink to the content page, you can check the content used in the current folder, but if those are URLS, then, we need to do it manually.
Or as a workaround, you can create a PDF file with links and link to this PDF on the page for more information where users can open the document and click the links. So when you need to date/edit links, you can make the changes in the PDF document. But yes, it would be manual.
Thank you
San
-
ORACEL XE with apex 4.0, I would like to user can modify Rich Text (link, hard, etc.) to develop Rich Text Editor
but where the Rich Text can be svaed, blob or something? can we record in VARCHAR2 Data Type (255)Have you tried simply to create a report with the data that is held in? If the HTML code is valid, it should automatically rendered as HTML ('rich text' If you want to)-I know because I've used this feature in some applications myself.
It has slightly different if you want to view it directly in a region in itself. In this case, you can:
1. pass the value into a rich text editor (or html editor) page element (as you would in a normal shape).
2 "print" the value directly in a PL/SQL area, by using the htp.p command, as follows:/* note: this is the contents of a PL/SQL region */ declare l_clob clob; /* or varchar, depending on how big your text is going to be */ begin select pic.attrib into l_clob from picture pic where pic.picture_no = :PX_PIC_NO; htp.p(l_clob); end;
-
text editor recognize Greek letters
text editor does not recognize Greek letters
Could you give more detail on what you're talking about exactly? You try to open a document using TextEdit and see something else instead of the Greek? Where the document from? This could be a problem of encoding. You try Greek with Greek input source and type it does not work? You see the Greek I type here OK? ΑΣΔΦΓΓΗΞΚΛ
-
Recently, I noticed that when I work in WordPress, or by using a text editor in line, or technical support anywhere, I'm hidden code added at the bottom of the text box:
521I downloaded the extension of all professionals of Downloader which is on your list and it indeed contains the code to create and read this div with the id "link64_adl_tabid" (in link64_adl_overlay.js, one of its component files).
That should not affect a textarea field basis, given that the code adds to the body of the document. In a rich text box, however, you change a small independent document, so it makes sense that he gets injected into the Visual Editor.
The author of the add-on could probably fix this by adding only not the div to a document which is contentEditable has. But I do not recommend trying to fix the extension yourself.
Could you try to disable it and test again? You can do this on the page modules. Either:
- CTRL + SHIFT + a
- "3-bar" menu button (or tools) > Add-ons
In the left column, click Extensions. Then, when in doubt, turn off.
-
Format rich text editors or tools do not work in Firefox
I use Win 7 64 bit and Firefox 16. Problem is that I and other users of the Forum, that we belong to, can not use the editor text rich Format or tools to edit text...
For example, when you type your text and you want to change the format of "BOLD" etc. the editor gives a code like this:[undefined = undefined] Found thread [/ undefined] where it should be [b] Thread Found [/ b]
The undefined Word opens with all the formatting tools.Using another browser like Chrome or IE the formatting or rich text editor works very well. Like I said that's not me who has this problem, we are not a lot of people on the forum who is having the same problem.
Counsel for solving this problem will be greatly appreciated.
Thanks in advance
Kind regards
MEA Albrecht«Due to the change Firefox 16.1, when using the editor to insert MyCode you experience a problem where the tags are displayed in form [undefined = undefined]/ undefined.» This problem has been fixed in 1.6.9, MyBB but until free us, we have provided a patch for you to make your own maps. »
http://community.MyBB.com/thread-127983-post-926896.html?highlight=Firefox#pid926896
The fix is discussed here - http://community.mybb.com/thread-127322-post-922533.html#pid922533
A forum administrator can manually apply this hotfix, or simply wait for the update to MyBB 1.6.9. -
Error message for Virgin Gmail
"Unable to load the rich text editor.
What is the solution?
You can see https://support.mozilla.com/questions/896294
and look at this thread, the only real connection so far is it is very recent and it involves blank e-mail.Those who are in this thread say blank incoming emails doesn't work except if they Disable Adblock Plus from the icon of ADP.
In fact, the rich text editor would be in a separate file, there is most likely a connection to ADP because some of these files may be blocked. I used to have a lot of problem in this forum on the web and the tools were blocked (didn't really need them) just because I block a lot of things here: like animals to fur in nurse uniforms, a trash can (toolkit) and that blue area at the bottom of this page that interferes with scrolling and the use of the key 'end '.
Something seems to be wrong with your profile, clicking on it does not bring it upwards.
Maybe you are looking for
-
At home, I have Windows 7 and have only minor problems, file transfer to my Xoom. I invited to Skip, Skip All, ignore, etc. but only am allowed to still transfer files. My question is at work on my WinXP SP3 machine where I want my Xoom transferable
-
Hi there, I've never had this problem when I bought my MBP in 2010, but after the problem with unexpected reboots of El Capitan passage has become more common and is really affecting the productivity of my laptop. For clarity, here's my cell phone in
-
Tried 3 times to download latest ios update but my ipad just hangs and I have to restart it
Tent 3 times to download last update ios but ipad just freezes and I have to restart
-
Users /(user name)/AppData/Local/Temp
Greetings, I'm trying to better understand the purpose of this particular Temp folder (usersTemp under Vista (ultimate). Specifically, it operations, functional routines, application of the related activities, or other executions file would put file
-
Image of connection Wave Embassy suite
After having installed the suite Embassy wave (to use the fingerprint reader for connections on my mobile m65), the image of the user in vista is replaced by a logo of dell systems and waves in the login screen. For the life of me I can't find the re