JTextPane, how to set only a part of text editable?

How to set only a part of text in JTextPane editable? For example I want to forbid changing text after 'enter'. JTextPane has method setEditable but this works only for whole JTextPane.
Plz help!!!

I'm working on some application similar to unix console. It can't be done relatively simply with the provided components (for example two textfileds), but then it will not look like console :) .
Now some technical problems:
Anyway, use a DocumentListener and have it ignore any changes
in areas you deem to be protected.I have no idea how to ignore changes using DocumentListener. Could you give more information abut this?
I found "my own way". I create MyDefaultStyledDocument which extends DefaultStyledDocument. Then I overwrite two methods: insertString and remove. Using offsets values I manage to block everything before " > ", and I protect output from editing. But I still have a problem:
This works fine (add "> " to JTextPane text):
            String s = console.getText();
            s = s+"> ";
            console.setText(s); but this doesn't work (for example replace last word):
                String all = parent.getText();
                all = all.substring(0,all.length() - cut);
                all = all+text+" ";
                parent.setText(all);where: parent = console = JTextPane
Why?
And one more question. Why when I typed "enter", Document remove all text and paste it again :/

Similar Messages

  • JTextArea, how to set only a part of text editable?

    How to set only a part of text in JTextArea editable? For example I want to forbid changing text beteween lines 2 and 6. JTextArea has method setEditable but this works only for whole JTextArea.
    Plz help!!!

    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=5177361

  • How to set alert mail contain SQL text activities

    How to set alert mail contain SQL text activities.
    In "Notification Templates" topic have no Available Tags about sql text. Can I send mail alert with SQL text?

    it should be text/plain, for a complete list refer
    http://www.freeformatter.com/mime-types-list.html
    Regards.

  • How to set only part of the document as "read-only"?

    Hi,
    I am using SharePoint 2010. I would like to set some of the columns as "read-only" while some of them are still editable. If I use Advanced Settigns>Item-Level Permissions, I can only set the whole document as "read-only".
    Is there a way I can do what I wannt?
    Thanks a lot!

    Hi,
     There is no OOTB way to set a column as read-only.  I think you want to make some of the fields as Read-Only in the EditForm.aspx. If so, then you can use the Javascript to do. 
    Add a Content editor webpart to the Editform.aspx page and place the javascript method to make a field read-only.
    You can use the _spBodyOnLoadFunctionNames.push("MakeReadOnly()") method to assocaite your method to the EditForm.
    Here are the links which will help you.
    http://dishasharepointworld.blogspot.in/2011/08/read-only-field-in-sharepoint.html
    http://nishantrana.wordpress.com/2009/01/30/read-only-field-in-sharepoint-editformaspx/
    http://www.jbmurphy.com/2010/06/01/how-to-make-a-field-in-a-sharepoint-edit-form-readonly/
    *******Don't forgot to MARK AS ANSWER / VOTE AS HELPFUL if it really helps************
    R.Mani http://rmanimaran.wordpress.com

  • How to set a room part as default in a room template?

    Hi,
    Can you please tell me how to configure a room part as the default one for a room template. The requirement is that this room part must be the first one to be opened when a room of the specific template is opened inside collaborations. NW7.0 . Please provide you suggestions.
    Thankyou in advance..

    Hello Lorcan,
    Thank you for the information. But even after trying to set it as extension the changes was not getting reflected. Another way which I tried to set the room part as default after adding the extensions is below:
    Content Administration -> Portal Content -> com.sap.ip.Collaboration -> Template Worksets (where the customized templates are there)->In the selected template I tried setting the property "Default Entry for Folder" as yes for room part "Documents".
    As of now room part "Task" is opened as default for the room but I want "Documents" to be opened by default. Please advice on the same.
    Thank you in advance..

  • How to set only one Index-group for a Search-iView as default?

    Hi Everybody,
    i have a lot of index ID's for searching in different folders. Is it possible to set only one index-group as default for a search iView? Until now i get all groups as default in every search. It's inconvenient for the users to use the link of 'show options' in order to uncheck the other index ID's.
    regards,
    Seed
    Edited by: seed_mopo on Jun 6, 2008 5:02 PM

    hi Seed,
    To achieve this you have to follow the below steps
    1. Create a new set of search options, choose System Administration -> System Configuration -> Knowledge Management -> Content Management -> User Interface -> Search -> Search Options Set in the portal.
    In that you have a field 'Index Groups', wherein you can specify which index group, the user has to search in. If there are multiple index groups, mention your index groups separated by comma.
    See here for more information
    http://help.sap.com/saphelp_nw04/helpdata/en/cc/f4e77ddef1244380b06fee5f8b892a/content.htm
    2. You have to specify the option set that you created in step 1 in the default KM search iview. In the iview properties, under the field search option set, mention the option set that was created for this index group or multiple index groups.
    This way, you can configure KM search iview to search in a single index group or multiple index groups.
    Revert back in case of any queries
    Regards,
    Ganesh N

  • How come itunes only downloaded part of a song?

    I bought a a couple of albums off of itunes and on one song (that i know of) on each album only plays part of the song. For example: if you have a 3:45 song it will only play 2:35 of the song and then it cuts off and moves onto the next song on the album. Can anybody help with this problem. I want my moneys worth. Thanks.

    Delete the tracks from the iTunes library, allowing iTunes to move the track files to the Trash. Then download the tracks again from the iTunes Store via this procedure:
    http://support.apple.com/kb/ht2519
    That fixes the problem for many people. If problems with the tracks persist, go here:
    iTunes Support
    and follow the instructions to report the issue to the iTunes Store.
    Regards.

  • How to set only one row selection  in ALV GRID DISPLAY

    How to set single row selection in grid display
    not multiselection.

    Hi,
    In the USER COMMAND, build the code to check the REFRESHED Data & then check the number of records with SEL  = 'X'.
    If more than single entry found, then raise an error message.
    Best regards,
    Prashant

  • How can labview update the string control (text-edit box) after we have pressed the carriage return key on the keyboard during text-editing within that box?

    Dear readers,
    I have been trying to work out how to get labview to detect the event when a 'string' control has been modified, where the user has finished editing the string either by 1) pressing the enter key on the keyboard, or by 2) taking the focus away from the string control again. For example.. if I use the mouse to click on the string control and then I type 1234 into the box, I would like to have a routine that does something once the user hits the Enter key of the keyboard, or when the user takes the focus away from the string control again by clicking on something else. I would like the routine to respond even when the user didn't change anything in the text box (such as when we mouse-click on the edit box to go into edit mode, and then mouse-click on something else to remove the focus with no changes to the contents in edit-box).
    The purpose of my routine is to have a edit-box for a user to change for example the centre-frequency of a vector network analyser, so that the centre-frequency of the network analyser can change once the user finishes entering a new value in the text-edit box by hitting Enter key after the number is keyed in. Even if the user has clicked on the edit box, but changes their mind by mouse-clicking on something else to remove focus from the edit box, I would still like labview to detect the event when the control loses focus, so that the centre frequency can be updated anyway (to the same value that was already in the edit box).
    So far, I've tried set the string control option to 'limit to single line', so that I can try to scan for a carriage return .. '\n' ... pattern in the string. Unfortunately this doesn't work because labview doesn't seem to attach the '\n' to the end of that single line.
    Could someone please suggest ways to set a flag when a user hits Enter during text-edit mode of a string control, or when focus has been removed from the string control?
    While I've only described my problem for controlling a single control parameter on the gpib device, I'd like to make this feature work so that I can do the same kind of thing with other control parameters as well.
    Thanks so much in advance.
    Kenny

    Hi Kenny,
    instead of using the event structure, you can directly achieve to what you want by the KeyFocus property of the string control.
    - Enable Limit to single line option
    - Create the property KeyFocus in read mode and connect an indicator
    Each time you click on the string to modify it KeyFocus is True; when you click away or hit Enter KeyFocus is False.
    You can toggle your settings when KeyFocus changes from True to False.
    Alberto

  • How to print the content of a text edit ?

    Hi to all,
    I have a view with a text edit and I want to print its content. I created a button and I want to print text edit content pressing this button. How can I do? Which java code I have to insert in that button?
    thanks a lot,
    Antonio

    Antonio,
    Sadly, there is no way to do it directly. Even in plain HTML application it is impossible to print text of UI control (<textarea> in this case).
    So you have to open new browser window containing entered text and let user print text himself. Or invoke window.print() on document load event.
    VS

  • How do i change my terminal and text edit privileges

    How do i change my privileges in terminal and text edit?
    Every time i try to drag something from text edit to terminal it says this;  "The file “server.command” could not be executed because you do not have appropriate access privileges.To view or change access privileges, select the file in the Finder and choose File > Get Info''
    and when i go to "Get Info" it says read&write is on!?
    Can somebody help me please??

    Hi Taysia_b,
    The convention that I have always used was to copy (Command-C) from the editor, and paste (Command-V) in the terminal and it has worked for me thus far.
    Found keyboard commands faster to work with, than trackpad stuff.
    Have fun
    Leo

  • How to print only certain parts of a page based on form input

    I need to know how to do the following.
    I have a PDF with a listing of five addresses. I need to be able to use radio buttons, check boxes, or something similar in order to select certain addresses, and have only those print. But, I need to keep all the addresses available in the electronic copy, and the addresses can't be editable by others. Other people can only choose to print the sheet showing just the addresses they want, such as 1, 2, and 5.
    Is this possible? If so, how?
    Your help is appreciated!

    One way is to set up five buttons, one for each address. Create a separate PDF for each address and use them as the icon source for each button. To set up a button to use an icon, set its Layout to something other than "Label Only".
    The buttons should be set to be read-only, and not have a background or border color. When the corresponding check box is selected, the address button would get set to be printing, and non-printing if deselected. Use something like the following as the Mouse Up JavaScript for each check box.
    // Mouse Up script for check box
    var f = getField("Address1_button");
    f.display = (event.target.value === "Off") ? display.noPrint : display.visible;
    Replace "Address1_button" with the actual name of the corresponding button.
    Instead of using buttons to display the addresses, you may be able to use text fields. It just depends on the formatting you need.

  • How to Include only a part of big JAR in my own JAR

    i'm using AXIS soap functionality in my app, but the problem is that my own final jar file is as small as 700 KB and required for it AXIS.JAR takes about 2 MB.
    i'm using only a limited amount of classed from it, but the FACTORY classes loads them dinamically.
    so how can i at build time include only required for me classes, not the whole library?
    thanx!

    You know some classes you need, right? Put those classes into your new jar and put in into your classpath instead of axis.jar. Then run a test program until you get a ClassNotFound exception. Put that class into your new jar. Repeat until you don't get the exception any more.
    But before you start doing that, read the Axis licence carefully to make sure it permits you to do that.

  • How to set a hierarchy: Part Chapter Section

    Hello,
    in iBooks Author is there any workaround to add into the ibook hierarchy "Parts", that contains Chapters?
    So a Book would look like:
    PART 1
    - Chapter 1.1
    -- Section 1.1.1
    -- Section 1.1.2
    - Chapter 1.2
    -- Section 1.2.1
    -- Section 1.2.2
    PART 2
    - Chapter 2.1
    -- Section 2.1.1
    -- Section 2.1.2
    - Chapter 2.2
    -- Section 2.2.1
    -- Section 2.2.2
    And so on?
    To the best of my knowledge, Chapters are the highest in hierarchy and it seems they can't be contained by anything.
    Thanks in advance for your help!
    Davide
    www.davidebarranca.com

    I recommend sending in feedback as well. Apple needs to make the hierarchical layout system more flexible.
    Part
    Chapter
    Section
    should be an option, as should
    Section
    Chapter
    (many books group multiple chapters into a section)

  • How to set up a server for PPro editing (and AE finishing)?

    Hello everyone,
    I may be a bit offtopic with this question, but at the same time it's really related to PPro.
    I never worked in any post-house facility, and I come from a very indy background, so I never had a chance to see any edit suite hook up to a server.
    I am wondering how great it is, how it could help our projects? And also what are the basics to know, the stuff to avoid when you're a newbie like me (in term of server network settings)?
    Right now, we're running 3 Mac Pros to edit our projects. They are all connected through Gigabit ethernet.
    Our workflow involves that all Mac have the entire footage in there own drives. We're using the network only when importing new content to copy it on the 2 other Machines.
    We found out that if we use Mac #1 to open a PPro project contained within Mac #2 drives (as well as the footage), it's okay but the performances are not as great as opening a project in its own drives.
    So we try to copy (move) the projects in the right Mac before to work on it. Of course, everytime, we have to relink everything if we don't want Mac #1 to read the footage from Mac #2…
    When it come to big projects, with lots of Red footage, it is a pain, and we usually end up using only one master machine for the edit, and it's only when it comes to finish in AE that we really start to split the project onto the 3 platforms.
    So this is where the idea of a server comes in mind. Mac #1 would work on a project A, then when moving to work on project B, Mac #2 could open project A and keep working on it - no relink: the project AND the footage are all on the server.
    That is my basic idea. Sound simple, but really I have no idea if it really works. Is it something I can really do on a server?
    How the server really helps to keep the performance? If I see PPro's performance lowering down when accessing projects and footage from our actual simple network, is it going to be better accessing the same datas from a dedicated server.
    I'm looking at the Mac Mini server with Lion Server. What Lion Server does that Lion OS doesn't do already?
    I know, it sounds like completely newbie questions, but I honestly have no idea.
    Can a Mac Mini with Lion Server serve the 3 Macs running Snow leopard? Or do we need to update them?
    My idea is to use Pegasus thunderbolts for storage drives, plugged in the Mac Mini, then plug all the 3 Mac into the Mac Mini, with what I believe should be Gigabit Ethernet…
    Am I right? A least a bit? What did I miss?
    Thanks in advance for sharing your knowledge guys
    Julien

    If you are going DIY route, this is your only option: http://magazine.creativecow.net/article/build-your-own-affordable-san-that-iworksi
    However that probably won't work with RED footage.

Maybe you are looking for

  • How good is the java Ras Sdk in Business objects XI?

    I have programmed some  reports from scratch by using the java ras sdk. Somehow I have the feeling that new features of XI like dynamic image location, or running totals aren't so well supported as for example through the Crystal report Designer. Do

  • Firefox crashes when i try to print a webpage using a 510 lexmark printerwhen i

    each time i try to print a webpage firefox crashes . i am using a lexmark printer. if i need to print a webpage i have to install internet explorer

  • Use Moduls with SOAP Sender Adapter

    Hi Experts, I have a question regarding the use of modules in the soap sender adapter / communication channel. Is it correct that the use of modules in the soap sender adapter is not possible? the background of my question is that we use modules from

  • Windows Installer 3.0 and ZFD 3.2

    We just got an application that uses, and requires, Windows Installer 3.0 upon deployment. None of our Windows 2000 or Windows XP computers has that version of installer, yet... What issues are there with installing the installer and this application

  • IPhone 4S Case That Won't Interrupt Camera

    As some of you may know, the camera on the iPhone 4S doesn't function properly if the opening for the camera isn't large enough. I want to get a case that doesn't interrupt with the camera meaning it has a pretty large opening for it. Do you guys kno