Make all leaf visible in JTree

I haved tryied to make my jtree totaly expanded but with no success.
The code belowe is what i tride with, butt all my leafs do not expand just to
the las node.
Are there realy no method for this?
* expandAll
* Expands / collaps a tree.
public void expandAll(JTree tree, boolean expand) {
TreeNode root = (TreeNode)tree.getModel().getRoot();
// Traverse tree from root
expandAll(tree, new TreePath(root), expand);
private void expandAll(JTree tree, TreePath parent, boolean expand) {
// Traverse children
TreeNode node = (TreeNode)parent.getLastPathComponent();
if (node.getChildCount() >= 0) {
for (Enumeration e=node.children();
e.hasMoreElements(); ) {
TreeNode n = (TreeNode)e.nextElement();
TreePath path = parent.pathByAddingChild(n);
expandAll(tree, path, expand);
// Expansion or collapse must be done bottom-up
if (expand) {
tree.expandPath(parent);
} else {
tree.collapsePath(parent);
System.out.println("c "+parent);
/**********************************************************/

This code works for me. I hope it works for you also.
I have a JTree called myTree with a TreeModel called myTreeModel. The solution has two methods. The first method "expandTree()" is what you call to show all the branches. This method will get the root node from the tree model and then call the method that exands all the paths, "expandEntireTree(TreeNode)". This recursive method will call itself for each of it's children.
Good luck,
Kevin Ford
public void expandTree() {
     expandEntireTree((DefaultMutableTreeNode) myTreeModel.getRoot());
private void expandEntireTree(TreeNode tNode) {
     TreePath tp=new TreePath(((DefaultMutableTreeNode)tNode).getPath());
     myTree.expandPath(tp);
     for(int i = 0; i < tNode.getChildCount(); i++) {
          expandEntireTree(tNode.getChildAt(i));
}

Similar Messages

  • Make all taps visible?

    I'd like to make all taps on the screen visible for presentation. Is that possible? Where do I find the setting? (iPad2, iOS 5.0.1)
    The only solution I found so far, is jailbraking the device and use "Display out". But I don't want to jailbrake my device. There should be a native option for this.

    "Tap" means, where you place your finger on the display.
    E.g. I present an app and want the audience to see, which icons or buttons I use.
    There should be a highlight or circle around that position I touched.
    Furthermore it would be great, if other gestures like swipe or pinch could be shown.

  • How to Make all Layers Visible in Final Photo?

    Hello, I'm new at PS and CS5. While retouching a portrait, I've created 5 layers. When the eye is open on all layers in the layers palette the only layer that seems to be active is the one on top of the list. If I move a different layer to the top, then that layer is active and the others, even though marked active, are not visible in the actual photo. I tried merging all the layers and there was no difference. What am I missing? Thanks.

    If you're duplicating a layer to make changes, then you are duplicating all the pixels on that layer.  I don't know why a tutorial might suggest that, except perhaps to give you a point to go back to if something goes wrong.  It's important to note that such a layer, assuming you keep it at 100% opacity, will completely occlude all layers below it.
    A similar technique which builds upon lower layers and does involve all layers being visible is this:
    1.  Create a new, completely transparent layer.
    2.  Use tools such as Clone, Fill, Paint, etc. to draw on the transparent layer (setting them to sample from layer(s) below).
    In this fashion you can have the entire original image intact, yet create a derivative work that involves layers that have just the changes on them.
    Again, the key here is opacity.  If a layer is transparent (or partially transparent, or parts of it are transparent), you can see through it to information from layer(s) below.
    If a layer is 100% opaque and there are no "holes" erased in it or masked from it, then any layers underneath are not participating in the look of the image.  But they may still be there to provide you a handy reference for what the image looked like before changes, etc.
    -Noel

  • How to make all columns visible in an interactive report by default

    Hello All,
    I have an interactive report with the first column is visible and the rest are hidden by default. Is there any way that i can make them all visible by default so the users do not have to go into actions to display them in report?
    Thank you
    Sezer

    Login as developer > run the interactive report > actions > select all columns you want
    Now got to actions > save > default > primary > apply
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21674/ir_using.htm#CHDFDFJA

  • Captivate 6 - Trying to make all click boxes not visible in output

    Adobe Captivate 6 - how do you make all the click boxes not visible in output.  Help says to uncheck the Visible in Output box, easy enough, then it say to click the Apply to all icon and there is no such icon.  Do I have to go through every single slide and manually do each one?

    Hello and welcome to the forum,
    I think you want to 'hide' the click box, so that it is not active, in the Properties panel? A click box itself is never visible to the user on the stage, but can be active or not.
    I always copy/paste an invisible object, it will keep its properties. Since a click box has no style, you cannot apply a style to all click boxes.
    Lilybiri

  • Please assist. How can I make all the photos on my Iphone visible? and not only the recently added ones? I'm using IOS 8

    Please assist. How can I make all the photos on my Iphone visible? and not only the recently added ones? I'm using IOS 8

    Did you move to iOS 8 via iTunes?  Your photos should all be on your iPhone 5s without any issues even if you updated via WiFi.  The update should have no impact on your photos other than to have moved any photos in your former Camera Roll to your Photos.  When opening the Photo App you should see Photos and Albums available at the bottom of the screen.  You can also look at Settings>General>About and looking down the list your should see the word Photos and a Count at the right.  This count should represent all of the photos in your iPhone.

  • Individual leaf icons in JTree

    is it possible to for different leaves in the same tree to have different icons?
    I tried this code:
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Actors");
            File dir = new File("images\\actors\\");
            int i = 0;
            DefaultMutableTreeNode actorChild;
            String[] fileArray = dir.list();
            while (i < dir.listFiles().length){
                ImageIcon icon = new ImageIcon(getClass().getResource("images\\actors\\" + fileArray));
    DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
    renderer.setLeafIcon(icon);
    actorChild = new DefaultMutableTreeNode(fileArray[i]);
    root.add(actorChild);
    i++;
    actorTree.setCellRenderer(renderer);
    DefaultTreeModel t = new DefaultTreeModel(root);
    actorTree.setModel(t);
    However as you can see it merely sets all leaf icons to the last  value from the last iteration of the loop.
    any info appreciated :)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    This is my latest attempt, but it still doesnt work, it just makes the icon for the last item in the jtree.
    I cant figure out what im doing wrong here, any ideas?
    class CustomIconRenderer  extends JLabel implements TreeCellRenderer {
        String[] fileArray;
        CustomIconRenderer(String[] fileArray){
            this.fileArray = fileArray;
        public Component getTreeCellRendererComponent(JTree tree,
                Object value, boolean sel, boolean expanded, boolean leaf,
                int row, boolean hasFocus) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
            Object obj = node.getUserObject();
            String nodeName = obj.toString();
            setText(nodeName);  // set the text
            int i = 0;
            while (i < fileArray.length){
              if (nodeName.endsWith(fileArray)){
    Icon icon = new ImageIcon(getClass().getResource("images\\actors\\"+ nodeName));
    setIcon(icon);
    else{
    setIcon(null);
    i++;
    return this;

  • How do I fix my left shift key? Any open windows leave and make the desktop visible.

    How do I fix my left shift key? Any open windows leave and make the desktop visible. I have tired to go into system preferences and reset all of the keyboard settings to default but the issue hasn't gone away.

    You are not running as administrator, I think, which may be required and the only way to properly work and register. Also check for compatibility mode settings, UAC and DEP, all of which may require to be adjusted for a legacy app like PS CS2 to run properly. Also turn off Aero and switch to a conventional visual theme. The brush issue may be related to that or is a more generic problem with your graphics card and mouse config, but since you didn't provide any info on that, it will be hard for anyone to advise.
    Mylenium

  • How to make the library visible IN AN EXTERNAL disk?

    Hello.
    Searched this forum (found about 25 identical questions and answers "how to make the library visible").
    I turned mine and it is constantly visible now.
    Before installing Lion made a bootable image.
    When I connect the external HD, I see it in the Finder side bar, click on users>myname and the library folder doesn't show up.
    Tried the 3 ways to make it visible but they all bring back and show the Lion's library on my MBP, not the one in the external HD.
    Any ideas?
    (BTW, I am just an "amateur user", not too heavy, so just, please take in consideration that if you explain to me slowly I will understand quicly)...
    Thanks in advance.
    Saul

    Thank you Baltwo.
    Don't I know you from CCC? (If judging from your answer I do, always hit the nail in the head)...
    Yes, I guess I used the wrong terminology. Anyway, I did a bootable disk/image/clone, however it's called, with CCC (Carbon Copy Cloner), which BTW I am using for at least 3 years and saved several times my behind.
    So, if I understood you right, you mean booting from my external HD and make the library visible (I don't remember if the clone was made after installing Lion or still while in Snow L, but will check).
    I'll try and update here if it worked.
    Thanks again and have a good evening.
    Saul

  • How to dislay a frame when i clck on the node or leaf on the JTree

    Hi All,
    Iam doing project on swing. In that iam doing with JTree. The Jtree is displaying on the left side of the splitpane .My problem is if i click on the nodes or leaf in the JTree one panel should be open in on the right side of the spltpane. Iam pasting the code.please can any body knows the solution please send me.
    regards
    sonali
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.BorderFactory;
    import javax.swing.border.*;
    import java.awt.event.*;
    import javax.swing.tree.*;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.tree.TreeSelectionModel;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import java.net.URL;
    import javax.swing.*;
    import java.io.IOException;
    import javax.swing.JEditorPane;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    import javax.swing.JFrame;
    import Test.Test1;
    public class JFrame1 extends javax.swing.JFrame {
    JScrollPane sp;
    JPanel topPanel;
    JPanel leftPanel;
    JPanel bottomPanel;
    JPanel rightPanel;
    Border b ;
    JTree tree;
    DefaultTreeModel treeModel;
         public JFrame1(){
              getContentPane().setLayout(null);
              setSize(405,305);
              setVisible(false);
              JPanel1.setLayout(null);
              getContentPane().add(JPanel1);
              JPanel1.setLayout(new GridLayout(1, 1));
              JPanel1.setBounds(0,0,405,305);
              JPanel1.add(JSplitPane1);
              JSplitPane1.setBounds(0,5,405,305);
              JSplitPane1.setContinuousLayout(false);
              topPanel = new JPanel();
              leftPanel = new JPanel();
              bottomPanel = new JPanel();
              topPanel.setLayout(new FlowLayout());
              leftPanel.setLayout(null);
              b = new EtchedBorder();
              leftPanel.setBorder(b);
              leftPanel.setBounds(0,0,300,305);
              bottomPanel.setLayout(new FlowLayout());
              rightPanel = new JPanel();
              rightPanel.setBounds(108, 0, 300, 305);
              JSplitPane1.setRightComponent(rightPanel);
              JSplitPane1.setLeftComponent(leftPanel);
              rightPanel.setLayout(null);
              topPanel.setBounds(0,0,305,25);
              b = new EtchedBorder(0);
              topPanel.setBorder(b);
              bottomPanel.setBounds(0,26,300,280);
              b = new BevelBorder(1, Color.black,Color.black);
              bottomPanel.setBorder(b);
              rightPanel.add(topPanel);
              rightPanel.add(bottomPanel);
              JSplitPane1.setDividerLocation(120);
              DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
    DefaultMutableTreeNode subroot = new DefaultMutableTreeNode("SubRoot");
    DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode("Leaf 1");
    DefaultMutableTreeNode leaf2 = new DefaultMutableTreeNode("Leaf 2");
    DefaultMutableTreeNode leaf3 = new DefaultMutableTreeNode("Leaf 3");
    DefaultMutableTreeNode subroot1 = new DefaultMutableTreeNode("SubRoot1");
    DefaultMutableTreeNode leaf11 = new DefaultMutableTreeNode("Leaf 11");
    DefaultMutableTreeNode leaf21 = new DefaultMutableTreeNode("Leaf 21");
    DefaultMutableTreeNode leaf31 = new DefaultMutableTreeNode("Leaf 31 skfjdsf sfjfdsl fslfkjdsfl sflkjaflksdfdslfjds lfsdlkfjdslk sdsdlkfjdsla fflkdasjfdslkjal");
    DefaultMutableTreeNode subroot2 = new DefaultMutableTreeNode("SubRoot2");
    DefaultMutableTreeNode leaf12 = new DefaultMutableTreeNode("Leaf 12");
    DefaultMutableTreeNode leaf22 = new DefaultMutableTreeNode("Leaf 22");
    DefaultMutableTreeNode leaf32 = new DefaultMutableTreeNode("Leaf 32");
    treeModel = new DefaultTreeModel(root);
    tree = new JTree(treeModel);
    treeModel.insertNodeInto(subroot, root, 0);
    treeModel.insertNodeInto(leaf1, subroot, 0);
    treeModel.insertNodeInto(leaf2, root, 1);
    treeModel.insertNodeInto(leaf3, root, 2);
    treeModel.insertNodeInto(subroot1, root, 3);
    treeModel.insertNodeInto(leaf11, subroot1, 0);
    treeModel.insertNodeInto(leaf21, subroot1, 1);
    treeModel.insertNodeInto(leaf31, subroot1, 2);
    treeModel.insertNodeInto(subroot2, root, 3);
    treeModel.insertNodeInto(leaf12, subroot2, 0);
    treeModel.insertNodeInto(leaf22, subroot2, 1);
    treeModel.insertNodeInto(leaf32, subroot2, 2);
    sp = new JScrollPane();
    sp.setBounds(0,0,300,305);
    sp.getViewport().add(tree);
    sp.setViewportBorder(BorderFactory.createRaisedBevelBorder());
    leftPanel.add(sp,BorderLayout.CENTER);
    //          SymPropertyChange lSymPropertyChange = new SymPropertyChange();
    //          JSplitPane1.addPropertyChangeListener(lSymPropertyChange);
              SymWindow aSymWindow = new SymWindow();
              this.addWindowListener(aSymWindow);
              SymComponent aSymComponent = new SymComponent();
              this.addComponentListener(aSymComponent);
         public JFrame1(String sTitle)
              this();
              setTitle(sTitle);
         public void setVisible(boolean b)
              if (b)
                   setLocation(50, 50);
              super.setVisible(b);
         static public void main(String args[])
              (new JFrame1()).setVisible(true);
         public void addNotify()
              Dimension size = getSize();
              super.addNotify();
              if (frameSizeAdjusted)
                   return;
              frameSizeAdjusted = false;
              Insets insets = getInsets();
              javax.swing.JMenuBar menuBar = getRootPane().getJMenuBar();
              int menuBarHeight = 0;
              if (menuBar != null)
                   menuBarHeight = menuBar.getPreferredSize().height;
              setSize(insets.left + insets.right + size.width, insets.top + insets.bottom + size.height + menuBarHeight);
         boolean frameSizeAdjusted = false;
         javax.swing.JPanel JPanel1 = new javax.swing.JPanel();
         javax.swing.JSplitPane JSplitPane1 = new javax.swing.JSplitPane();
         /*class SymPropertyChange implements java.beans.PropertyChangeListener{
              public void propertyChange(java.beans.PropertyChangeEvent event){
                   Object object = event.getSource();
                   if (object == JSplitPane1)
                        JSplitPane1_propertyChange(event);
    /*     void JSplitPane1_propertyChange(java.beans.PropertyChangeEvent event){
         System.out.println("!");
         sp.setSize((int)JSplitPane1.getLeftComponent().getBounds().getWidth()-2,(int)JSplitPane1.getLeftComponent().getBounds().getHeight()-2 );
         sp.repaint();
         tree.repaint();
         class SymWindow extends java.awt.event.WindowAdapter{
              public void windowActivated(java.awt.event.WindowEvent event){
                   Object object = event.getSource();
                   if (object == JFrame1.this)
                        JFrame1_windowActivated(event);
              public void windowIconified(java.awt.event.WindowEvent event){
                   Object object = event.getSource();
                   if (object == JFrame1.this)
                        JFrame1_windowIconified(event);
         void JFrame1_windowIconified(java.awt.event.WindowEvent event){
         void JFrame1_windowActivated(java.awt.event.WindowEvent event){
         class SymComponent extends java.awt.event.ComponentAdapter{
              public void componentShown(java.awt.event.ComponentEvent event){
                   Object object = event.getSource();
                   if (object == JFrame1.this)
                        JFrame1_componentShown(event);
              public void componentResized(java.awt.event.ComponentEvent event){
                   Object object = event.getSource();
                   if (object == JFrame1.this)
                        JFrame1_componentResized(event);
         void JFrame1_componentResized(java.awt.event.ComponentEvent event){
         System.out.println("!!");
              JPanel1.setSize(this.getContentPane().getMaximumSize());
              JSplitPane1.setSize((int)JPanel1.getMaximumSize().getWidth()-5,(int)JPanel1.getMaximumSize().getHeight()-5 );
              topPanel.setBounds(0, 0, rightPanel.getWidth()-3, 25);
              bottomPanel.setBounds(0,26,rightPanel.getWidth()-3,rightPanel.getHeight()-28);
              sp.setSize((int)leftPanel.getMaximumSize().getWidth(),(int)leftPanel.getMaximumSize().getHeight());
         sp.setAutoscrolls(true);
         //sp.setSize((int)JSplitPane1.getLeftComponent().getBounds().getWidth()-2,(int)JSplitPane1.getLeftComponent().getBounds().getHeight()-2 );
         sp.repaint();
         //sp.setSize((int)leftPanel.getSize().getWidth(),(int)leftPanel.getSize().getHeight() );
         void JFrame1_componentShown(java.awt.event.ComponentEvent event){
         System.out.println("!!!");
              JPanel1.setSize(this.getContentPane().getMaximumSize());
              JSplitPane1.setSize((int)JPanel1.getMaximumSize().getWidth()-5,(int)JPanel1.getMaximumSize().getHeight()-5 );
              topPanel.setBounds(0, 0, rightPanel.getWidth()-3, 25);
         sp.setSize((int)JSplitPane1.getLeftComponent().getBounds().getWidth()-2,(int)JSplitPane1.getLeftComponent().getBounds().getHeight()-2 );
         sp.repaint();
              bottomPanel.setBounds(0,26,rightPanel.getWidth()-3,rightPanel.getHeight()-28);
    }

    hi sculz,
    i develped the tree, and tree selection listener also the 4 th point i didnt able to do . here is the code belo what i did.
    iam not able to add the JSplit pane also.
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class Tree08 extends JFrame{
    Hashtable theHashtable = new Hashtable();
    int frameWidth = 300;
    int frameHeight = 305;
    int numberRows = 19;
    JTree tree;
    JPanel treePanel;
    String plafClassName =
    "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
    For future reference, the three plaf implementations
    are:
    com.sun.java.swing.plaf.metal.MetalLookAndFeel
    com.sun.java.swing.plaf.motif.MotifLookAndFeel
    com.sun.java.swing.plaf.windows.WindowsLookAndFeel
    JLabel display;
    public static void main(String args[]) {
    new Tree08();
    public Tree08 () {
    theHashtable.put("Cabbage","Good in slaw");
    theHashtable.put("Squash","The yellow variety");
    theHashtable.put("Onion","Not too hot");
    theHashtable.put("Squirrel","Likes to store nuts");
    theHashtable.put("Rabbit","Runs fast");
    theHashtable.put("Fox","Crazy like a ...");
    theHashtable.put("Horse","Fun to ride");
    theHashtable.put("Pig","Lives in mud");
    theHashtable.put("Cow","Gives us milk");
    theHashtable.put("Peach","From Georgia");
    theHashtable.put("Grape","Saueeze into wine");
    theHashtable.put("Apple","Red delicious");
    theHashtable.put("Orange","Very juicy");
    DefaultMutableTreeNode[] theTreeNodes = new
    DefaultMutableTreeNode[numberRows];
    theTreeNodes[0] = new DefaultMutableTreeNode("Sample
    Tree");
    theTreeNodes[1] = new
    DefaultMutableTreeNode("Vegetables");
    theTreeNodes[2] = new
    DefaultMutableTreeNode("Cabbage");
    theTreeNodes[3] = new
    DefaultMutableTreeNode("Squash");
    theTreeNodes[4] = new
    DefaultMutableTreeNode("Onion");
    theTreeNodes[5] = new
    DefaultMutableTreeNode("Animals");
    theTreeNodes[6] = new
    DefaultMutableTreeNode("Forrest");
    theTreeNodes[7] = new
    DefaultMutableTreeNode("Squirrel");
    theTreeNodes[8] = new
    DefaultMutableTreeNode("Rabbit");
    theTreeNodes[9] = new DefaultMutableTreeNode("Fox");
    theTreeNodes[10] = new
    DefaultMutableTreeNode("Farm");
    theTreeNodes[11] = new
    DefaultMutableTreeNode("Horse");
    theTreeNodes[12] = new DefaultMutableTreeNode("Pig");
    theTreeNodes[13] = new DefaultMutableTreeNode("Cow");
    theTreeNodes[14] = new
    DefaultMutableTreeNode("Fruit");
    theTreeNodes[15] = new
    DefaultMutableTreeNode("Peach");
    theTreeNodes[16] = new
    DefaultMutableTreeNode("Grape");
    theTreeNodes[17] = new
    DefaultMutableTreeNode("Apple");
    theTreeNodes[18] = new
    DefaultMutableTreeNode("Orange");
    theTreeNodes[0].add(theTreeNodes[1]);
    theTreeNodes[1].add(theTreeNodes[2]);
    theTreeNodes[1].add(theTreeNodes[3]);
    theTreeNodes[1].add(theTreeNodes[4]);
    theTreeNodes[0].add(theTreeNodes[5]);
    theTreeNodes[5].add(theTreeNodes[6]);
    theTreeNodes[6].add(theTreeNodes[7]);
    theTreeNodes[6].add(theTreeNodes[8]);
    theTreeNodes[6].add(theTreeNodes[9]);
    theTreeNodes[5].add(theTreeNodes[10]);
    theTreeNodes[10].add(theTreeNodes[11]);
    theTreeNodes[10].add(theTreeNodes[12]);
    theTreeNodes[10].add(theTreeNodes[13]);
    theTreeNodes[0].add(theTreeNodes[14]);
    theTreeNodes[14].add(theTreeNodes[15]);
    theTreeNodes[14].add(theTreeNodes[16]);
    theTreeNodes[14].add(theTreeNodes[17]);
    theTreeNodes[14].add(theTreeNodes[18]);
    treePanel = new TreePanel(theTreeNodes[0]);
    tree.addTreeSelectionListener(new MyTreeListener());
    Container content = getContentPane();
    content.add(treePanel,BorderLayout.CENTER);
    display = new JLabel("Display Selection Here");
    content.add(display,BorderLayout.SOUTH);
    setSize(frameWidth, frameHeight);
    setTitle("Copyright 1998, R.G.Baldwin");
    setVisible(true);
    this.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);}
    class MyTreeListener implements TreeSelectionListener{
    public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode theNode =
    (DefaultMutableTreeNode)
    (e.getPath().getLastPathComponent());
    if (theNode.isLeaf()) {
    display.setText((String)theHashtable.get(
    theNode.getUserObject()));
    class TreePanel extends JPanel {
    public TreePanel(TreeNode root){
    setLayout(new BorderLayout());
    tree = new JTree(root);
    JScrollPane sp = new JScrollPane(tree);
    add(sp, BorderLayout.CENTER);
    try{
    UIManager.setLookAndFeel(plafClassName);
    }catch(Exception ex){System.out.println(ex);}
    SwingUtilities.updateComponentTreeUI(this);
    for(int cnt = 0; cnt < numberRows; cnt++){
    tree.expandRow(cnt);
    regards
    sonali

  • A script to make all page references into hyperlinks

    Hi,
    I have a customer request to make all pages references into hyperlinks.
    For example: when you see in the text of the PDF "page 4", you can click on it and move to page 4. This of course can be done manually with InDesign. The problem starts when you have whole load of them. In addition to that, I have this project as a book, with several different documents...
    I used the script "Automatic hyperlink of each word in a file" from http://www.nobrainer.dk/automatic-hyperlink-of-each-word-in-a-file/ as a base, and modified it for my porpuse. Currently it still produces errors. Any idea what's the bug?
    if (app.documents.length > 0) {
    var myDocument = app.activeDocument;
    var myHyperlinkStyle = myDocument.characterStyles.item("hyperlink"); // replace hyperlink with name of your char style for links
    //alert(myHyperlinkStyle);
    main();
    } else {
    alert("Please open a document");
    function main() {
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    //the value to find
    myFindVal = "page (\\d+)";
    doSearchAndReplace(myFindVal, app.activeDocument);
    // reset search
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    function doSearchAndReplace(stringfind, searchin) {
    app.findGrepPreferences.findWhat = stringfind;
    //Set the find options.
    app.findChangeGrepOptions.includeFootnotes = true;
    app.findChangeGrepOptions.includeHiddenLayers = false;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = false;
    var myFoundItems = searchin.findGrep();
    for (i = 0; i < myFoundItems.length; i++) {
    var item = myFoundItems[i].contents;
    //the destination page
    var destPage = item.slice(5);
    var myHyperlinkDestination = myMakeHyperlinkDestination(destPage);
    myMakeHyperlink(myFoundItems[i], myHyperlinkDestination);
    myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);
    function myMakeHyperlink(myFoundItem, myHyperlinkDestination){
    try {
    var myHyperlinkTextSource = myDocument.hyperlinkTextSources.add(myFoundItem);
    var myHyperlink = myDocument.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);
    myHyperlink.visible = false;
    catch(myError){
    function myMakeHyperlinkDestination(myDestPage){
    //If the hyperlink destination already exists, use it;
    //if it doesn't, then create it.
    try{
    var myHyperlinkDestination = myDocument.hyperlinkDestinations.item(myDestPage);
    myHyperlinkDestination.name;
    catch(myError){
    myHyperlinkDestination = myDocument.hyperlinkPageDestinations.add(myDestPage);
    myHyperlinkDestination.destinationPage = myDestPage;
    myHyperlinkDestination.name = myDestPage;
    //Set other hyperlink properties here, if necessary.
    return myHyperlinkDestination;

    well, after some more digging into it, I found the bugs and corrected, here is the corrected version (now I only need to figure out how to do it on an entire book...):
    if (app.documents.length > 0) {
    var myDocument = app.activeDocument;
    var myHyperlinkStyle = myDocument.characterStyles.item("hyperlink"); // replace hyperlink with name of your char style for links
    //alert(myHyperlinkStyle);
    main();
    } else {
    alert("Please open a document");
    function main() {
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    //the value to find
    myFindVal = "page (\\d+)";
    doSearchAndReplace(myFindVal, app.activeDocument);
    // reset search
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    function doSearchAndReplace(stringfind, searchin) {
    app.findGrepPreferences.findWhat = stringfind;
    //Set the find options.
    app.findChangeGrepOptions.includeFootnotes = true;
    app.findChangeGrepOptions.includeHiddenLayers = false;
    app.findChangeGrepOptions.includeLockedLayersForFind = false;
    app.findChangeGrepOptions.includeLockedStoriesForFind = false;
    app.findChangeGrepOptions.includeMasterPages = false;
    var myFoundItems = searchin.findGrep();
    for (i = 0; i < myFoundItems.length; i++) {
    var item = myFoundItems[i].contents;
    //the destination page
    var destPageNumber = item.slice(5);
    var destPage = searchin.pages.itemByName(destPageNumber);
    var myHyperlinkDestination = myMakeHyperlinkDestination(destPage);
    myMakeHyperlink(myFoundItems[i], myHyperlinkDestination);
    myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);
    function myMakeHyperlink(myFoundItem, myHyperlinkDestination){
    try {
    var myHyperlinkTextSource = myDocument.hyperlinkTextSources.add(myFoundItem);
    var myHyperlink = myDocument.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);
    myHyperlink.visible = false;
    catch(myError){
    function myMakeHyperlinkDestination(myDestPage){
    //If the hyperlink destination already exists, use it;
    //if it doesn't, then create it.
    try{
    var myHyperlinkDestination = myDocument.hyperlinkDestinations.item(myDestPage);
    myHyperlinkDestination.name;
    catch(myError){
    myHyperlinkDestination = myDocument.hyperlinkPageDestinations.add(myDestPage);
    myHyperlinkDestination.destinationPage = myDestPage;
    //myHyperlinkDestination.name = myDestPage.name;
    //Set other hyperlink properties here, if necessary.
    return myHyperlinkDestination;

  • Can you explain me clearly how to make company code visible in cost center

    can you explain me clearly how to make company code visible in cost center master data using tcode kmlv

    Hi,
    There is no way to activate the company code field. If your Controlling Area and Company Code have one to one Assignment, then Company code is defaulted from the Controlling Area. However, if multiple Company Codes are assigned to one Controlling Area, then Company Code becomes a mandatory field in the Cost Center master data
    Also, in case you have multiple company codes assigned to one controlling area, please check the setting of the Controlling Area in Configuration and see if have selected "Cross Company Code Cost Accounting" . Also, check if you have assigned all the company codes to the controlling area
    Regards
    Mahendra

  • Why can't Apple make all ipads brightness to be settable to the dimmest just like in ibooks ?

    I don't understand why a brillant number one company in the world - apple cannot make all it's generation of ipads to be more dimmer than the current lowest brightness setting level , to be just like the lowest brightness settable in ibooks ?  Do they know that some ipad users around the world like me can find it to be too bright for my eyes , in fact it's hurting and painful just to look at ipad for a mere few minutes even when it's at the dimmest . I hope the ios engineers will listen to users like me and make it happen .

    jimmsw wrote:
    I don't understand why a brillant number one company in the world - apple cannot make all it's generation of ipads to be more dimmer than the current lowest brightness setting level , to be just like the lowest brightness settable in ibooks ?  Do they know that some ipad users around the world like me can find it to be too bright for my eyes , in fact it's hurting and painful just to look at ipad for a mere few minutes even when it's at the dimmest . I hope the ios engineers will listen to users like me and make it happen .
    The brightness on the iPad over all CAN be manually set. And I find it hard to believe the dimmest setting is too bright. At that setting the screen is barely visible. Perhaps you should give the user guide a read:
    http://manuals.info.apple.com/en_US/ipad_user_guide.pdf

  • Make all controls inside a Groupbox or Panel unusable without disabling them

    Hello !
    I'm using Vb.net 2013 , NET 4.0.
    I'm trying to make all the controls inside a Groupbox ( or Panel) , unusable by users if a condition is true.
    This is the code that I'm using :
    Class NW
    Inherits NativeWindow
    Public Sub New(hwnd As IntPtr)
    AssignHandle(hwnd)
    End Sub
    Const WM_NCHITTEST As Integer = &H84
    Protected Overrides Sub WndProc(ByRef m As Message)
    If m.Msg = WM_NCHITTEST Then
    Return
    End If
    MyBase.WndProc(m)
    End Sub
    End Class
    Dim nwss As List(Of NW) = Nothing
    Public Sub block_area(flag As Boolean)
    If flag = True AndAlso IsNothing(nwss) Then
    nwss = New List(Of NW)()
    For Each c As Control In GroupBox1.Controls
    nwss.Add(New NW(c.Handle))
    Next
    Else
    If flag = False And (Not IsNothing(nwss)) Then
    For Each nw As Object In nwss
    nw.ReleaseHandle()
    Next
    nwss = Nothing
    End If
    End If
    End Sub
    The problem is that this code works for all controls , except the TextBox and DateTimePicker . These 2 controls remain always clickable and editable so usable by users.
     What can I do ?
    Thank you !

    Ok , friend , if you don't like this question , you can close it anytime. Next time when I need to make a question , I will be careful to do more hard questions like : " What will be the final result of a=1  a=a+1" . This is pure VB.net ,
    I think.
    I'm sorry if it upsets you that your code will not work as intended. Everyone here is just trying to help you understand that there is no good solution to your problem from a managed code perspective in Windows Forms. The best answers are to use a different
    presentation system or to spin your own custom control at the Win32 level (or buy one from someone else who has already done all of that work). The next bester answer is to fudge it with an image that you capture and update as appropriate.
    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"
    ok , can you only give me a simple answer : What is the WM code that has to do with pressing keys from keyboards in a control ? I try to modify my code if you help me with this. Thank you !
    Hello Friend Here is my sample - very elementary, please make more good:
    Public Class clsControl
    Inherits Control
    Public actualControl As Control
    Private Property hiddenLock As Boolean = False
    Public Property lock As Boolean
    Get
    Return hiddenLock
    End Get
    Set(value As Boolean)
    If value Then
    Dim _bmp As New Bitmap(actualControl.Width, actualControl.Height)
    actualControl.DrawToBitmap(_bmp, actualControl.ClientRectangle)
    actualControl.Enabled = False
    actualControl.Visible = False Me.BackgroundImage = _bmp
    Me.Controls.Remove(actualControl)
    Else
    actualControl.Enabled = True
    actualControl.Visible = True
    Me.Controls.Add(actualControl)
    Me.BackgroundImage = Nothing
    End If
    hiddenLock = value
    End Set
    End Property
    Public Sub New(ByRef _control As Control)
    actualControl = _control
    Me.Controls.Add(actualControl)
    actualControl.Location = New Point(0, 0)
    actualControl.Visible = True
    End Sub
    End Class
    'FORM1 CODE
    Private _c As clsControl
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim _txt As New TextBox
    _txt.Size = New Size(100, 20)
    _txt.Visible = True
    _c = New clsControl(CType(_txt, Control))
    Me.Controls.Add(_c)
    _c.Size = _txt.Size
    _c.Visible = True
    End Sub
    Private Sub Form1_Click(sender As Object, e As EventArgs) Handles Me.Click
    _c.lock = Not _c.lock
    End Sub
    Enjoy friend I spent time to make it work.

  • Is it possibe to make a channel visible only to some users?

    Hi,
    I am using iPS3.0SP3a, I have LDAP authentication enabled and I want some of the JSP provider channels that I created to be visible to only some users and not all. For example: the admin channel, this channel must be visible only to the users belonging to the admin group on the ldap server.
    Any help is certainly appreciated.
    Thanks
    Sahadev

    Yes, it is possible to make the channel visible to some users alone. Though the authentication is done in LDAP, the user profiles are maintained within Portal.
    1) To remove the channels for particular users, we can put them in a role say test_role. Now goto Admin Console | Manage Domains | Domain_Name | test_role | open 'Applications' key and click 'Desktop'.
    2) Now choose the channel you want to remove, from the 'Selected Channel' lists and 'delete'. Apply the changes to all sub-roles and submit.
    3) Restart the Server for the changes to take effect.
    Similarly we can do this setting for individual users as well. Hope this helps.
    Thanks,
    Raj_indts
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

Maybe you are looking for

  • Copy Data from a System Form to another (GetByKey)

    Hi All, I 'll try the following: "After the succesful add of a specific Credit Note I want to copy the Cardcode and the Cardname (of this Credit Note) to cardcode and cardname of a Delivery Note". I tried the following code without success:          

  • Correcting 'Read only' file problem ...

    I while ago I had an HD problem. I installed a new HD, upgraded to Leopard and then brought all my old files in from an external backup. My problem is that they're all now 'Read only'. Is there a way I can solve this problem at a stroke, without havi

  • Hyperlinks for redirection in PDF's smart devices

    Hi I am using hperlinks in PDF's created in indesign, them work well on laptops and desktops to redirect to another page. But when i try to use these links on smart devices such as IOS and Android devices it tries to open another page to read it else

  • Not showing a secure connection

    in firefox 4 its not showing when im connected to a secure connection like in previous versions

  • How to make sure Bridge Mode is OFF on my new TC

    When I go into Airport Utility for my New TC, Network, Router Mode the choice is OFF(Bridge Mode). Does this mean the Bridge Mode is off?