Jtree leaf selection on jinternal frame

Hi all,
I m using a splitpane ...on left hand side i m using a tree and right side i m using a desktoppane where i'll open the internal frames...my tree leaf and internalframe title is same ...
my question is when when i select any internalframe it should select corresponding leaf(becoz my leaf and t\internalframe is same)...and same i wanna do for tree when i click in any leaf ...internal frame should actived and come to front...
pls can anyone tell me how to proceed for this...
can anyone provide me any examples ....pls help me out
regards
Tarique

Since you have a reference to a DefaultMutableTreeNode object, can't you do something like
TreeNode[] nodes = n.getPath();
TreePath path = new TreePath(nodes);
tree.setSelectionPath(path);

Similar Messages

  • JTree leaf selection

    hi guys,
    I am developing a jTree for a networking product,which will show all the network elements present in the network.The tree also shows the device status like Up,Down etc.I have provided a button to refresh the jtree to update the status of the devices.But after updating the jtree when i try to expand or setSelected path to previously selected leaf,the jTree is expanding only till the parent of the leaf.Here is the code which i have written:
    public void addRootNodes()
              TreePath path=jTree.getSelectionPath();
              DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)path.getLastPathComponent();
              TopologyUtilities.getNetworkCollectionDetails();
              TopologyUtilities.getRuntimeDataMapOnRefresh();
              initializeData();
              rootBusiness.removeAllChildren();
              rootNetwork.removeAllChildren();
              rootDiscovery.removeAllChildren();
              addRegionLocationToBusinessView();
              AddNodesToTree.addRoutersToNetworkView(configuredNetworkCollection, dataMap, rootNetwork);
              AddNodesToTree.addRoutersToDiscoveryView(discoveredNetworkCollection, configuredNetworkCollection, dataMap, rootDiscovery);
              treeModel.reload();
              panel.removeAll();
              jTree.setSelectionPath(path);
    Thanks for the help in advance
    bye,
    Srinivas

    Since you have a reference to a DefaultMutableTreeNode object, can't you do something like
    TreeNode[] nodes = n.getPath();
    TreePath path = new TreePath(nodes);
    tree.setSelectionPath(path);

  • Saving contents of jinternal frame

    Hi, I seem to have a problem saving files from jinternal frames. I created two files, the main GUI which holds the jdesktop pane and the other file (Documento) extends jinternalframe. I want to be able to save the current (active) jinternal frame but I have no idea how to do it. can anyone help me?
    import javax.swing.JInternalFrame;
    import javax.swing.JDesktopPane;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JMenuBar;
    import javax.swing.JFrame;
    import javax.swing.KeyStroke;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.Graphics.*;
    import javax.swing.JOptionPane;
    import java.io.*;
    import java.util.*;
    *This is the main GUI of the program.
    public class mainGUI extends JFrame
                                   implements ActionListener,
                                    KeyListener{
        JDesktopPane desktop;
        Documento frame;
         private Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
         private JPanel toolbar, editarea, resultarea, blankPanel;
         private JMenu file, edit, project;
         private JMenuItem f_open, f_new, f_save, f_saveas, f_exit, e_select, e_copy, e_paste, p_compile;
         private JTextArea resultfield, editfield,editArea, tstr;
         private JButton bcompile;
         private JFileChooser fc = new JFileChooser();
         private String filepath;
         private ImageIcon bugicon;
         private static int docNum = 0;
         private boolean b_openfile;
         File filename;
        public mainGUI() {
            super("DGJ Program Scanner");
            setSize(800,600);
              setLocation((screen.width-800)/2, (screen.height-600)/2);
            /*Creates the workspace*/
            desktop = new JDesktopPane();
            setContentPane(desktop);
            setJMenuBar(createMenuBar());
            /*Make dragging a little faster*/
            desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
          *This function creates the menu bar
        protected JMenuBar createMenuBar() {
             /*Initializes/instantiates the menu bar and its items*/
              file = new JMenu("File");
              edit = new JMenu("Edit");
              project = new JMenu("Project");
              f_new = new JMenuItem("Create new file");
              f_open = new JMenuItem("Open file...");
              f_save = new JMenuItem("Save current file");
              f_saveas = new JMenuItem("Save As...");
              f_exit = new JMenuItem("Exit program");
              e_select = new JMenuItem("Select All");
              e_copy = new JMenuItem("Copy selected");
              e_paste = new JMenuItem("Paste selected");
              p_compile = new JMenuItem("Scan current file for errors");
              /*Adds listeners to the menu items*/
              f_open.setActionCommand("f_open");
              f_open.addActionListener(this);
              f_save.setActionCommand("f_save");
              f_save.addActionListener(this);
              f_saveas.addActionListener(this);
              f_saveas.setActionCommand("f_saveas");
              f_new.setActionCommand("f_new");
              f_new.addActionListener(this);
              f_exit.setActionCommand("f_exit");
              f_exit.addActionListener(this);
              e_select.setActionCommand("e_select");
              e_select.addActionListener(this);
              e_paste.setActionCommand("e_paste");
              e_paste.addActionListener(this);     
              e_copy.setActionCommand("e_copy");
              e_copy.addActionListener(this);               
              /*Creates the icon of the bug*/
              bugicon = new ImageIcon("images/ladybug.gif");
              /*Creates the menu bar*/
              JMenuBar menu = new JMenuBar();
              menu.add(file);
                   file.add(f_new);
                   file.add(f_open);
                   file.add(f_save);
                   file.add(f_saveas);
                   file.add(f_exit);
              menu.add(edit);
                   edit.add(e_select);
                   edit.add(e_copy);
                   edit.add(e_paste);
              menu.add(project);
                   project.add(p_compile);
              /*Disables the save current file menu...(when program starts, no file is open yet)*/
              f_save.setEnabled(false);
              f_saveas.setEnabled(false);
            return menu;
        //React to menu selections.
        public void actionPerformed(ActionEvent e) {
            if ("f_new".equals(e.getActionCommand()))
            { //new
                createFrame(null);
                f_saveas.setEnabled(true);
            else if("f_open".equals(e.getActionCommand()))
            {//open documento
                   fc.setFileFilter(new SpanFilter());
                  int retval = fc.showOpenDialog(mainGUI.this);
                   tstr = new JTextArea();
                   /*This checks if the user has chosen a file*/
                if (retval == JFileChooser.APPROVE_OPTION) {
                    filename = fc.getSelectedFile();
                        filepath = filename.getPath();            
                        openFile(filename, new Point(30,30));       
            else if("f_save".equals(e.getActionCommand()))
                 try {
                      BufferedWriter out = new BufferedWriter(new FileWriter(filepath));
                      String str;
                      str = editArea.getText();
                      editArea.setText("");  
                      int length = str.length();
                      out.write(str, 0, length);
                      out.close();
                       } catch (Exception ex) {}
                       JInternalFrame fr = new JInternalFrame();
                       fr = desktop.getSelectedFrame();
                       Point p = fr.getLocation();
                        fr.dispose();    
                       openFile(filename, p);
            else if("f_saveas".equals(e.getActionCommand()))
                 fc.setFileFilter(new SpanFilter());
                  int retval = fc.showSaveDialog(mainGUI.this);
                if (retval == JFileChooser.APPROVE_OPTION) {
                    filename = fc.getSelectedFile();
                        filepath = filename.getPath();
                        if(!(filepath.contains(".dgj")))
                             filepath+=".dgj";
                      try {
                           BufferedWriter out = new BufferedWriter(new FileWriter(filepath));
                                String str;
                           str = editArea.getText();
                           int length = str.length();
                           out.write(str, 0, length);
                           out.close();
                       } catch (Exception ex) {}
                       Point p = frame.getLocation();
                        frame.dispose();
                   //     editArea.setText("");     
                       openFile(filename, p);
            else if("e_select".equals(e.getActionCommand()))
                 editArea.selectAll();
            else if("e_copy".equals(e.getActionCommand()))
                   editArea.copy();
            else if("e_paste".equals(e.getActionCommand()))
                 editArea.paste();
            else if("f_exit".equals(e.getActionCommand()))
            { //quit
                quit();
        public void openFile(File filename, Point p)
                        /*Reads the file*/
                        try {
                           BufferedReader in = new BufferedReader(new FileReader(filepath));
                             String str;
                             /*empties the textarea*/
                             tstr.setText("");
                             str = in.readLine();
                             /*Copy each line of the file into the temporary textarea*/
                           do{  
                          tstr.append(str);
                          str = in.readLine();
                          /* the "\n" is for the line to appear in the next line in the textarea,
                           * the "\r" is for windows system, wherein "\r" is required for the text
                           * to appear in beginning of the first line*/
                          if(str!=null)
                               tstr.append("\r\n");
                           }while (str != null);
                             /*Opens the new frame*/
                           createFrame(filename, filename.getName(), tstr.getText(), p);
                           in.close();
                       } catch (Exception ex){}
                      b_openfile = true;
                      f_save.setEnabled(true); 
                      f_saveas.setEnabled(true);   
         *Create a new internal frame.
        protected void createFrame(File f) {
             frame = new Documento(f);
         /*     frame = new JInternalFrame("Document "+(++docNum),
                  true, //resizable
                  true, //closable
                  true, //maximizable
                  true);
            docNum++;
              frame.setSize(600,400);
              frame.setLocation(20*(docNum%10), 20*(docNum%10));       
             editArea = new JTextArea();
              JScrollPane scroll = new JScrollPane(editArea);     
              editArea.addKeyListener(this);
              editArea.append("");
              frame.add(scroll);
            frame.setVisible(true); //necessary as of 1.3
            desktop.add(frame);
            try {
                frame.setSelected(true);
            } catch (java.beans.PropertyVetoException e) {}
          *Overwrite an existing internal frame for an open file
        protected void createFrame(File f, String title, String text, Point P) {
             frame = new Documento(title, f, P);
              frame.setSize(600,400);
              frame.setLocation(P); 
             editArea = new JTextArea();
              JScrollPane scroll = new JScrollPane(editArea);     
              editArea.setText("");
              editArea.addKeyListener(this);
              editArea.append(text);
              frame.add(scroll);
            frame.setVisible(true); //necessary as of 1.3
            desktop.add(frame);
            try {
                frame.setSelected(true);
            } catch (java.beans.PropertyVetoException e) {}
        //Quit the application.
        protected void quit() {
            System.exit(0);
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
        private static void createAndShowGUI() {
            //Make sure we have nice window decorations.
            //JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            mainGUI frame = new mainGUI();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Display the window.
            frame.setVisible(true);
        public void keyTyped(KeyEvent k){}
        public void keyPressed(KeyEvent k)
             if(k.getKeyCode()==10)
                  editArea.append("\r");           
        public void keyReleased(KeyEvent k){}
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }here's the one that extends jinternalframe
    import javax.swing.JInternalFrame;
    import javax.swing.plaf.InternalFrameUI;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.util.*;
    /* Used by mainGUI.java */
    public class Documento extends JInternalFrame {
        static final int xOffset = 30, yOffset = 30;
         static JTextArea editArea;
         static int docNum = 0;
         static File file;
          *The constructer for a new documento
        public Documento(File file) {
            super("Document "+(++docNum),
                  true, //resizable
                  true, //closable
                  true, //maximizable
                  true);//iconifiable
            docNum++;
              this.file = file;
              setSize(600,400);
              setLocation(xOffset*(docNum%10), yOffset*(docNum%10));
    //        setUI(new InternalFrameUI());
         *The constructor for an existing documento
        public Documento(String title, File file, Point p) {
            super(title,
                  true, //resizable
                  true, //closable
                  true, //maximizable
                  true);//iconifiable
              this.file = file;             
              setSize(600,400);          
              setLocation(p);
    //        setUI(new InternalFrameUI());
        public int getNum()
             return docNum;
        public File getPath()
             return file;
    }I know it's pretty lengthy...it's probably all messed up since I'm lost :p
    Thanks if you could help me!

    I would be glad to help, but first I need a clarification. If I understand properly, you have two Java classes that you have created: the "main GUI" (which is most likely a JFrame extension in which the constructor adds a JDesktopPane to the content pane) and "Documento" (which you say is a JInternalFrame extension).
    My question is this: what do you mean by "save the current JInternalFrame"? Do you want to record its position, location, and identity? Do you want to save its contents?
    Thanks. Good luck. ;)

  • Selecting a Text Frame in another file (JS/CS3)

    Hi, I'm a newbie so this is probably a dumb question.
    I'm trying to copy the contents of a text frame in another ID file and copy/paste them into another text frame of my active document. Every example I find creates a NEW text frame and copies it and they work fine but I'm having trouble selecting the text frame or its contents (it's the only object in the document) in the already existing document.
    The section I'm struggling with is:
    var mySourceSlugDocument = app.open(File("/Macintosh HD/Users/Shared/Testfile.indd"));
    var mySourceSlugPage = mySourceSlugDocument.pages.item(0);
    var mySourceSlugFrame = mySourceSlugPage.pages.item(0);
    app.select(mySourceSlugFrame.parentStory.texts.item(0));
    app.copy();
    app.activeDocument.close();
    I'm doing something wrong here. It doesn't like the 'parentStory' in the select line. I'd be happy with a way of just doing a 'select all' and being able to paste it into the new document with a variable name so I can edit it.
    Cheers,
    G.

    I think the third line should be:
    var mySourceSlugFrame = mySourceSlugPage.textFrames.item(0);
    Note though that you don't actually need to select/copy/paste. You can use duplicate().
    Dave

  • How to select all the frames in a document?

    i did select only particular active session.is it possible to select all the frames in a document?

    Hi vinothvijay,
    You can use below interface to select all the frames in the document.
    ISelectionManager* selMgr = Utils<ISelectionUtils>()->GetActiveSelection();
    if(selMgr)
       selMgr->SelectAll(ac,nil);
    Regards,
    Santosh K.

  • Right mouse button click in a JTree leaf

    Hi,
    how can I add a mouse listener in a JTree leaf? I have DOM nodes wrapped and a JTree model adapter to set up the JTree. I want the popup menu to show everytime the user clicks on a leaf, but not on the tree itself.
    Thanks!

    Really you just have to add your listener to the tree itself, then use the Point to find the corresponding TreePath (getPathForLocation), from which you'll easily find the node.

  • How to execute windows application in Jinternal frame

    I want to execute windows application in a JInternal Frame ?

    Attach an EventListener and
    try{ Runtime.getRuntime().exec("C:\\Program Files\\Outlook Express\\ ..."); }
              catch(Exception e){}

  • How to select a text frame that has been "Sent to Back"?

    Hi Framers,
    In FM 7.2 (all patches up to date, running on Windows XP Pro), I added a note inside a text frame next to an anchored frame holding an image. I nudged the text frame close to the image but it blocked out a tiny portion of the image. So I selected the text frame and from the Graphics menu clicked Send to Back.  Solved that problem, of course. Now I want to change the wording in the note but can't do it because the entire text frame has been sent to back -- how can I select it to Bring to Front so I can edit its contents???
    This MUST be something totally obvious, right?  Can I plead pre-holiday brain freeze?
    TIA,
    Gay

    galson wrote:
    Hello again, Sheila ;~)
    I selected all and moved my cursor all around the page (around various pages, actually, since Ctrl+A selects the entire chapter), and I see what you mean by the color of the arrow's head changing between black and white. Is it significant that the ONLY time it's black is when I'm outside the frame of the page itself? (That is, in the white, non-editable space around the actual frame borders on the page.) Clicking anywhere, whether inside or outside the active area, deselects everything.
    HOLD THE PRESSES!  Even though I *knew* I hadn't grouped my text frame with anything else, after reading your suggestion, I selected the page frame to make sure I hadn't somehow grouped it with my text frame: I hadn't -- but then, on a hunch, I sent IT (the page frame) to the back -- now I can select the text frame!
    I'm marking your response as answering my question and I'm also going to try to mark Peter's the same way, because each of you in your own way, helped me resolve this problem.
    Thank you both and HAPPY HOLIDAYS!  (Gee, and I didn't get either of you anything... maybe next year  ;~))
    Gratefully,
    Gay
    Hi, Gay:
    The "I-Beam" pointer tool is called the Smart Pointer, because it changes to an I-beam when it's over text, and to the Graphics Pointer tool when over a graphic, or part of a graphic, or when you press Ctrl. It's easy to select the main text frame when you Ctrl+click on its interior text area inadvertently, when you're trying to select an anchored frame edge, or when you use Ctrl+A to select all. It's frustrating to have some of these unintended events happen when you're not expecting them. Always work with View > Borders ON, to display the edges of objects and reduce confusion, and always watch where you click. You can zoom iin to large magnification to see things better.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Indesign CC crashes when I select the rectangle frame tool??  Its a custom page, tabloid with guides set.

    My indesign crashes when I select the rectangle frame tool.  Does it matter if its a custom doc set as a tabloid and guide lines?  I have a project due and all I'm trying to do is add a picture I took.

    See Replace Your Preferences

  • Gridbag layout error at "new/select database connection" frame

    Hi,
    I'm running SQLDev at Win XP sp 2.
    When I expands the "new/select database connection" frame it behaves really strange and the top left pane becomes smaller instead of bigger! :-) This makes it impossible to see and reach all connection settings.
    Just a GUI-bugg - but annoying and probably one of first experiencies new users will have of SQLDev...
    best regards and keep up the good work
    /Robert, Karlstad

    Hi,
    You don't say if you actually have a local database installed. If not, you need too. If you already do, then the most common case is Oracle 10g or 11g Express Edition. In that case the default SID is XE, as noted in the following similar thread:
    Re: Connecting to Oracle Database 10g Express Edition
    If you need to install a database, you can get 10g or 11g XE here:
    http://www.oracle.com/technetwork/database/express-edition/downloads/index.html
    The 10g XE release has a smaller memory and disk footprint if that makes a difference to you.
    Regards,
    Gary
    SQL Developer Team

  • JInternal frames.. please help

    Hi All,
    Can anyone tell me how to set JInternal frames as unmovable?
    I want to add it to a content pane and not alow the users to move it around,..
    Thanks

    hi,
    if i had to do the same i'd have followed the below coding.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.MouseEvent;
    public class Test extends JInternalFrame {
       // location variables to set the initial
       // location of the internalframe
       private int x;
       private int y;
       public Test(int x, int y)
          super("Sample", true, true, true, true);
          this.x = x;
          this.y = y;
          setLocation(Integer.MIN_VALUE, Integer.MAX_VALUE);
       public Test(Point loc)
          this(loc.x, loc.y);
       public Test()
          this(0, 0);
       /* Overriden method.
        * If this does'nt work then comment this method & uncomment
        * processMouseMotionEvent(MouseEvent) method.
       public void setLocation(int x, int y)
          super.setLocation(this.x, this.y);
       /* Overriden method.
        * If this does'nt work then comment this method & uncomment
        * processMouseMotionEvent(MouseEvent) method.
       public void setLocation(Point p)
          super.setLocation(this.x, this.y);
       public static void main(String args[])
          Test test = new Test();
          test.setSize(300, 300);
          JFrame frame = new JFrame("ATest");
          JDesktopPane pane = new JDesktopPane();
          frame.setContentPane(pane);
          pane.add(test);
          frame.pack();
          frame.show();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       /* Overriden method.
        * If the above setLocation methods does'nt stand to your
        * expectations, then you may try with the following method.
        * Note: You may risk the mouse dragging feature if you are
        *       implementing mouse dragging feature in the internal frame.
    /*   protected void processMouseMotionEvent(MouseEvent e)
          if(e.getID() == MouseEvent.MOUSE_DRAGGED)
             e.consume();
          } else
             super.processMouseMotionEvent(e);
    }though i've'nt tested the code, it should work smoothly. there might be more easier way to achieve what you want.
    hope this helps you,
    regards,
    Afroze.

  • How to add scrollbar to the JInternal Frame

    How to add scrollbar to JInternal Frame?
    I have One JInternal frame i want it should have a scrollbar when we reduces its size.

    [url http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html]How to Use Scroll Panes

  • JTree Nimbus selection treeNode

    I made a jtree with a custom TreeCellRenderer. The leaf nodes are a jpanel with a checkbox in and JPanel. The problem now is that when you select a tree node, there is a selection color box beside the jpanel.
    Here is a sscce:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTree;
    import javax.swing.UIManager;
    import javax.swing.UIManager.LookAndFeelInfo;
    import javax.swing.UnsupportedLookAndFeelException;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    public class Users {
        private static JFrame frame;
        private static JPanel usersPanel;
        private JTree usersTree;
        public Users(){
            usersPanel = new JPanel();
            DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Gebruikers");
            DefaultMutableTreeNode willie = new DefaultMutableTreeNode("Willie");
            DefaultMutableTreeNode Anna = new DefaultMutableTreeNode("Anna");
            rootNode.add(willie);
            rootNode.add(Anna);
            usersTree = new JTree(rootNode);
            myTreeWithCheckBoxRenderer renderer = new myTreeWithCheckBoxRenderer();
            usersTree.setCellRenderer(renderer);
            usersTree.setRootVisible(true);
            usersTree.setEditable(false);
            usersTree.setOpaque(false);
            usersPanel.add(usersTree);
        class myTreeWithCheckBoxRenderer extends DefaultTreeCellRenderer {
            DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
            JPanel panel;
            JCheckBox checkBox;
            JLabel label;
            public myTreeWithCheckBoxRenderer() {
                checkBox = new JCheckBox();
                label = new JLabel("Gebruikers");
                panel = new JPanel(new BorderLayout());
                panel.add(checkBox, BorderLayout.WEST);
                panel.add(label, BorderLayout.EAST);
                panel.setBackground(Color.red);
            @Override
            public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
                Component returnValue;
                if(!leaf){
                    renderer.setBackgroundSelectionColor(null);
                    renderer.setText("Gebruikers");
                    returnValue = renderer;
                else{
                    if(hasFocus){
                        panel.setBackground(Color.blue);
                    returnValue = panel;
                return returnValue;
        private static void createAndShowGUI(){
            new Users();
            frame = new JFrame("Tree");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setContentPane(usersPanel);
            frame.pack();
            frame.setPreferredSize(new Dimension(800, 600));
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
         public static void main (String[] args){
            try {
                for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        UIManager.setLookAndFeel(info.getClassName());
                        break;
            } catch (UnsupportedLookAndFeelException e) {
                // handle exception
            } catch (ClassNotFoundException e) {
                // handle exception
            } catch (InstantiationException e) {
                // handle exception
            } catch (IllegalAccessException e) {
                // handle exception
            javax.swing.SwingUtilities.invokeLater(new Runnable(){
                @Override
                public void run(){
                    createAndShowGUI();
    }I tried using a DefaultTreeCellRenderer and use the setBackgroundSelectionColor() method to null, but it doesn't change anything. Also setting the background of the JPanel to null doesn't make a change when you check with (if(hasFocus)). However I have the impression that nimbus is causing the problem, because if you comment the nimbus part out, you don't have the selection box anymore.
    Does anyone has an idea to solve this?
    Edited by: Kligham on 30-aug-2010 19:25

    Kligham wrote:
    Thank you very much!You're welcome.
    Kligham wrote:
    Problem solved. So since this cell background rendering is a Nimbus "feature", can I assume that the "not displaying of angled lines" also is a Nimbus "feature". Since the JTree tutorial says this should do the trick:
    usersTree.putClientProperty("JTree.lineStyle", "Angled");So I probably have to override it the same way, so I was wondering how you know what UIDefaults there are?Well, "JTree.lineStyle" is actually a client property and not a UIDefaults property. In other words, "JTree.lineStyle" is on the same logical level as "Nimbus.Overrides". Unfortunately, there is no way to determine which client properties a component or a component UI implementation supports except carefully examining its source code. javax.swing.plaf.synth.SynthTreeUI (the Nimbus TreeUI implementation) doesn't seem to support any client properties. It might be handled somewhere else, though.
    As an alternative to using "JTree.lineStyle", you could try to use a backgroundPainter that draws angle lines instead of the "do nothing" painter I suggested.
    To determine which UIDefaults properties are available for a given LaF implementation, you can iterate over the UIDefaults' entrySet (UIDefaults is a subclass of Hashtable). For Nimbus specifically, Jasper Potts already did that. See the [corresponding blog entry|http://www.jasperpotts.com/blog/2008/08/nimbus-uimanager-uidefaults/] and [Nimbus UIDefaults Properties List|http://jasperpotts.com/blogfiles/nimbusdefaults/nimbus.html]

  • Jtree leaf custom icons

    I created my own class that extands DefaultTreeCellRenderer and overrided the function getTreeCellRendererComponent.For now I see the customed icon on the leaf,but when I touch with the mouse the panel the vision of the leaf comes back to default.I tried to do repaint it's doesn't help me
    May be you have any suggestions?

    ok I did the following code in a previous project to handle a similer requirement
    It s from a large project so I'll only post a small part and hope that you can understand it
    If you dont just let me know which part
    package lrmk.client.nav;
    import lrmk.client.*;
    import lrmk.client.wnd.*;
    import javax.swing.tree.*;
    import java.awt.*;
    import javax.swing.*;
    public class NavCellRenderer implements javax.swing.tree.TreeCellRenderer
       DefaultTreeCellRenderer form_window  =  new DefaultTreeCellRenderer();
       DefaultTreeCellRenderer dialog_box   =  new DefaultTreeCellRenderer();
       DefaultTreeCellRenderer table_window =  new DefaultTreeCellRenderer();
       DefaultTreeCellRenderer custom =  new DefaultTreeCellRenderer();
       DefaultTreeCellRenderer def  =  new DefaultTreeCellRenderer();
       public NavCellRenderer(){
          form_window.setLeafIcon(ClientGlobals.getImageIcon("lrmk/client/images/form_icon.gif"));
          dialog_box.setLeafIcon(ClientGlobals.getImageIcon("lrmk/client/images/dialog_icon.gif"));
          table_window.setLeafIcon(ClientGlobals.getImageIcon("lrmk/client/images/table_icon.gif"));
       public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
          TreeCellRenderer r = def;
          NavNode nn = null;
          if (value instanceof NavNode)
             nn = (NavNode)value;
          if (nn != null && nn.getIcon() != null)
             r = custom;
             custom.setLeafIcon(nn.getIcon());
          else if (value instanceof WindowNavNode)
             WindowNavNode wnn = (WindowNavNode)value;
             if (CDialogBox.class.isAssignableFrom(wnn.getWndClass()))
                r = dialog_box;
             else
                String name = wnn.getWndClass().getName();
                name = name.substring(name.lastIndexOf("."));
                if (name.startsWith(".Frm"))
                   r = form_window;
                else if (name.startsWith(".Tbw"))
                   r = table_window;
          return r.getTreeCellRendererComponent(tree,value,selected,expanded,leaf,row,hasFocus);
    }

  • How do I select the Poster Frame when exporting to video?

    PP CS6
    I cannot find how to select the frame that I want to appear as the Poster Frame in the exported video.
    I can select it I can change one by right clicking an imported video OK but not the sequence!
    I've been through every menu I can find & even Lynda.com training!
    I'm sure that there must be a way but I'm blowed if I can find it!!

    There are two common meanings for the phrase "poster frame":
    A standalone image on disk (JPG etc) which is displayed by a player before the video is loaded - commonly used by video player apps on websites (YouTube etc), InDesign and PDF files, etc. so the video asset doesn't have to be opened in order for the viewer to see what they're about to watch - although the image is normally captured from the video it doesn't have to be.
    An image resource embedded into the XMP/ID3 data of a video or audio file which can sometimes be shown in the player, but is normally set because it  appears as the thumbnail image when viewing the files in Finder or Windows Explorer. It's not part of the content stream, it's in the file header. In MP3 files it's used to store album artwork.
    You can create standalone JPEG images from PP using the camera icon below the monitor and can semi-automate the export of a still image alongside your video using presets in Adobe Media Encoder, but there's no option in PP (or via Adobe Media Encoder) to specify the embedded poster image in a rendered media file. Several third-party apps can do it, either during render (Compressor / Squeeze) or after the fact (Quicktime Pro), but support for these embedded resources depends on the wrapper for the video file.
    The ability to set a 'poster frame' in the clip bins in PP is solely there to help you organize your project assets visually - for example if the imported footage starts from black, or if you want to choose a frame where the slate is visible - but your choice has no effect on the sequences at export and isn't written back into the original footage.

Maybe you are looking for