JFileChooser problem opening just java files

Hi everyone, trying to write simple text ed. that will only open java files (part of JFileChooser). Yes have looked at API but so stupid that i couldnt get it to work can anyone help?
public void openFile() {
          BufferedReader in = null;
          try {
               JFileChooser chooser = new JFileChooser();
               //---Open Java Files only---
               if (chooser.showOpenDialog(null)
               == JFileChooser.APPROVE_OPTION) {
               File selectedFile = chooser.getSelectedFile();          
               in = new BufferedReader
                         (new FileReader(selectedFile));
     catch(FileNotFoundException e) {
          JOptionPane.showMessageDialog
               (null, "Bad Filename. Try Again");
     catch(IOException e) {
          JOptionPane.showMessageDialog
               (null, "Corrupted File. Try Again");
     finally {
          if (in != null)
               try {
                    StringBuffer buffer = new StringBuffer();
                    String text = new String();
                    text_chat.setText(text + "\n\n");
                    while((text=in.readLine())!=null)
                         buffer.append(text+ "\n");
                    text_chat.setText(buffer.toString());
               catch(IOException e) {
                    JOptionPane.showMessageDialog
                         (null, "Error closing File.");
}

Can you tell me how did you solve the problem? Right now I am encounter ing the same problem. The java files on JFileChooser did not show up!

Similar Messages

  • Opening a .java file in xp

    New to java and have written a small program in notepad, compiled and i ran the program. everything is fine via the dos prompt. i wanted to go and edit the file Sample.java. When i double click i get a message program not found "program.exe" is there a special way that i need to open the .java file in order to edit the contents. is there a free telnet application i can download in order to make this easier instead of going throught the command prompt

    Hi ,
    ok ..
    I will provide the best and permanent solution for you problem.
    Open window explore and clik on Tools and window options.
    New window will open click on file type and enter the extension .java
    and click on the advance option select the program you want open such as notepate/textpate/editplus...etc.then after when you click on the java program it will automatically open on the notepad only.
    just try it out..
    With Regards
    Elan

  • Problems opening a mov file on quicktime

    Hey guys, i just purchased a mac and im having some problems opening a MOV. file on quicktime. FOr some reason im just getting sound and no video. Can anyone please help me out? Is there some extensions i have to download? Please let me know thanks.

    A MOV. file can be anything.
    I would suggest you download and install Perian from http://perian.org/
    You should read this support page http://perian.org/#support in case you need to delete older codecs.

  • How do i open just one file at a time

    i just got lightroom 4.  how do i open just ONE FILE??  i don't want to open catalongs, backup files, create smart collections auto import or any of that.  i just want to open one file at a time

    jared54 wrote:
    i just want to open one file at a time
    You want Photoshop or Elements and use the ACR plugin. Lightroom is the wrong application for you; square peg in a round hole and all that.

  • I'm having problems opening my pdf files. I'm running windows XP and have adobe reader XI (11.0.06)

    I'm having problems opening my pdf files. I'm running wiondows Xp and have adobe reader XI(11.0.06) installed.

    What kind of problems? What happens when you try? Any error messages?

  • Having problems opening a pdf file with reader 10/11 get error msg cannot open close reader and try again any ideas

    having problems opening a pdf file with reader 10/11 get error msg cannot open close reader and try again any ideas

    Hi George ,
    Is it happening with all the PDF' or any specific one?
    Could you please share the error message so that we can replicate at our end ?
    Try repairing reader  once and see if that fixes the issue.
    Launch Reader>Navigate to Help>Repair Adobe Reader Installation
    Regards
    Sukrit Dhingra

  • Lightroom 1.4 - problem opening up NEF files

    Hi there,
    I've been having problems opening up NEF files in Lightroom 1.4, a message keeps coming up saying that the file is not recognised. I'm using a MacBook Pro and can't get a solution - can someone please advise on the best course of action?
    Thanks!

    >a Nikon D3
    I don't think that one is supported in LR 1.4. The camera was released after LR 1.4 was released. To get support for that camera, either upgrade to LR 2 or convert the NEF files to dng using the free DNG converter that you can download from http://www.adobe.com/products/dng/

  • I am using PSE 9. I had no problem opening my Raw files from my Canon Rebel XT  Now  I have a Rebel 5ti and pse 9 won't reconize the Cr2 files

    I am using PSE 9. I had no problem opening my Raw files from my Canon Rebel XT  Now  I have a Rebel 5ti and pse 9 won't reconize the Cr2 files

    See this faq:
    FAQ: Will Photoshop Elements work with my camera, or Why won't my raw files open?
    That will explain why each new camera model uses its own raw format. (.CR2 does not indicate a format, only a Canon family of formats).
    The first link tells you what version of camera raw is needed for your camera : https://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
    You need ACR 7.4
    The second link tells you which ACR versions are supported by Elements versions Camera Raw-compatible Adobe applications
    PSE9 supports version 6.5
    Further down on that paper, you get links to download the free Adobe DNGconverter for Mac or Win.
    This standalone software can batch convert a whole folder of raw files to the DNG raw file format that your present PSE9 can read.
    Otherwise, you would have to upgrade to version 10 or later.

  • Open a java file from c#

    Does anyone know if it's possible to open a java file from a c# web form?
    Any links would also be appreciated,
    Thanks,
    Clivert

    I don't know anything about C# web forms (that's pretty far away from the topic of this forum) but I expect anybody answering the question would need to know what you mean by "open" and "a java file" in that context.
    For example it might mean to cause a text editor to run and display the source code for a Java class. Or it might mean for a Java JVM to start running and execute the main method of a Java class.

  • Cannot open any Java files on my Mac OSX: Problem Solved

    Hello all,
    I have just begun an Introduction to Java class and I'm already having problems...namely, I cannot open .java files on my Mac.
    Whenever I try to open them, I get an error message that says: "You cannot use this version of the application Xcode with this version of Mac OS X."
    I'm running version 10.5.4 on a PowerPC Mac. It's a few years old, but I don't understand how it could already be so outdated as to not allow me to even use the application.
    I am 100% new to programming and don't really know at all what I'm doing. Apple says their JDK comes with every Mac and no one else seems to be having this problem. I don't really even know where to go to for updates, if that is what I need to do, or if I should just download a different JDK.
    This is an intensive (6-week) class and I don't want to fall behind, but it's halfway through the first week and I cannot even open files.
    Any suggestions greatly appreciated.
    EDIT: I figured out the problem by getting out my installation disks and I found the latest xCode tools app in the "optional packages" folder.
    Installed it and now I'm up and running.
    Edited by: chalks on Sep 17, 2008 10:09 AM

    You can download Adobe Reader from adobe.com.  The Mac OSX uses its "reader" to open PDF files without the Adobe Reader.  If you downloader adobe reader, it should open all PDF files.  Hope this helps.

  • Problems opening InDesign CS4 files in CS5

    We have just upgraded to CS5 to take advantage of the tracked changes facility, and immediately encountered problems:
    when opening CS4 files in CS5, we've noticed that formulae, created using charater styles, are not displaying properly.  For example x = y / z, which would have the x and = signs dropped, the y underlined and the z on the next line, something like this (although much prettier than I can reproduce here):
    x = y
          z
    in CS5, however, all gyphs in the formula are superimposed upon each other
    we tried loading the character styles from our template document.  However, that caused most of the content to dissapear!
    we tried converting our template to CS5 and then loading the character styles from our template document.  However, that also caused most of the content to dissapear!
    Anybody got any clues?

    troglodytes2000 wrote:
    We have just upgraded to CS5 to take advantage of the tracked changes facility, and immediately encountered problems:
    when opening CS4 files in CS5, we've noticed that formulae, created using charater styles, are not displaying properly.  For example x = y / z, which would have the x and = signs dropped, the y underlined and the z on the next line, something like this (although much prettier than I can reproduce here):
    x = y
          z
    in CS5, however, all gyphs in the formula are superimposed upon each other
    we tried loading the character styles from our template document.  However, that caused most of the content to dissapear!
    we tried converting our template to CS5 and then loading the character styles from our template document.  However, that also caused most of the content to dissapear!
    Anybody got any clues?
    If you are opening the CS4 files directly in CS5, try exporting CS4 files to IDML and opening the IDML files in CS5. It's worth a try if you haven't already found it doesn't help.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Problems opening up RAW files in the Adobe elements 12 editor

    I just installed Elements12 on my Windows Desktop.
    Operating System Windows XP SP3, Quad Core Processor 2.4GhZ, 3Gb RAM (based on these spec, I should be meeting minimum system requirements)
    My camera's RAW format (Rebel 4Ti, CR2) is supported by the installed Camera RAW version (8.0.0.xx).
    I had no problems opening up the RAW file into Camera Raw. I performed the basic adjustments and save the image as a .DNG file. No problems so far.
    (1) I then tried to open the RAW file into the Elements Editor by clicking on "OPEN Image" in Camera RAW. I goes the error message that this action could not be completed due to a program error.
    (2) I also tried to open the .DNG file directly. I got an error message telling me I had not enough RAM to complete this action (see above, I have 3Gb installed)
    Can anybody advise me what to do, or what the problem is>
    Thanks.

    You might start looking for a new computer with windows 7 or 8 64 bit.
    Not because windows xp is a bad operating system, but it's not supported by microsoft any longer and more and more software companies are dropping support for xp.
    (even one of my favorite open source programs; Krita, dropped support for windows xp)
    Plus, new programs seem to be more and more ram hungry and a 64 bit version of windows can make a world of difference.

  • Problems opening & resaving NEF files with CS3/CS2

    I seem to be having problems sending my NEF files to Photoshop from Aperture. This started happening just today & I'm not sure what to do.
    What happens is that when I open a NEF file in external editor, instead of just opening up as a psd file in CS3 or CS2 directly like it used to do, it now opens Adobe Raw instead which means that I am unable to resave back into my Aperture Library. Is there anyone who has experienced this as well? Any suggetions as to the cause and a solution? I tried checking preferences for both Aperture as well as Photoshop but nothing seems to work.
    The only thing I can think of is having just updated Adobe Raw to the latest version, 4.3 I think. Other than that Aperture did start up about a week ago & declared my library corrupt & proceeded to rebuild my library. Other than that it was behaving normally until today. Its really irritating & counter productive to be unable to resave my edits in Aperture.
    Any help or suggestions will be very welcome indeed. Thanks in advance.

    Thanks for the tip Eduardo, but I checked the preferences and they seem to be correct.
    It seems that only images in certain projects were affected. Could be the ones that Aperture rebuilt earlier. I guess I may have to try exporting the raw files from the affected projects, then deleting and reimporting the projects again. I did try to rebuild the thumbnails but it doesn't seem to help.
    Does anyone have any other suggestions for me to try before I do this?

  • Problems opening Lightroom 5 files in version 6

    I am having problems opening images renerated in lightroom5 into cs6. Cs6 bridge does not see the lightroom libarary. If I open lightroom and right clik the image, edit in cs6, 6 opens but the picture doesnot follow. What is going on? Give me a hand, thanks.

    OK, first no other program can see the catalog as it is database used just for lightroom. However your pictures should stay where you imported them onto your computer. Which is normally the default pictures folder.
    For bridge to see the edits done to the picture, you must save the picture (ctrl-s or cmd-s) this will write the edits to the header of the image or a sidecar file. Bridge can then read this file and allow you to see the edits that were done to that image.
    Edit in photoshop should be working. Did you remove any pictures from your hard drive? Do you have more than one version of photoshop installed?
    Have you tried resetting the preference files for both lightroom and photoshop (while starting program, hold down ctrl-alt-shift or cmd-opt-shift - If done correctly a dialog box will pop up asking if you want to reset your preferences)
    Lastly uninstall then reinstall photoshop. (If you have the latest version you can do this in the manager)

  • NEWBIE PLEASE HELP..!! Problem Opening a MIDI file

    Hi all.
    Does anyone have any advice on this strange problem..??? On the Logic Pro 8 Manual it says that : +"When you open a MIDI file in Logic Pro 8, software instrument tracks are automatically created for each MIDI track"+
    My problem is that when I open a MIDI file, (Standard MIDI file) some tracks get assigned to external MIDI instruments, others get assigned to Software instruments. I can't figure out how this might happen.
    I really want to use the software instruments for each MIDI track, not the Quicktime Synthesizer...
    PLEASE HELP ME FIX THIS...!!!!
    Thanks

    Well, the thing is that I only want Logic to automatically create the software instruments tracks (EXS, EXS24, Garageband sounds, etc) every time I open a MIDI file
    As a matter of fact I have a Macbook with 10.4 OSX with Logic Pro 8 and this one DOES what it says in the manual (creating the W/W instrument tracks) I just open a MIDI file and the program does all the rest..it assigns a SW instrument for each track... However, I can't do that with my iMac....
    This problem is really driving me insane ....I'm a switcher from Cakewalk SONAR and I really want to use Logic....Please Help..!!

Maybe you are looking for