how do i put browse option in gui???


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: how do i put browse option in gui???

  1. #1
    Join Date
    Feb 2006
    Posts
    6

    how do i put browse option in gui???

    hi,im doing an assignment on rsa cryptography.my project needs to be able to select a txt file from a location on a computer for encryption or decryption. To do this i want to design a gui that enables the user to select a txt file from a location, but i dont know how to add the browse option to my gui,does anybody know?I just want a simple gui with a browse option and 2 other buttons(encrypt and decrypt)!does anybody have any ideas???please reply.

    Carl.

  2. #2
    Join Date
    Jan 2006
    Location
    Ireland
    Posts
    62
    For selecting files, you should use a JFileChooser:

    Code:
    JFileChooser jfc = new JFileChooser();
    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    jfc.setMultiSelectionEnabled(false);
    int status = jfc.showOpenDialog(this);  // 'this' must refer to a jframe
    
    if(status == JFileChooser.APPROVE_OPTION){
        File f = jfc.getSelectedFile();
    }
    Kind regards,
    Noel
    Efficiency is intelligent laziness

  3. #3
    Join Date
    Feb 2006
    Posts
    6
    hey,thanx noel.....that was a great help!!!if i need any more help ill give you a shout if thats ok.....

Similar Threads

  1. Gui builders... help starting
    By pedrotuga in forum Open Source
    Replies: 2
    Last Post: 07-26-2005, 08:28 AM
  2. Gui Freeze after re-connect
    By lstwil in forum Java
    Replies: 0
    Last Post: 05-29-2005, 09:54 AM
  3. Re: Option Strict/Explicit
    By Mark Hurd in forum .NET
    Replies: 1
    Last Post: 08-05-2001, 01:04 PM
  4. Replies: 3
    Last Post: 03-17-2001, 04:17 PM
  5. Code for option box
    By navajo in forum ASP.NET
    Replies: 1
    Last Post: 10-27-2000, 07:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center