[Java] JFrame incorperation

Newbie Spellweaver
Joined
Apr 13, 2008
Messages
91
Reaction score
1
My friend made me a program for my dad's office that takes all their files in a directory and organizes them by the last modified date. I was wondering if I could incorporate the .class file into a basic JFrame instead of it running in a CMD. Here is a basic JFrame from my Java book.

Code:
import javax.swing.JFrame;

class ShowAFrame {
   
    public static void main(String args[]) {
       JFrame myFrame = new JFrame ();
       String myTitle = "File Organizer";

       myFrame.setTitle(myTitle);
       myFrame.setSize(300, 300);
       myFrame.setDefaultCloseOperation
           (JFrame.EXIT_ON_CLOSE);
       myFrame.setVisible(true);
     }
}

I'm not sure if it will work with that, but anyways. The program in cmd asks for the directory and then it organizes that one.
 
Sorry, I'm no good with Java but doesn't Windows have this already?

In a folder click on "Date Modified" toolbar and it will be organised by date.
 
Okay, basically, you can create a JTextField that takes the directory, and a JButton with an actionlistener to run the method that sorts the directory.

Basically, add the method into the above class, and then setup a JTextField and go from there.
 
Back