Folder Chooser reference (which uses a tree for selection)

is there a recommendation for a folder chooser which uses a tree for selection? all i've found so far are either:
* 3rd party folder choosers
* the file open dialog box of java where you use setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY);
i can't believe there is currently no folder chooser which uses a tree for selection in standard java. so probably i didn't find it. before i write my own, i thought i'd ask.
thanks for the help!

No, it doesn't exist in the standard Java API. What's wrong with third party solutions, especially when some of them are open source? Google found quite a few.
db

Similar Messages

  • Since 8.0 update on my ipad, I can't find autocomplete settings, which used to work for all apps. So much for new and improved.

    Since 8.0 update on my ipad, I can't find autocomplete settings, which used to work for all apps. So much for new and improved.

    Settings > General > Keyboard

  • Index used or not for selecting data from ODS in a start routine

    Dear friends,
    In the start routine of the update rules to a cube, I am reading some data of an ODS in to an internal table .
    The ODS is indexed. But, I am not sure if the index is at all used in the Select statement (that gets the data from ODS to the internal table in the start routine) while loading data to the cube.
    Any help is highly appreciated.
    regards,
    atlaj

    Hi Atlaj
    You can findout this is display execution plan for SQL statement in DB02.
    Goto DB02. and under diagnostic, you find explain. Select that and enter your query. Make sure that everything here is in capital format. Below is a sample query which I have entered.
    SELECT "CRM_SALORG" "SALESORG" FROM "/BI0/QORGUNIT"
    WHERE "SALESORG" = ? AND "OBJVERS" = ? AND "DATETO" >= ?
    AND "DATEFROM" <= ?
    The select parameters should be inside qoutes and in caps and even the from table. Once you enter your query in this format, click on explain. It will show the index scan if the index is present. the output for my query will be something like
    0 SELECT STATEMENT ( Estimated Costs =  1,348E+01 [timerons] )
            1 (COOR) RETURN
                2 (    0) TQ
                    3 (    0) FETCH /BI0/QORGUNIT
                        4 (    0) IXSCAN /BI0/QORGUNIT~Z1
    Where my last statement (line 4) is showing index scan and the name of index read is Z1.
    Hope this helps.
    Please let me know if you have any problems entering the query in the specified format and u get any error.
    Regards
    Sriram

  • Using NAST info for selection screen design

    Hi
    I am doing customization for RFQ printing ( TCODE ME9A)
    I want to know can I get the same selection screen as of ME9A using NAST info for my z driver program.
    Which function module can be used?
    Kindly provide sample code
    Regards
    Harshada

    Hi Piyush,
    Add the below code in your program.
    *Note: you have to take two parameters for files.
    If you select check box then p_pc parameter is visible.
    if you dont select check box then p_app parameter is visible.
    PARAMETERS: p_chk1 AS CHECKBOX USER-COMMAND rusr.
    SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME.
    PARAMETERS: p_pc  LIKE rlgrap-filename MODIF ID abc.
    PARAMETERS: p_app LIKE rlgrap-filename MODIF ID def.
    SELECTION-SCREEN: END OF BLOCK blk1.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-group1 = 'ABC'.
          CLEAR: p_pc, p_app.
          IF p_chk1 = 'X'.
            screen-active = 1.
          ELSE.
            screen-active = 0.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
        IF screen-group1 = 'DEF'.
          CLEAR: p_pc, p_app.
          IF p_chk1 <> 'X'.
            screen-active = 1.
          ELSE.
            screen-active = 0.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_app.
      PERFORM get_fname_app.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pc.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = p_pc.
    *&      Form  get_fname_app
          text
    FORM get_fname_app.
      DATA: c_fnh_mask TYPE dxfields-filemask VALUE '.',
      search_dir TYPE dxfields-longpath VALUE '/sapglobal/users',
      file_path LIKE dxfields-longpath.
      CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
        EXPORTING
          i_location_flag = 'A'
          i_server        = ' '
          i_path          = search_dir
          filemask        = c_fnh_mask
          fileoperation   = 'R'
        IMPORTING
          o_path          = file_path
        EXCEPTIONS
          rfc_error       = 1
          OTHERS          = 2.
      IF sy-subrc EQ 0.
        p_app = file_path.
      ENDIF.
    ENDFORM.                    "get_fname_app

  • About to use my tree for firewood

    I was wondering if someone could maybe clue me into a problem that I am having with my DefaultMutableTree. See, I call a recursive method to get the file system of the computer, which is what is added to the tree. So the user is looking at a tree structure of the file system of their computer. My problem is that when I compile and run my program the tree shows up fine, with no hitches. I have given my code to other friends, and for some of them it does not show up, and throws a null pointer exception at the internal interface of this recursive method. I was wondering what might be causing this? My friends that have problems with the code are running either WIN XP, or Mac OS 10.1.4. Here is the code for the initialization of the tree (This will look ugly on the post, so I would hope that you would take the time to copy and paste this into your editor :D)
    //code start.
    import java.io.*;
    import java.io.File;
    import java.lang.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.beans.*;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.tree.TreeSelectionModel;
    public class File_Encryptor extends JFrame {
    private JFrame thisFrame = this;
              private JTree tree;
    private JMenuBar jMenuBar1 = new JMenuBar();
              private JMenuItem menuOpen = new JMenuItem("Open");
              private JMenuItem menuSave = new JMenuItem("Save");
              private JMenuItem menuClose = new JMenuItem("Close");
              private JMenuItem menuQuit = new JMenuItem("Quit");
              private JMenuItem menuAbout = new JMenuItem("About this software...");
              private JMenuItem menuAdd = new JMenuItem("Add key and user");
              private JMenuItem menuChange = new JMenuItem("Change buddy key");
              private JMenuItem menuSend = new JMenuItem("Send your buddy key");
              private JMenuItem menuDelete = new JMenuItem("Delete selected buddy key");
              private JMenuItem menuReset = new JMenuItem("Reset your key");
              private JMenuItem menuChangeLogin = new JMenuItem("Change Login");
              private JMenuItem menuHelp = new JMenuItem("Help...");
              private JButton openDir = new JButton("Open path");
              private JTextField jTextField1 = new JTextField();
              private JScrollPane treeView;
              private JScrollPane imageView;
              private JScrollPane textView;
              private String ROOT;
              private File root;
              private DefaultMutableTreeNode top;
              final private DefaultMutableTreeNode FILLER = new DefaultMutableTreeNode(new FileInfo ("about:blank", "about:blank"));
         public File_Encryptor() throws FileNotFoundException, InterruptedException, IOException, ClassNotFoundException {
    super("FILE ENCRYPTOR 1.0");
                   addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
                        System.exit(0);
                   ROOT = getRoot(System.getProperty("user.home"));
                   root = new File(ROOT);                    
                   try{
                   //Create the nodes.
                   top = unfold(root);
                   top.setUserObject(new FileInfo(ROOT,ROOT));
                   tree = new JTree(top);
                   tree.getSelectionModel().setSelectionMode
    (TreeSelectionModel.SINGLE_TREE_SELECTION);
                   Object nodage = top.getNextNode().getUserObject();
                   FileInfo leaf = (FileInfo) nodage;
                   tree.addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)
    tree.getLastSelectedPathComponent();
    if (node == null) return;
              try{
                        Object nodeInfo = node.getUserObject();
                        FileInfo temp = (FileInfo) nodeInfo;
                        if((node.isLeaf()) && (!(node.isRoot())))
                             System.out.println(temp.Path());
                             //figure out how to place file in editor pane.
                        else
                             return;
                   catch(Exception fubar)
                        fubar.printStackTrace();
                   treeView = new JScrollPane(tree);
                   treeView.setSize(150,450);
                   jTextField1.setMaximumSize(new Dimension(50, 100));
                   jTextField1.setText("PATH");
                   this.getContentPane().add(jTextField1, BorderLayout.EAST);
                   this.getContentPane().add(treeView, BorderLayout.WEST);
    catch(Exception e) {
    e.printStackTrace();
                   jMenuBar1.setBorder(BorderFactory.createEtchedBorder());
                   JMenu menu = new JMenu("File");
                   JMenu about = new JMenu("Help");
                   JMenu keys = new JMenu("Keys");
                   JMenu change = new JMenu("Login");
                   menuQuit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.META_MASK));
                   menuQuit.setEnabled(true);
                   menuQuit.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                             System.exit(0);
                   menu.add(menuQuit);
                   jMenuBar1.add(menu);
                   jMenuBar1.add(keys);
                   jMenuBar1.add(change);
                   jMenuBar1.add(about);
                   this.setJMenuBar(jMenuBar1);
              public class FileInfo {
              private String path = "";
              private String name = "";
              public FileInfo(String p , String n){
                   path = p;
                   name = n;
              public String toString(){
                   return name;
              public String Path(){
                   return path;
              public static String getFileEx(String po){
              String ext = "";
              int i = po.lastIndexOf('.');
              if(i > 0)
                   ext = po.substring(i-1);
              else
                   ext = null;
              return ext;
              private DefaultMutableTreeNode unfold(File path) {
                   DefaultMutableTreeNode node = new DefaultMutableTreeNode("");
                   Vector Files = new Vector();
                   Vector Direc = new Vector();
                   if((path.isDirectory()) && (path.list().length != 0))
                        node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
                        File [] childs = path.listFiles();
                        for(int j = 0; j < childs.length; j++)
                             if(childs[j].isDirectory())
                                  Direc.addElement(childs[j]);
                             else
                                  Files.addElement(childs[j]);
                        for(int g = 0; g < Files.size(); g++)
                             Direc.addElement((File)Files.elementAt(g));
                        for(int i = 0; i < Direc.size(); i++)
                             node.add(unfold((File)Direc.elementAt(i)));
                   else if(!(path.isDirectory()))
                        node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
                   else
                        node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
                        node.add(new DefaultMutableTreeNode(new FileInfo(null,"<EMPTY FOLDER>")));
                   return node;
              public static String getRoot(String path)
                   int find = path.indexOf(System.getProperty("file.separator"));
                   String root = path.substring(0,find + 1);
                   return root;
    public static void main( String [ ] args )throws FileNotFoundException, InterruptedException, IOException, ClassNotFoundException {
    File_Encryptor show = new File_Encryptor();
    show.setSize(700, 500);
    show.setResizable(false);
    //show.setLocation(100,100);
    show.setVisible(true);
    //code end.
    //well there it is. Hope someone can help me with my problem.
    //I know this code is ugly, but I was trying a bunch of different
    //things hoping something would work. but ehh no such luck.
    //I am running windows 98, yea that's prolly my problem.
    //thank you for your time.

    This will make the code less ugly.
    > //code start.
    import java.io.*;
    import java.io.File;
    import java.lang.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.beans.*;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.tree.TreeSelectionModel;
    public class File_Encryptor extends JFrame {
    private JFrame thisFrame = this;
              private JTree tree;
    private JMenuBar jMenuBar1 = new JMenuBar();
              private JMenuItem menuOpen = new JMenuItem("Open");
              private JMenuItem menuSave = new JMenuItem("Save");
    private JMenuItem menuClose = new
    w JMenuItem("Close");
              private JMenuItem menuQuit = new JMenuItem("Quit");
    private JMenuItem menuAbout = new JMenuItem("About this software...");
    private JMenuItem menuAdd = new JMenuItem("Add key and user");
    private JMenuItem menuChange = new JMenuItem("Change buddy key");
    private JMenuItem menuSend = new JMenuItem("Send your buddy key");
    private JMenuItem menuDelete = new JMenuItem("Delete selected buddy key");
    private JMenuItem menuReset = new JMenuItem("Reset your key");
    private JMenuItem menuChangeLogin = new
    w JMenuItem("Change Login");
    private JMenuItem menuHelp = new
    w JMenuItem("Help...");
              private JButton openDir = new JButton("Open path");
              private JTextField jTextField1 = new JTextField();
              private JScrollPane treeView;
              private JScrollPane imageView;
              private JScrollPane textView;
              private String ROOT;
              private File root;
              private DefaultMutableTreeNode top;
    final private DefaultMutableTreeNode FILLER = new
    w DefaultMutableTreeNode(new FileInfo ("about:blank",
    "about:blank"));
    public File_Encryptor() throws FileNotFoundException,
    InterruptedException, IOException,
    ClassNotFoundException {
    super("FILE ENCRYPTOR 1.0");
                   addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e)
    dowEvent e) {
                        System.exit(0);
                   ROOT = getRoot(System.getProperty("user.home"));
                   root = new File(ROOT);                    
                   try{
                   //Create the nodes.
                   top = unfold(root);
                   top.setUserObject(new FileInfo(ROOT,ROOT));
                   tree = new JTree(top);
                   tree.getSelectionModel().setSelectionMode
    (TreeSelectionModel.SINGLE_TREE_SELECTION);
                   Object nodage = top.getNextNode().getUserObject();
                   FileInfo leaf = (FileInfo) nodage;
    tree.addTreeSelectionListener(new
    ew TreeSelectionListener() {
    public void
    public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode node =
    TreeNode node = (DefaultMutableTreeNode)
    tree.getLastSelectedPathComponent();
    if (node == null) return;
              try{
                        Object nodeInfo = node.getUserObject();
                        FileInfo temp = (FileInfo) nodeInfo;
                        if((node.isLeaf()) && (!(node.isRoot())))
                             System.out.println(temp.Path());
                             //figure out how to place file in editor pane.
                        else
                             return;
                   catch(Exception fubar)
                        fubar.printStackTrace();
                   treeView = new JScrollPane(tree);
                   treeView.setSize(150,450);
    jTextField1.setMaximumSize(new Dimension(50,
    0, 100));
                   jTextField1.setText("PATH");
    this.getContentPane().add(jTextField1,
    1, BorderLayout.EAST);
    this.getContentPane().add(treeView,
    w, BorderLayout.WEST);
    catch(Exception e) {
    e.printStackTrace();
                   jMenuBar1.setBorder(BorderFactory.createEtchedBorder
                   JMenu menu = new JMenu("File");
                   JMenu about = new JMenu("Help");
                   JMenu keys = new JMenu("Keys");
                   JMenu change = new JMenu("Login");
                   menuQuit.setAccelerator(KeyStroke.getKeyStroke(KeyEv
    nt.VK_Q, ActionEvent.META_MASK));
                   menuQuit.setEnabled(true);
                   menuQuit.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                             System.exit(0);
                   menu.add(menuQuit);
                   jMenuBar1.add(menu);
                   jMenuBar1.add(keys);
                   jMenuBar1.add(change);
                   jMenuBar1.add(about);
                   this.setJMenuBar(jMenuBar1);
              public class FileInfo {
              private String path = "";
              private String name = "";
              public FileInfo(String p , String n){
                   path = p;
                   name = n;
              public String toString(){
                   return name;
              public String Path(){
                   return path;
              public static String getFileEx(String po){
              String ext = "";
              int i = po.lastIndexOf('.');
              if(i > 0)
                   ext = po.substring(i-1);
              else
                   ext = null;
              return ext;
              private DefaultMutableTreeNode unfold(File path) {
    DefaultMutableTreeNode node = new
    ew DefaultMutableTreeNode("");
                   Vector Files = new Vector();
                   Vector Direc = new Vector();
    if((path.isDirectory()) && (path.list().length !=
    != 0))
    node = new DefaultMutableTreeNode(new
    new FileInfo(path.getPath(),path.getName()));
                        File [] childs = path.listFiles();
                        for(int j = 0; j < childs.length; j++)
                             if(childs[j].isDirectory())
                                  Direc.addElement(childs[j]);
                             else
                                  Files.addElement(childs[j]);
                        for(int g = 0; g < Files.size(); g++)
                             Direc.addElement((File)Files.elementAt(g));
                        for(int i = 0; i < Direc.size(); i++)
                             node.add(unfold((File)Direc.elementAt(i)));
                   else if(!(path.isDirectory()))
    node = new DefaultMutableTreeNode(new
    new FileInfo(path.getPath(),path.getName()));
                   else
    node = new DefaultMutableTreeNode(new
    new FileInfo(path.getPath(),path.getName()));
    node.add(new DefaultMutableTreeNode(new
    new FileInfo(null,"<EMPTY FOLDER>")));
                   return node;
              public static String getRoot(String path)
    int find =
    =
    path.indexOf(System.getProperty("file.separator"));
                   String root = path.substring(0,find + 1);
                   return root;
    public static void main( String [ ] args
    ] args )throws FileNotFoundException,
    InterruptedException, IOException,
    ClassNotFoundException {
    File_Encryptor show = new
    show = new File_Encryptor();
    show.setSize(700, 500);
    show.setResizable(false);
    //show.setLocation(100,100);
    show.setVisible(true);
    //code end.

  • About to use my tree for some firewood  :o(

    I was wondering if someone could maybe clue me into a problem that I am having with my DefaultMutableTree. See, I call a recursive method to get the file system of the computer, which is what is added to the tree. So the user is looking at a tree structure of the file system of their computer. My problem is that when I compile and run my program the tree shows up fine, with no hitches. I have given my code to other friends, and for some of them it does not show up, and throws a null pointer exception at the internal interface of this recursive method. I was wondering what might be causing this? My friends that have problems with the code are running either WIN XP, or Mac OS 10.1.4. Here is the code for the initialization of the tree (This will look ugly on the post, so I would hope that you would take the time to copy and paste this into your editor :D)
    //code start.
    import java.io.*;
    import java.io.File;
    import java.lang.*;
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.beans.*;
    import javax.swing.JTree;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.tree.TreeSelectionModel;
    public class File_Encryptor extends JFrame {
    private JFrame thisFrame = this;
    private JTree tree;
    private JMenuBar jMenuBar1 = new JMenuBar();
    private JMenuItem menuOpen = new JMenuItem("Open");
    private JMenuItem menuSave = new JMenuItem("Save");
    private JMenuItem menuClose = new JMenuItem("Close");
    private JMenuItem menuQuit = new JMenuItem("Quit");
    private JMenuItem menuAbout = new JMenuItem("About this software...");
    private JMenuItem menuAdd = new JMenuItem("Add key and user");
    private JMenuItem menuChange = new JMenuItem("Change buddy key");
    private JMenuItem menuSend = new JMenuItem("Send your buddy key");
    private JMenuItem menuDelete = new JMenuItem("Delete selected buddy key");
    private JMenuItem menuReset = new JMenuItem("Reset your key");
    private JMenuItem menuChangeLogin = new JMenuItem("Change Login");
    private JMenuItem menuHelp = new JMenuItem("Help...");
    private JButton openDir = new JButton("Open path");
    private JTextField jTextField1 = new JTextField();
    private JScrollPane treeView;
    private JScrollPane imageView;
    private JScrollPane textView;
    private String ROOT;
    private File root;
    private DefaultMutableTreeNode top;
    final private DefaultMutableTreeNode FILLER = new DefaultMutableTreeNode(new FileInfo ("about:blank", "about:blank"));
    public File_Encryptor() throws FileNotFoundException, InterruptedException, IOException, ClassNotFoundException {
    super("FILE ENCRYPTOR 1.0");
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    ROOT = getRoot(System.getProperty("user.home"));
    root = new File(ROOT);
    try{
    //Create the nodes.
    top = unfold(root);
    top.setUserObject(new FileInfo(ROOT,ROOT));
    tree = new JTree(top);
    tree.getSelectionModel().setSelectionMode
    (TreeSelectionModel.SINGLE_TREE_SELECTION);
    Object nodage = top.getNextNode().getUserObject();
    FileInfo leaf = (FileInfo) nodage;
    tree.addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)
    tree.getLastSelectedPathComponent();
    if (node == null) return;
    try{
    Object nodeInfo = node.getUserObject();
    FileInfo temp = (FileInfo) nodeInfo;
    if((node.isLeaf()) && (!(node.isRoot())))
    System.out.println(temp.Path());
    //figure out how to place file in editor pane.
    else
    return;
    catch(Exception fubar)
    fubar.printStackTrace();
    treeView = new JScrollPane(tree);
    treeView.setSize(150,450);
    jTextField1.setMaximumSize(new Dimension(50, 100));
    jTextField1.setText("PATH");
    this.getContentPane().add(jTextField1, BorderLayout.EAST);
    this.getContentPane().add(treeView, BorderLayout.WEST);
    catch(Exception e) {
    e.printStackTrace();
    jMenuBar1.setBorder(BorderFactory.createEtchedBorder());
    JMenu menu = new JMenu("File");
    JMenu about = new JMenu("Help");
    JMenu keys = new JMenu("Keys");
    JMenu change = new JMenu("Login");
    menuQuit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.META_MASK));
    menuQuit.setEnabled(true);
    menuQuit.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.exit(0);
    menu.add(menuQuit);
    jMenuBar1.add(menu);
    jMenuBar1.add(keys);
    jMenuBar1.add(change);
    jMenuBar1.add(about);
    this.setJMenuBar(jMenuBar1);
    public class FileInfo {
    private String path = "";
    private String name = "";
    public FileInfo(String p , String n){
    path = p;
    name = n;
    public String toString(){
    return name;
    public String Path(){
    return path;
    public static String getFileEx(String po){
    String ext = "";
    int i = po.lastIndexOf('.');
    if(i > 0)
    ext = po.substring(i-1);
    else
    ext = null;
    return ext;
    private DefaultMutableTreeNode unfold(File path) {
    DefaultMutableTreeNode node = new DefaultMutableTreeNode("");
    Vector Files = new Vector();
    Vector Direc = new Vector();
    if((path.isDirectory()) && (path.list().length != 0))
    node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
    File [] childs = path.listFiles();
    for(int j = 0; j < childs.length; j++)
    if(childs[j].isDirectory())
    Direc.addElement(childs[j]);
    else
    Files.addElement(childs[j]);
    for(int g = 0; g < Files.size(); g++)
    Direc.addElement((File)Files.elementAt(g));
    for(int i = 0; i < Direc.size(); i++)
    node.add(unfold((File)Direc.elementAt(i)));
    else if(!(path.isDirectory()))
    node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
    else
    node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
    node.add(new DefaultMutableTreeNode(new FileInfo(null,"<EMPTY FOLDER>")));
    return node;
    public static String getRoot(String path)
    int find = path.indexOf(System.getProperty("file.separator"));
    String root = path.substring(0,find + 1);
    return root;
    public static void main( String [ ] args )throws FileNotFoundException, InterruptedException, IOException, ClassNotFoundException {
    File_Encryptor show = new File_Encryptor();
    show.setSize(700, 500);
    show.setResizable(false);
    //show.setLocation(100,100);
    show.setVisible(true);
    //code end.
    //well there it is. Hope someone can help me with my problem.
    //I know this code is ugly, but I was trying a bunch of different
    //things hoping something would work. but ehh no such luck.
    //I am running windows 98, yea that's prolly my problem.
    //thank you for your time.

    I ran this on XP and got the null pointer exception...
    it's likely that it's running into a file or directory that it can't list (in my case it was a mount on a different directory ntfs is kinda cool)... SO... to handle that problem I just put the whole method in a try / catch block
    it was just the method unfold ... the fix returns a blank treenode... it should probably return null and the caller should see that as a sign to not add it to the tree...
         private DefaultMutableTreeNode unfold(File path) {
              DefaultMutableTreeNode node = new DefaultMutableTreeNode("");
              try
                   Vector Files = new Vector();
                   Vector Direc = new Vector();
                   if(path==null)
                        return(node);
                   if((path.isDirectory()) && (path.list().length != 0))
                   node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
                   File [] childs = path.listFiles();
                   for(int j = 0; j < childs.length; j++)
                   if(childs[j].isDirectory())
                   Direc.addElement(childs[j]);
                   else
                   Files.addElement(childs[j]);
                   for(int g = 0; g < Files.size(); g++)
                   Direc.addElement((File)Files.elementAt(g));
                   for(int i = 0; i < Direc.size(); i++)
                   node.add(unfold((File)Direc.elementAt(i)));
                   else if(!(path.isDirectory()))
                   node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
                   else
                   node = new DefaultMutableTreeNode(new FileInfo(path.getPath(),path.getName()));
                   node.add(new DefaultMutableTreeNode(new FileInfo(null,"<EMPTY FOLDER>")));
              catch (Exception e)
              return node;
         }

  • Send mail using ALV tree(for excel file) outlook

    Hello Gurus!!!
    The code is as follows :-
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'C:\exceldown\tree2.xls'
       FILETYPE                        = 'ASC'
      APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                        = lt_project.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CREATE OBJECT outlook 'Outlook.Application'.
    CALL METHOD OF outlook 'CREATEITEM' = outmail EXPORTING #1 = 0.
    SET PROPERTY OF outmail 'TO' = '[email protected]'.
    SET PROPERTY OF outmail 'SUBJECT' = 'Project Management'.
    SET PROPERTY OF outmail 'BODY' =  'This is excel attachment'.
    *SET PROPERTY OF outmail 'Insert File' = 'C:\exceldown\tree2.xls'.
    <b>CALL METHOD OF outmail 'Insert File'.   <b>****NOT WORKING</b>
    SET PROPERTY OF outmail 'Attach' = 'C:\exceldown\tree2.xls'.</b>
    CALL METHOD OF outmail 'SEND'.
    FREE OBJECT outlook.
    Kindly suggest your answers.
    Helpful points will be rewarded
    Thanks,
    Sachin.

    Achieved the requirement using FM RS_TREE_CONSTRUCT

  • Use of SetFormattingSheet for selection of EPMFormattingSheet in BPC 10.0

    I am trying to select a Formatting sheet to be applied based on the category selection. Can someone help me with the VBA code for the same? The code I have written is just refreshing the sheet and not applying the formating sheet. Is there any other option by which we can change the formatting based on selection in the Page Axis?
    Private Sub CommandButton1_Click()
    Dim category As String
    category = Range("D3").Value
    Dim client1 As New EPMAddInAutomation
    If category = "Actual" Then
    client1.SetFormattingSheet Worksheets("Sheet1"), "Default Report", "EPMFormattingSheet"
    End If
    If category = "Budget" Then
    client1.SetFormattingSheet Worksheets("Sheet1"), "Default Report", "EPMFormattingSheet (2)"
    End If
    Dim client As New EPMAddInAutomation
    client.RefreshActiveSheet
    End Sub

    Hi Alex,
    The code was changed in BPC 10, please read How To Migrate BPC 7.x BADIs to BPC 10 | SCN
    EXAMPLE: F
    create_write_back
    write_back
    B.R. Vadim

  • How to add folder from KM content to Portal Favorites for selected users

    Hi all,
    I have cretaed  a folder in KM content (In documents) for uploading implementation related ddocuments.
    how to add this folder in "Portal Favorites" of selected users only.
    Please guide.
    Thanks in advance.

    Hi,
    well one way could be the following.
    Go into KM-Content --> Repository "userhome" --> select the user you want --> navigate into his folder Favorites --> create a new internal link in this folder to the folder you want
    In the favorites of the user there is now a link to the desired folder and after clicking a new window will be opened. You can copy this internal link to the favorites folder of the other users you want.
    Regards
    Alex
    Edited by: Alexander Götz on Apr 16, 2009 5:12 PM

  • APO DP - use of tables for selections and notes

    I am using APO DP V5.
    I note that tables for holding selections and notes are planning area specific and have tables names such as /1APO/S1nnnnnnnn and /1APO/F1nnnnnnnn respectively.
    My questions:
    1. What is the logic for the naming of these tables
    2. For a given planning area, are the tables names the same as one moves from Development to QA to Production environments
    Thanks,
    Bob Austin

    Bob
    I think the answer for the notes part of this question is here. The logic for the selections should be the same
    Re: Updating of Notes for cells in APO DP
    The table names might not be the same in QA since they are created independently and dynamically. But one way to check is to try it out

  • Using execute immediate for select

    Hi all,
    i am writing a procedure as follows:
    create or replace procedure ( run_yr_mo in number) as
    v_count number := 0;
    begin
    execute immediate 'select count(*)
    from all_tables
    where owner = ''MGR''
    and table_name = ''FC_PR_'''||run_yr_mo||''
    into v_count;
    dbms_output.put_line(v_count);
    end;
    this is returning me an error at the execute immediate.
    run_yr_mo = 200912
    Can someone help me out with this.
    Thanks

    Just to show it working:
    SQL> create or replace procedure myproc ( run_yr_mo in number) as
      2   v_count number := 0;
      3  begin
      4    select count(*)
      5    into v_count
      6    from all_tables
      7    where owner = 'MGR'
      8    and table_name = 'FC_PR_'||to_char(run_yr_mo,'fm999999');
      9
    10    dbms_output.put_line(v_count);
    11  end;
    12  /
    Procedure created.
    SQL> set serverout on
    SQL> exec myproc('200910');
    0
    PL/SQL procedure successfully completed.
    SQL>

  • Bug when using a Map for SelectItems?

    Hi there,
    I think I found a pretty bad bug.... I don't think this behaviour is intended:
    I create a selectOneListbox which uses a map for storing the selectItems. The property holding the value is type compatible with the value in the map. When the component is shown, the wrong item is selected (ie NOT The one that is returned by the value property). If I use SelectItem[] for the selectItems, it works. Here is some sample code:
    The methods in the bean (managed bean with the name helloBean). The value property always returns 12 .....
      public Map getItems(){
        Map map = new HashMap();
        map.put("Hello_11", new Integer(11));
        map.put("Hello_12", new Integer(12));
        map.put("Hello_13", new Integer(13));
        map.put("Hello_14", new Integer(14));
        return map;
      public SelectItem[] getItems2(){
        SelectItem[] items = {
            new SelectItem(new Integer(11), "Hello_11"),
            new SelectItem(new Integer(12), "Hello_12"),
            new SelectItem(new Integer(13), "Hello_13"),
            new SelectItem(new Integer(14), "Hello_14"),       
        return items;
      public Integer getValue(){
        return new Integer(12);
      }..... here is how the selectOneListboxes are initialized ......
    <h:form id="helloForm">
            <h:selectOneListbox size="1" value="#{helloBean.value}">
              <f:selectItems value="#{helloBean.items}"/>
            </h:selectOneListbox>
            <h:selectOneListbox size="1" value="#{helloBean.value}">
              <f:selectItems value="#{helloBean.items2}"/>
            </h:selectOneListbox>
    </h:form>.... so both boxes refer to the same value property but their selectItems are taken from a map and a SelectItem[] array respectively. I would expect to see in both boxes the text "Hello_12", BUT:
    <select name="welcomeForm:_id0" size="1">     
         <option value="14">Hello_14</option>
         <option value="12">Hello_12</option>
         <option value="13">Hello_13</option>
         <option value="11">Hello_11</option>
    </select>
    <select name="welcomeForm:_id2" size="1">     
         <option value="11">Hello_11</option>
         <option value="12" selected="selected">Hello_12</option>
         <option value="13">Hello_13</option>
         <option value="14">Hello_14</option>
    </select>as you can see, only for the array the correct value is initially selected.
    Can anyone confirm this is a bug - or - what i would prefer tell me how to get around this?
    Thanks a lot!

    If getValue returns "12" (a String value), the situation is reversed.
    See the page 9-31 of the specification. It says:
    4. A java.util.Map where the keys are
    converted to Strings and used as labels, and
    the corresponding values are converted to
    Strings and used as values for newly
    created javax.faces.model.SelectItem
    instances. The instances are created in the
    order of the iterator over the keys provided
    by the Map.

  • Using High-Level API, need to use KeyRelease just for Lists

    I'm coding a MIDlet with High-Level API, but I found that is really annoying to press down 30 times in a long List to reach the item you want to select. So I thought "what about pressing right/left and make it working like pressing down/up like 10 times"?
    Something like this:
    Canvas canvas = new Canvas() {
             public void paint(Graphics g) { }
             protected void keyPressed(int keyCode) {
                switch(keyCode) {
                    case -3:mylist.setSelectedIndex(mylist.getSelectedIndex()-10,true);break;
                    case -4:mylist.setSelectedIndex(mylist.getSelectedIndex()+10,true);
          }; // end of anonymous class*/But I have no idea about how to implement this =(

    first of all, is there any particular reason you want to stick to the high-level API?
    Well, I have already nearly 700 lines of code. I don't want to start from 0 :P
    I think the best way to implement this would be to use customItems so you can control the view of the list.
    I think that requires MIDP2.0 I'm trying to make it work in MIDP 1.0
    The best you could do with high level UI is add navigation Commands to the List.
    I have already 2 Commands per List. Not all phones have a button in the center of "cursors", so I use right button for select and left for back/exit.
    Thanks for replies anyway

  • Xsl:sort attribute value templates for select and order

    I've tried the xdk_java_9_0_1_0_0.tar.gz update today and for that the reported bugs are still there : one urgent (quite a stopper for us) is this one
    <xsl:template match="/resultlist">
    <xsl:variable name="sortorder">descending</xsl:variable>
    <xsl:variable name="sortfield">name</xsl:variable>
    <xsl:for-each select="result">
    <xsl:sort select="./{$sortfield}" order="{$sortorder}"/>
    <xsl:value-of select="./index"/>,<xsl:value-of select="./name"/>
    </xsl:for-each>
    </xsl:template>
    still it does not replace {$sortfield} and {$sortorder}.

    This is known bug 1798018 in the Oracle XSLT processor.
    The only workaround I can think of is to use <xsl:choose> to optionally use different <xsl:for-each> blocks, one with order="ascending" and one with order="descending" as literal values.

  • WHEN-TREE-NODE-SELECTED Action required..!

    Hello all,
    i am using a tree for the first time, i want to reflect the value of the node's id and desc in it's database item where they r inserted.
    The problem is the desc is not displayed NOT.
    But the node id is working just fine..Why ?
    Can anyone help me pls..?
    i am using the following code:
    WHEN-TREE-NODE-SELECTED Trigger:
    :EQUIPMENT_TYPE_D := :SYSTEM.TRIGGER_NODE;
    --The above returns the item_id of the node.
    BEGIN
           SELECT EQUIPMENT_TYPE
           INTO :EQUIPMENT_TYPE
           FROM INSP_EQUIPMENT_TYPE
           WHERE EQUIPMENT_TYPE_D = :EQUIPMENT_TYPE_D ;
    Exception
    When No_Data_Found THEN NULL;
    When Others THEN
                                     Message ('OTHERS' || SQLCODE || ' And ' || SQLERRM);
                                     Message ('OTHERS' || SQLCODE || ' And ' || SQLERRM);                          
    END;Regards,
    Abdetu..

    The WHEN-TREE-NODE-SELECTED trigger fires twice, it fires when selecting the node and when deselcting the node.
    First make sure that you SQL works in SQL*Plus, Handle your EXCEPTION correctly, remove the NULL from your exception and put a message, maybe your SQL is not returning any rows.
    add the below if condition in your trigger. This will make your code to be executed only when you select the node and not when you deselect it.
    IF :SYSTEM.TRIGGER_NODE_SELECTED = 'TRUE' THEN
      ...    --Your execution code
    END IF; If your item name is the node's label itself you can easily do this:
    IF :SYSTEM.TRIGGER_NODE_SELECTED = 'TRUE' THEN
      :your_block.your_item  := FTREE.GET_TREE_NODE_PROPERTY(HTREE$, :SYSTEM.TRIGGER_NODE, FTREE.NODE_LABEL);
    END IF; Tony
    Edited by: Tony Garabedian on Sep 11, 2008 12:29 PM

Maybe you are looking for

  • CpCmndNextSlide not working

    I am hoping someone can help me. I have searched and attempted every which way I can think of. I am currently working on a project where an interactivity was created in Flash. The Flash SWF has two movieClip buttons on the stage. I am trying to write

  • Problems Creating Slideshow DVD using PSE 8.0

    I have created a slideshow DVD in the past without problems. I have recently created a new slideshow of photos along with audio. It previews just fine in both PSE and Windows Movie Maker, but after I burned the DVD, only one song plays back when the

  • Question in IDOC scenario

    I am doing a IDOC to file scenario. i have created a business service for the filesystem and i am not getting the file. but if i use a filesystem that has an entry in SLD i get the file. i am confused.. any help is appreciated

  • How can i Omit the chars in the string

    Hi Gurus, I have a input variable, assume that in that variable the value is like CAD0586/08 or BR80195/08. my requirement is i have a new variable in that the value should be, starting alphabets should be omitted in the above variable. ie my input v

  • Are there license limitations on Student and Teacher edition?

    I am a student in the UK and have been hoping to purchase Flash CS5.5 Student and teacher edition. However, I have been trying for some time to find out if I would be legally allowed to use the software for commercial use, and have never been able to