• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

call native Explorer

I want to call from a java application (let's say by clicking on a JButton) to
the native Windows Explorer.
I thought about FileDialog or JFileChooser, but they were not good enought, since I want to display the icons and enable drag and drop.
Can I get an example of code that does it?
0
ilan_cohen
Asked:
ilan_cohen
1 Solution
 
sen_kumCommented:
The following will call the windows explorer when you press the button

import java.awt.* ;
import java.awt.event.* ;
public class Test
{
    public static void main( String argv[] ) throws Exception
    {
        Frame f = new Frame( ) ;
        Button b = new Button( "Explorer" ) ;
        f.add( b ) ;
        b.addActionListener( new ActionListener()
                       {
                          public void actionPerformed( ActioonEvent ae)
                          {
                             try{
                              Runtime.getRuntime().exec( "Explorer" ) ;
                             }
                             Catch( Exception e )
                             {
                                System.out.println( e ) ;
                             }
                          }
                        }
        ) ;
        f.setSize( 100, 100 ) ;
        f.setVisible( true ) ;
    }
}
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now