Anyone know why this program aint working

i pretty much copied most of the code from an example program but this one doesnt seem to be working
the error says i need another } but keeps saying the same thing when i add one
import java.io.*;
//this is a cprogram i have created so the users data entered into my main program can be read in a text file
class cdetailreader
     public static void main (String args[])
          int input;
          try
               // I have created a filereader to read the contents of the text file i created to hold customer data
               // In my main program i named the text file to store customer details cdetails.txt
               FileReader readcdetails = new fileReader("cdetails.txt");
               input = reader.read();
               While (input >=0)
                    System.out.print ((char) input);
                    input = reader.read();
          catch(Exception e){
          System.out.println("File does not exist"+e);
}

nice one mate it is actually a error in the program
example but should have guessed. thanks for helpI suggest you ditch that source and find another one that doesn't suck.

Similar Messages

  • Anyone know why this doesn't work?

    Hi,
    I am trying to work with layeredPane's, and I am having a bit trouble, Here is my modified code of a java tutorial:
    package org;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    * LayeredPaneDemo.java is a 1.4 application that requires
    * images/dukeWaveRed.gif.
    public class LayeredPaneDemo extends JPanel {
        private String[] layerStrings = { "Yellow (0)", "Magenta (1)",
                                          "Cyan (2)",   "Red (3)",
                                          "Green (4)" };
        private Color[] layerColors = { Color.yellow, Color.magenta,
                                        Color.cyan,   Color.red,
                                        Color.green };
         private Label[] layeredLabels = new Label[5];
        private JLayeredPane layeredPane;
        public LayeredPaneDemo()    {
            setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
            //Create and set up the layered pane.
            layeredPane = new JLayeredPane();
            layeredPane.setPreferredSize(new Dimension(300, 310));
              for (int i = 0; i < layerStrings.length; i++) {
                layeredLabels[i] = createColoredLabel(layerStrings, layerColors[i] );
         layeredLabels[i].addMouseListener(mouseListener);
         setupLayers();
    add(layeredPane);
         private MouseListener mouseListener = new MouseAdapter() {
              public void MouseClicked(MouseEvent e) {     System.err.println("clicked");
                   Label label = (Label) e.getSource();
                   label.setUp();
                   setupLayers();
                   layeredPane.validate();
                   layeredPane.repaint();
         private void setupLayers() {
    //This is the origin of the first label added.
    Point origin = new Point(10, 20);
    //This is the offset for computing the origin for the next label.
    int offset = 35;
              //Add several overlapping, colored labels to the layered pane
    //using absolute positioning/sizing.
              for(int x=0; x< layeredLabels.length; x++) {
                   Label label = layeredLabels[x];
         if(label.up) {
    origin.y += offset;
    label.setBounds(origin.x, origin.y, 100, 100);
    layeredPane.add(label, new Integer(x));
    origin.x += offset;
                   if(label.up) {
    origin.y -= offset;
    //Create and set up a colored label.
    private Label createColoredLabel(String text, Color color) {
    Label label = new Label(text);
    label.setVerticalAlignment(JLabel.TOP);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setOpaque(true);
    label.setBackground(color);
    label.setForeground(Color.black);
    label.setBorder(BorderFactory.createLineBorder(Color.black));
    return label;
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("LayeredPaneDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    JComponent newContentPane = new LayeredPaneDemo();
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
         class Label extends JLabel {
              public boolean up = false;
              public Label(String text) {
                   super(text);
              public void setUp() { up = !up; }
    for some reason the mouse listener isn't responding, and i don't know why..
    Thats only part of my problem. When the mouse listener does respond, I want to only move one of the labels in the Y direction, and then re-paint everything...
    any ideas?

    public void MouseClicked(MouseEvent e) {     System.err.println("clicked");should be small m
    public void mouseClicked(MouseEvent e) {     System.err.println("clicked");                                                                                                                                                                                                                                                                                                                                                       

  • My ipod nano this morning has started to tell me the accessory (lightening to 30-pin adaptor) I use for playing it through my docking station is not supported. It worked fine up until last night. Does anyone know why this might be?

    My ipod nano this morning has started to tell me the accessory (lightening to 30-pin adaptor) I use for playing it through my docking station is not supported. It worked fine up until last night. Does anyone know why this might be?

    Clean any debris from the adapter, docking station connector and the connector on the Nano.

  • My iCloud is asking me to put in my husbands iCloud password not mine and won't let me in.. Anyone know why this is? Cuz we don't even have our phones linked together! He had a ph thru work and I have a separate plan.. Weird!

    Thanks if anyone can help me out!!

    My iCloud is asking me to put in my husbands iCloud password not mine and won't let me in.. Anyone know why this is? Cuz we don't even have our phones linked together! He had a ph thru work and I have a separate plan.. Weird!

  • HT4759 After I add a new PC to synchronize Outlook contacts and calendar with icloud, another PC/Outlook stops synchronizing that had been working fine.  Does anyone know why this happens repeatedly?  Is there a limit to the # of PCs that synchronize with

    After I add a new PC to synchronize Outlook contacts and calendar with icloud, another PC/Outlook stops synchronizing that had been working fine.  Does anyone know why this happens repeatedly?  Is there a limit to the # of PCs that synchronize with iCloud

    Not possible.

  • I have an older iMac 5,1 and the disc drive no longer works. I was hoping that I could the Apple USB super drive as a replacement, but the info on the super drive page says compatible with iMac 2012 or later. Does anyone know why it would not work for me?

    I have an older iMac 5,1 and the disc drive no longer works. I was hoping that I could the Apple USB super drive as a replacement, but the info on the super drive page says compatible with iMac 2012 or later. Does anyone know why it would not work for me?

    A reply to similar question (Q & As , in product page Apple Store) says:
    "...dissable the internal reader hardware from devices setup. Then plug the external usb superdrive and that's it."  Answered by Enrique T from Lima Oct  25 2013.
    If you can locate an external Apple USB 'Air" superdrive for earlier model MacBook Air, that should work. The newer one for the Air is the same as for iMac, now.
    You may be able to use other brands of external USB optical drive with your older intel-based iMac, as some of them function capably. A few should also be able to see system discs or other bootable utilities on DVD.
    Hopefully this helps.
    Good luck & happy computing!

  • I installed logic express 9 on my mac but it says it cant be used on my mac OS X 10.9.1 anyone know why this is?

    Is there anyone knowing why this is?

    Because it is probably so old, that it doesn't run on 10.9. You have to update Logic Express to 9.1.8 and it will work. Just run "Software Update".

  • A year ago I brought a 1 TB hard drive (My Passport), I have not used it for over 4 months and now when I use the USB cord to connect it to my mac, it does not register the hard drive.  Does anyone know why this is happening?

    A year ago I brought a 1 TB hard drive (My Passport), I have not used it for over 4 months and now when I use the USB cord to connect it to my mac, it does not register the hard drive.  Does anyone know why this is happening?

    The beeps could be caused by something as simple as a loose internal wire or connection.  If it is under warranty (not sure how long that is, as WD drives range from 1 to 5 years depending on the model's series - I think "my passport" drives are 3 years) you could contact WD and ask them about it.
    If it is out of warranty, you could also try opening the case and check the connections - the drive may be fine, and there have been posts on TomsHardware forums of people getting the beeps, opening up the case and the drive is fine, just some wire worked loose.

  • My photos are not showing up as layers in the layers panel, only as one layer, so I can't make any changes to the layers.  Does anyone know why this is happening?  Am I downloading them from my camera wrong?

    My photos are not showing up as layers in the layers panel, only as one layer, so I am not able to make changes to the layers.  Does anyone know why this is happening?   Am I downloading them from my camera wrong?  I have watched the video and the photos don't open that way on my layers panel. Any help would be appreciated, I would like to edit out the background and turn it a different color.

    barba87623950 a écrit:
    My photos are not showing up as layers in the layers panel, only as one layer, so I am not able to make changes to the layers.  Does anyone know why this is happening?   Am I downloading them from my camera wrong?  I have watched the video and the photos don't open that way on my layers panel. Any help would be appreciated, I would like to edit out the background and turn it a different color.
    Photos from cameras or scans have only one layer (the 'background' layer).
    You can start with that 'background' layer and duplicate it or add other layers in the editing process. For instance you can make a selection of a subject and put it on another layer; a common use is to desaturate the 'background' and to keep the color in the selected subject in your newly created layer.

  • I am batch processing in PS 2014 (watermark and saving as jpeg from ps file). I get the message for some but not all 'this file needs to be saved as a copy with this option'. And then I have to save it manually. Does anyone know why this happens? (It is j

    I am batch processing in PS 2014 (watermark and saving as jpeg from ps file). I get the message for some but not all 'this file needs to be saved as a copy with this option'. And then I have to save it manually. Does anyone know why this happens? (It is just a plain photoshop file, a watermark is added, then save as jpeg - the jpeg is saved to a different folder than the original photoshop file.)  It happens for about 10 of 30/40  files approximately . Thank you, Kathryn

    I believe I have figured it out - I need to flatten the image, even though there are no layers except for layer 0, first.

  • Cannot download songs get error 5002.  Does anyone know why this is happening?

    I was able to download about 4 new songs today, but then started to get an error 5002 when trying to download a few more.  Does anyone know why this happening and how to resolve?  I've already shut down and restarted my phone, logged out of itunes and relogged in...neither solved the issue.

    It didnt do anything for me...
    just to make sure... of the correct step...
    rm -rf  ./.itmstransporter
    then
    sudo /Applications/iTunes\ Producer.app/Contents/MacOS/iTunes\ Producer
    About that folder, I searched for it, but couldnt find it, is it inside the Itunes Producer packages?
    is there a way to localize it in finder?

  • Trying to install adobe acrobat pro 9 on a new laptop after deactivating it on old laptop. After installation I get Update check for some reason then doesn't let me go any further Anyone know why this is?

    OK so I have deactivated and uninstall the version off the old laptop, then reinstalled the version on the new laptop. When you go to open a document it says it wants to do an upgrade check for some reason, anyone know why this is? It will not take the serial number after that and it doesn't show the version we have in the drop down list.

    Hi johnb49273320,
    What operating system are you running on the new laptop? If it's a current OS, then it may be incompatible with Acrobat 9. Please see https://helpx.adobe.com/x-productkb/policy-pricing/system-requirements-acrobat-family-prod ucts.html.
    It could also be that you're trying to install an upgrade, and the installer is looking for the serial number for the previous version (is the previous version listed in the drop-down list?).
    Best,
    Sara

  • Ibooks author is continuously deleting pages from my book until i'm left with nothing, does anyone know why this is or have the same problem?

    ibooks author is continuously deleting pages from my book until i'm left with nothing, does anyone know why this is or have the same problem?

    What are you doing BEFORE the pages start deleting?

  • I have updated my apple tv 2nd generation to the latest software but it shows the itunes symbol with the usb. Anyone know why this might be? Thanks

    I have updated my apple tv 2nd generation to the latest software but it shows the itunes symbol with the usb. Anyone know why this might be? Thanks

    If your problem persists get yourself a micro USB cable (sold separately), you can restore your Apple TV from iTunes:
    Remove ALL cables from Apple TV. (if you don't you will not see Apple TV in the iTunes Source list)
    Connect the micro USB cable to the Apple TV and to your computer.
    Reconnect the power cable (only for Apple TV 3)
    Open iTunes.
    Select your Apple TV in the Source list, and then click Restore.

  • I have 2 laptops both with iTunes installed but on one my source list includes 'Movies' and the other 'films' does anyone know why this would be?

    i have 2 laptops both with iTunes installed but on one my source list includes 'Movies' and the other 'films' does anyone know why this would be?

    sorry all - disregard I've identified the issue in the language settings with one set to 'English - United States' and one to 'English - United Kingdom' - now fixed.
    Cheers

Maybe you are looking for

  • My MBP display is not working.  Need to move data to new MBP Retina.

    Hello. My 3 yr old MBP display failed (display just showing vertical and horizontal lines). I bought a new MBP Retina today. Genius Bar told me to simply attach FireWire, then press "T" on old MBP to boot in Target Mode. Then, look for old MBP HD ico

  • ITunes thinks iPod is synced with another library

    Hello guys, The moment I connect my iPod to iTunes it doesn't sync. That is because it thinks my iPod is synced to another library, which isn't true. How can I "tell" it that? I use the newest version of iTunes on a Windows 7 64bit pc. Help? Please?

  • JCO Connection close

    Hi  All, I wanted to know is the connection to close the JCO should be handled in the program or the system will handle since I am using the JCO connection handled by content admin with JCo Pool Configuration. <b>I am seeing in SAP backend all the se

  • Help puttting a Bridge web display into a muse website

    I generate nice flash image displays with Bridge (web display) and insert them into my website. I'm now redoing my site with Muse and can't seem to find a workable way to insert the flash player and files into Muse. Ideas?

  • N85(HK)-Music Library Problem

    I bought an N85 in hong kong last year. after i went back to China, i changed its language to Simplified Chinese, then the music library didn't work. I transfered new songs( i tried both .mp3 & .aac) to the phone, then i click "refresh the library",