How to create a JTree in which only leafs are selectable

It took me a while and some effort to find a way to make a JTree in which you can only select the leafs.
I'm posting the example in case someone is interested. This might be helpful.
myJTree.setSelectionModel(new DefaultTreeSelectionModel() {
     public void setSelectionPaths(final TreePath[] paths) {
          boolean okToAdd = true;
          DefaultMutableTreeNode selectedNode;
          for (int i = 0; i < paths.length; ++i) {
               selectedNode=(DefaultMutableTreeNode)paths.getLastPathComponent();
               if (!selectedNode.isLeaf()) {
                    okToAdd = false;
                    break;
          if (okToAdd) {
               super.setSelectionPaths(paths);
     public void addSelectionPaths(final TreePath[] paths) {
          if (getLeadSelectionPath() == null) {
               super.addSelectionPaths(paths);
               return;
          boolean okToAdd = true;
          DefaultMutableTreeNode selectedNode;
          for (int i = 0; i < paths.length; ++i) {
               selectedNode=(DefaultMutableTreeNode)paths[i].getLastPathComponent();
               if (!selectedNode.isLeaf()) {
                    okToAdd = false;
                    break;
          if (okToAdd) {
               super.addSelectionPaths(paths);

For this to work in PDF the client ither needs Acrobat Pro or you need to create a PDF form (which has it's disadvantages concerning design)
In any way PDF is not actually meant for editing. The editing functions in Acrobat have their disadvantages as well if carefully set type is what you're after.
A vector file simply can't be protected.
Make a contract.

Similar Messages

  • How to create a folder in which email forms are stored which cab be used and usen again

    Hi folks of the free software comunity,
    in the olden days I used to use a mail program made by MARINET in England. This received an sent emails via a sattelite connection an nothing else.
    The program had a feature called pre-formed mails:
    In a special folder lots of pre-written emals where stored - messages that needed to be sent again an again wit slightly changed contens. The address, reference and text fields where already filled.
    If needed you would open one of these pre-written mail, change a few items - say the date, number of item or some such
    Adress an reference would remain the same.
    The SENT the bugger an finished.
    In the SENT folder this mail would be shown with the corrected text.
    In the special folder the not corrected mail would remain.
    The special folder served as a file of mails already written as well as a remainder of what needed to be sent - by looking at the stored mails - an so save the user a lot of work.
    My question:
    How can this be created in THUNDERBIRD ?
    tks n bregards
    i.b.b
    [email protected] (pls copy an answer to this mail address

    Open a new Write message.
    Create the email you want to use as a Template, give the 'Subject' a suitable title so you can easily locate that template email, but do not enter any email addresses.
    Then click on 'Save' as 'Template' OR File > Save As > Template.
    A Templates folder will be auto created and th email will be stored in that Templates folder.
    To use:
    Select Templates folder to see emails.
    Double click on email OR right click on email and select 'Edit as new Messge' to open in a new Write window.
    Edit as required and send as usual.
    The email in the Templates folder will remain as is and can be reused again and again.
    Additional info:
    If you wish to send one personalised email to a group, so each person gets their own personalised email, you could consider an addon called 'Mail Merge' which works with Template email and either a .csv file or an address book.
    * https://addons.mozilla.org/en-US/thunderbird/addon/mail-merge/

  • How to create the SWF file which was included surrogate pairs.

    I would like to make sure how to create the SWF file which are included surrogate pairs.
    The error of outside the scope of unicode occurred when I compiled(mxmlc) the as file which was set surrogate pairs to 'Unicoderange'.
    Ex, I set the '  '(UTF-16 is '20B9F') to 'Unicoderange'.
    However, I cannot add the surrogate pairs.
    The error of outside the scope of Unicode occurred when I compiled the AS file.
    The reason of error was that the Unicode(UTF-16) of surrogate pairs is invalid.
    Then, I read the following pages.
    These pages are written that unicode-range supported surrogate pairs.
    http://livedocs.adobe.com/flex/3/html/help.html?content=fonts_07.html
    http://www.w3.org/TR/1998/REC-CSS2-19980512/fonts.html#descdef-unicode -range
    So please let me know how to create the SWF file which are included surrogate pairs.
    Environment
    - Flex3.5a
    - TTC: meiryo(ver6.02), msgothic(ver2.50), mspgothic(ver2.50)
    Thanks,
    Takeshi Ishihara.

    I've been able to create project jar files in Eclipse by selecting Export from the File menu, then choose Java - Jar file - and provide the required information, name, destination folder etc. But when I do this, I do not export other jars on the build path this way nor do I expect to do this. I am only concerned with creating a jar file of my own work. A jar file does not "contain" other jar files. If the jar file contains the main method, and requires other jars for it's execution, then you may wish to include a reference to required jars on the class path entry of the Manifest file of the jar file you create. I'm not sure how to create a Manifest file in eclipse though..

  • How to create a user  y which will have the same content of existing user x

    how to create a user y which will have the same content of existing user x ,
    like all the tables,procedures,functions and packages

    You can do the following.
    1. Use CREATE USER to create the new account/schema
    2. Use exp to export old schema
    3 Use imp with fromuser=<old user> and touser=<newuser>

  • How to create a Z* table which can maintain through SM30?

    How to create a Z* table which can maintain through SM30? Thanks!

    This question had been asked millions of times...you just need to search the forums...
    Quick hint...goto SE11...the utilities menu and then Table Maintenance Generator.
    Greetings,
    Blag.

  • How can create a JTree with cellRender is checkbox realized multiple selec

    How can create a JTree with cellRender is checkbox realized multiple selection function.thanks for every
    one's help.

    Hi,
    1. Create a value node in your context name Table and set its cardinality to 0:n
    2. Create 2 value attributes within the Table node name value1 and value2
    3. Goto Outline view> Right click on TransparentUIContainer>Apply Template> Select Table>mark the node Table and it's attributes.
    you have created a table and binded its value to context
    Table UI properties
    4.Set Selection Mode to Multi
    5.Set Visible Row Count to 5
    6.ScrollableColCount to 5
    In your implemetaion, you can add values to table as follow:
    IPrivate<viewname>.ITableElement ele = wdContext.nodeTable().createTableElement();
    ele.setValue1(<value>);
    ele.setValue2(<value>);
    wdContext.nodeTable().addElement(ele);
    The above code will allow you to add elements to your table node.
    Regards,
    Murtuza

  • How to create sharepoint Group with read only permissions using powershell for entire site ?

    How to create sharepoint Group with read only permissions using powershell for entire site (including subsites and top level site)

    Hi
    using (SPSite site = new SPSite(url))
    using (SPWeb web = site.OpenWeb())
    SPUserCollection users = Web.AllUsers;
    SPUser owner = users[string.Format("{0}{1}", "Domain", "Owner Username")];
    SPMember member = users[string.Format("{0}{1}", "Domain", "Default Member Username")];
    SPGroupCollection groups = Web.SiteGroups;
    string GroupName = “Super Exclusive”;//your group name
    string GroupDescription = “Super exclusive group description.”;
    groups.Add(GroupName, owner, member, GroupDescription);
    SPGroup NewSPGroup = groups[GroupName];
    SPRoleDefinition role = Web.RoleDefinitions["Read"];
    SPRoleAssignment roleAssignment = new SPRoleAssignment(NewSPGroup);
    roleAssignment.RoleDefinitionBindings.Add(role);
    Web.RoleAssignments.Add(roleAssignment);
    Web.Update();
    Please 'propose
    as answer' if it helped you, also 'vote
    helpful' if you like this reply.

  • How to create a group of contact from a multi-selection of mails in a mailbox to answer to all senders?

    How to create a group of contact from a multi-selection of mails in a mailbox to answer to all senders?

    Use Mail Scripts. Its Add Addresses function will collect all the addresses from all selected messages and allow you to select the ones you want to add and allow you to create groups as you go.

  • How to create application toolbar in modal dialog box in selection-screen

    Hi Experts,
    how to create application toolbar in modal dialog box in selection-screen?
    Regards,
    Swapnika

    Hi,
    Check the following link regarding Model dialog box and appication toolbar
    http://help.sap.com/saphelp_nw70/helpdata/en/d1/801b84454211d189710000e8322d00/frameset.htm
    It helps in solving your problem.
    Thanks.
    Ramya.

  • How to create dynamic ed flash charts based on user selected fields in Orac

    Hi all,
    Can any of the experts please tellme "how to create dynamic ed flash charts based on user selected fields in Oracle apex".
    Thanks
    Manish

    Hello,
    Lots of different ways to do this, I blogged about one way (using a Pipelined function) here -
    http://jes.blogs.shellprompt.net/2006/05/25/generic-charting-in-application-express/
    Other options include using a PL/SQL function returning the string to use as the dynamic query etc.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • How to create a event to display records depend on selection ofdropdownlist

    BSP
    how to create a event to display records depend on selection of dropdownlist box,
    Using BHTML,
    thank you,
    regards,
    jagrut bharatkumar shukla

    1) Copy this script to the code
    <script type="text/javascript">
    function displayVacationDates() {   
        for (var i=0; i < document.forms[0].Status.length; i++) {
            if (document.forms[0].Status[i].checked && document.forms[0].Status[i].value=='Vacation'){
              document.getElementById('startDateRow').style.visibility='visible';
              document.getElementById('endDateRow').style.visibility='visible';
             if (document.forms[0].Status[i].checked && !(document.forms[0].Status[i].value=='Vacation')){
             document.getElementById('startDateRow').style.visibility='hidden';
              document.getElementById('endDateRow').style.visibility='hidden';
    </script>
    2) Set initial style to 'hidden'
    <tr id="startDateRow" style="visibility:hidden">
    <td align="left"><blockquote>
      <p><span class="style16 style8"><strong>Start date:
      </strong></span></p>
    </blockquote>                 </td>
    <td align="left"><script>DateInput('VacStart', true, 'DD-MON-YYYY')</script></td>
    </tr>
    <tr id="endDateRow" style="visibility:hidden">
    <td align="left"><blockquote>
      <p><span class="style16 style8"><strong>End date:
      </strong></span></p>
    </blockquote>                      </td>
    <td align="left"><script>DateInput('VacEnd', true, 'DD-MON-YYYY')</script></td>
    </tr>
    3) Call the display script
    <input name="Status" type="radio" value="In the Field" onclick="displayVacationDates()">
    <input name="Status" type="radio" value="Vacation" onclick="displayVacationDates()">
    <input name="Status" type="radio" value="Sick day" onclick="displayVacationDates()">
    <input name="Status" type="radio" value="Admin Day" onclick="displayVacationDates()">
    <input name="Status" type="radio" value="DSR Ride Along" onclick="displayVacationDates()">
    <input name="Status" type="radio" value="ServiceCall" onclick="displayVacationDates()">

  • Change the size of a repeating section based on which optional sections are selected

    InfoPath 2010
    I've created a repeating section in a form that has 8 optional sections. All the optional sections are hidden until the user selects one from a drop down list, which only allows one selection per repeated section.
    My problem is that the repeating section is quite long to accommodate the 8 optional sections. Every time a user adds a section there is a long blank space in the form.
    Is there a way to scale the size of the repeating field to eliminate the excess blank space?

    Hi,
    Try to remove all the blank space from repeating section and choose the Height, Padding and Margin of the repeating section as auto.
    After that add table with 8 row and add your optional section in each row, do same thing for each optional section, remove blank space before adding any control and choose height, padding and margin as auto.
    I designed the same and it is not taking more than single line space until we select the value from dropdown list.
    If still it does not work, please share your design if you don’t mind we would be happy to help you
    Krishana Kumar http://www.mosstechnet-kk.com

  • How to create an ADF table which has a command button column?

    Hi
    Thank you for reading my post
    how i can create a tabl that one of its column is a command button.
    when i press the command button it will , for example delete that row or do some action.
    indeed i want to know
    -how to have a command button column
    -how to find the rowID or some row identifier that help me locate that row in the database.
    thanks

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Rainer Wagner ([email protected]):
    Imagine a table T_Q with columns C_1, C_2, C_3 and UN_123.
    C_1, C_2 and C_3 are all numeric and given by the user.
    UN_123 has to be a calculated sequence number starting by 1 and incremented by 1 for each combination of C_1, C_2 and C_3, i.e., the sequence number depends on the key values C_1, C_2 and C_3.
    Could anybody provide a code sample on how to create a BEFORE INSERT trigger , which calculates the value of the column UN_123 based on the values of C_1, C_2 and C_3 ??
    Premise: Rather than using any sequence, the trigger code should only be based on the table T_Q<HR></BLOCKQUOTE>
    null

  • How to create a JTree using a tree of my own

    Hello,
    I have an object which has a tree structure.
    I want to create a jtree that will hold the data from this tree of my own. I also want to be able to customize how nodes are rendered and to add a context menu with options like ADD/Remove/Move....
    Can you point me to a good tutorial?
    Can you help me?
    Thank you very much for your asistance.

    carstos,
    See this article for a not-extremely-well-written, but still useful, intro to trees:
    http://java.sun.com/products/jfc/tsc/articles/jtree/index.html
    After that see the Swing Tutorial at http://java.sun.com for specific help on popup menus, etc.
    --A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to create an INSERT trigger which creates a "sequence number"

    Imagine a table T_Q with columns C_1, C_2, C_3 and UN_123.
    C_1, C_2 and C_3 are all numeric and given by the user.
    UN_123 has to be a calculated sequence number starting by 1 and incremented by 1 for each combination of C_1, C_2 and C_3, i.e., the sequence number depends on the key values C_1, C_2 and C_3.
    Could anybody provide a code sample on how to create a BEFORE INSERT trigger , which calculates the value of the column UN_123 based on the values of C_1, C_2 and C_3 ??
    Premise: Rather than using any sequence, the trigger code should only be based on the table T_Q
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Rainer Wagner ([email protected]):
    Imagine a table T_Q with columns C_1, C_2, C_3 and UN_123.
    C_1, C_2 and C_3 are all numeric and given by the user.
    UN_123 has to be a calculated sequence number starting by 1 and incremented by 1 for each combination of C_1, C_2 and C_3, i.e., the sequence number depends on the key values C_1, C_2 and C_3.
    Could anybody provide a code sample on how to create a BEFORE INSERT trigger , which calculates the value of the column UN_123 based on the values of C_1, C_2 and C_3 ??
    Premise: Rather than using any sequence, the trigger code should only be based on the table T_Q<HR></BLOCKQUOTE>
    null

Maybe you are looking for