"cannot resolve symbol" in a Timer !!!Please Help!!!

I am doing a program for a class which involves timers. I am using JCreator and when i try to construct a new timer, the compiler points to the "new" in the line:
Timer T1=new Timer(interval, ActionListener);
^
This is what it looks like and the error reads: cannot resolve symbol; constructor Timer.
please tell me if yiou have any information or suggestions as to how this error might be remedied.

Sure, here it is:
import java.awt.event.*;
import javax.swing.Timer;
import javax.swing.JOptionPane;
import java.util.*;
interface ActionListener
     void actionPerformed(ActionEvent event);     
class Ploid
     public static void main(String[] args)
          class Car implements ActionListener
               int mpg=30;
               int mph=35;
               int gtank=20;
               int interval;
               int changer;
               int totalmiles;
               Car(int x)
                    interval=x;
               public void actionPerformed(ActionEvent event)
                    for(int c=0;c<(interval/1000);c++)
                         totalmiles=totalmiles+mph;
                    int hyt=mpg*gtank;
                    if(totalmiles>hyt)
                         int y=totalmiles-hyt;
                         totalmiles=totalmiles-y;
                         System.out.println(totalmiles);
                    else
                         System.out.println(totalmiles);
class SUV implements ActionListener
     int mpg=15;
     int mph=55;
     int gtank=30;
     int interval;
     int changer;
     int totalmiles;
     SUV(int x)
          interval=x;
          public void actionPerformed(ActionEvent event)
               for(int c=0;c<(interval/1000);c++)
                    totalmiles=totalmiles+mph;
               int hyt=mpg*gtank;
               if(totalmiles>hyt)
                    int y=totalmiles-hyt;
                    totalmiles=totalmiles-y;
                    System.out.println(totalmiles);
               else
                    System.out.println(totalmiles);
class Semi implements ActionListener
     int mpg=60;
     int mph=80;
     int gtank=50;
     int interval;
     int changer;
     int totalmiles;
     Semi(int x)
          interval=x;
     public void actionPerformed(ActionEvent event)
          for(int c=0;c<(interval/1000);c++)
               totalmiles=totalmiles+mph;
          int hyt=mpg*gtank;
          if(totalmiles>hyt)
               int y=totalmiles-hyt;
               totalmiles=totalmiles-y;
               System.out.println(totalmiles);
          else
               System.out.println(totalmiles);
          String flag="y";
          String trav=JOptionPane.showInputDialog("How long do you want to drive?(1000=1 hour)");
          int t1=Integer.parseInt(trav);
          Car listen=new Car(t1);
          SUV listener2=new SUV(t1);
          Semi listener3=new Semi(t1);
          final int t2=t1/1000;
          final int t3=t1/t2;
          ActionListener listener=null;
          Timer T1=new Timer(t3, listener);
          Timer T2=new Timer(t3, listener);
          Timer T3=new Timer(t3, listener);
          while(flag.equals("y"))
               T1.start();
               T2.start();
               T3.start();
               String g=JOptionPane.showInputDialog("Do you want to drive again?");
               if((g.equals("y"))||(g.equals("Y")))
                    System.out.println("Let's Drive!");
               else
                    flag=g;
               System.exit(0);
}Here is the errors:
[errors]
A:\Ploid2.java:116: cannot resolve symbol
symbol : constructor Timer (int,ActionListener)
location: class javax.swing.Timer
          Timer T1=new Timer(t3, listener);
^
A:\Ploid2.java:117: cannot resolve symbol
symbol : constructor Timer (int,ActionListener)
location: class javax.swing.Timer
          Timer T2=new Timer(t3, listener);
^
A:\Ploid2.java:118: cannot resolve symbol
symbol : constructor Timer (int,ActionListener)
location: class javax.swing.Timer
          Timer T3=new Timer(t3, listener);
^
3 errors
Process completed.
[errors]
****There is the source code and the errors the compiler returns. That should be more help.****

Similar Messages

  • "cannot resolve symbol" error...please help

    when itry to compile my program i get the error " cannot resolve
    symbol" variable setLayout.
    My program is very small. Can someone tell me why i keep
    getting error?
    thanx
    trin.
    import java.applet.*;
    import java.awt.*;
    public class MyProg extends Applet
         Button btnOne = new Button("One");
         Button btnTwo = new Button("Two");
         public void init()
              Panel pOne = new Panel( ) ;
              pOne.setLayout = ( new GridLayout( ));
              pOne.add(btnOne);
              pOne.add(btnTwo);
              add(pOne);

    Change:
    pOne.setLayout = ( new GridLayout( ));to
    pOne.setLayout( new GridLayout());It's a method call, not an assignment :)

  • Cannot resolve Sybol!!!Please help me!

    This is my code..
    import java.lang.*;
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    class ClientWorker implements Runnable {
    private Socket client;
    private JTextArea textArea;
    ClientWorker(Socket client, JTextArea textArea) {
    this.client = client;
    this.textArea = textArea;
    public void run(){
    String line;
    BufferedReader in = null;
    PrintWriter out = null;
    try{
    in = new BufferedReader(new InputStreamReader(client.getInputStream()));
    out = new PrintWriter(client.getOutputStream(), true);
    } catch (IOException e) {
    System.out.println("in or out failed");
    System.exit(-1);
    while(true){
    try{
    line = in.readLine();
    //Send data back to client
    out.println(line);
    textArea.append(line);
    } catch (IOException e) {
    System.out.println("Read failed");
    System.exit(-1);
    public class FinalServer2 extends javax.swing.JFrame {
    /** Creates new form FinalServer2 */
    public FinalServer2() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    private void initComponents() {
    textArea1 = new java.awt.TextArea();
    button1 = new java.awt.Button();
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent evt) {
    exitForm(evt);
    getContentPane().add(textArea1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 200, 130));
    button1.setLabel("button1");
    getContentPane().add(button1, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 150, -1, -1));
    pack();
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {
    System.exit(0);
    /** @param args the command line arguments
    public static void main(String[] args) {
    FinalServer2 frame = new FinalServer2();
    frame.setTitle("Server Program");
    frame.pack();
    frame.setVisible(true);
    frame.listenSocket();
    public void listenSocket() {
    try{
    server = new ServerSocket(1055);
    } catch (IOException e) {
    System.out.println("Could not listen on port 4444");
    System.exit(-1);
    while(true){
    ClientWorker w;
    try{
    w = new ClientWorker(server.accept(), textArea1);
    Thread t = new Thread(w);
    t.start();
    } catch (IOException e) {
    System.out.println("Accept failed: 4444");
    System.exit(-1);
    // Variables declaration - do not modify
    private java.awt.Button button1;
    private java.awt.TextArea textArea1;
    // End of variables declaration
    Socket client = null;
    BufferedReader in = null;
    String line;
    PrintWriter out = null;
    ServerSocket server = null;
    When i compile the code i recieve this message..
    FinalServer2.java [111:1] cannot resolve symbol
    symbol : constructor ClientWorker (java.net.Socket,java.awt.TextArea)
    location: class ClientWorker
    w = new ClientWorker(server.accept(), textArea1);
    ^
    Please help me..

    ClientWorker(Socket client, JTextArea textArea) {
    this.client = client;
    this.textArea = textArea;
    }<SNIP>
    When i compile the code i recieve this message..
    FinalServer2.java [111:1] cannot resolve symbol
    symbol : constructor ClientWorker
    (java.net.Socket,java.awt.TextArea)
    location: class ClientWorker
    w = new ClientWorker(server.accept(),
    erver.accept(), textArea1);
    ^
    Please help me..Look at the costructor and and error message, s=and see if you can work it out; if you are still having difficuly, post back in 10 mins.

  • Cannot sync for the first time, please help

    I'm using 3-G4 units, two will sync 1 will not. The one that will not is a G3 B|W unit that I upgraded to a G4 Processor 500 MHz After giving this unit a different name than the others,I can see all three computers in the isync window but when I press sync it starts but stops right away not completing the sync.
    G3-B|W Upgrade to G4   Mac OS X (10.3.9)   500MHz proc,650HD,

    It has died. Like a million times. It won't stay recognized long enough to charge. do you know what I mean? Meaning, I'll get the little icon that means there's very low battery, and it's charging, then after a few minutes, it will say "no battery power, connect ipod to power"
    And I've tried an adapter that lets you plug it into a wall, and that doesn't work either. I do have an ipod clock radio, tho with a dock... I'll try that tomorrow. If that doesn't work,I might buy her one, because I feel responsible for this. But you don't care about that XD
    Thanks for the help

  • HELP PLEASE Cannot resolve symbol error

    Only just started to atempt simple java programs and this same error keeps appearing. code i am using is:
    import java.io.*;
    class Q1
         public static void main(String[] args) throws IOException
              int num1,num2,sum;
              /*program statements start here*/
         System.out.printIn ("Input a number");
                   num1= Course_io.readInt();
              System.out.printIn ("Input another number");
                   num2= Course_io.readInt();
                   sum= num2 - num1;
              System.out.printIn ("Total is" +sum );
    and this is the error message i keep getting:
    javac -d . -g "C:\Java Programs\Q1.java"
    C:\Java Programs\Q1.java:12: cannot resolve symbol
    symbol : method printIn (java.lang.String)
    location: class java.io.PrintStream
    System.out.printIn ("Input a number");
    ^
    C:\Java Programs\Q1.java:16: cannot resolve symbol
    symbol : method printIn (java.lang.String)
    location: class java.io.PrintStream
    System.out.printIn ("Input another number");
    ^
    C:\Java Programs\Q1.java:22: cannot resolve symbol
    symbol : method printIn (java.lang.String)
    location: class java.io.PrintStream
    System.out.printIn ("Total is" +sum );
    ^
    3 errors
    Please help me, Thankyou.

    sum= num2 - num1;
    System.out.printIn ("Total is" +sum );While you're at it, do something about this, it's misleading.
    kind regards,
    Jos

  • PLEASE HELP: cannot resolve symbol class

    it's showing me the error on the following lines 7 and 9
    it says cannot resolve symbol class Name and cannot resolve symbol class Phone
    I also have a package name addressBook and it contains two files Entry.java and Address.java
    Here is the code:
    import java.io.*;
    import addressBook.*;
    public class AddressDr
         public static void main(String[] args)throws IOException
              Name name;
              Address address;
              Phone phone;
              Entry entry;
              String first, last, middle, street, city, state, zip;
              int areaCode, number;
              BufferedReader in;
              in=new BufferedReader(new InputStreamReader(System.in));
              PrintWriter outFile;
              outFile=new PrintWriter(new FileWriter("Entries"));
              System.out.println("Quit entered fot the first name ends the " + "application.");
              System.out.print("Enter first name: ");
              first=in.readLine();
              while (first.compareTo("Quit") !=0)
                   System.out.print("Enter last name: ");
                   last=in.readLine();
                   System.out.print("Enter middle name: ");
                   middle=in.readLine();
                   name=new Name(first, last, middle);
                   System.out.print("Enter street address: ");
                   street=in.readLine();
                   System.out.print("Enter city: ");
                   city=in.readLine();
                   System.out.print("Enter state: ");
                   state=in.readLine();
                   System.out.print("Enter ZIP code: ");
                   zip=in.readLine();
                   address=new Address(street, city, state, zip);
                   System.out.print("Enter areaCode: ");
                   areaCode = Integer.parseInt(in.readLine());
                   System.out.print("Enter number: ");
                   number=Integer.parseInt(in.readLine());
                   phone=new Phone(areaCode, number);
                   entry= new Entry(name, address, phone);
                   entry.writeToFile(outFile);
                   System.out.print("Enter first name: ");
                   first=in.readLine();
              outFile.close();
    }

    OK. Here is how I did it.
    I have AddressDr which is Address driver.
    I have two files Address and Entry which in package addressBook.
    AddressDr:
    import java.io.*;
    import addressBook.*;
    public class AddressDr
         public static void main(String[] args)throws IOException
              Name name;
              Address address;
              Phone phone;
              Entry entry;
              String first, last, middle, street, city, state, zip;
              int areaCode, number;
              BufferedReader in;
              in=new BufferedReader(new InputStreamReader(System.in));
              PrintWriter outFile;
              outFile=new PrintWriter(new FileWriter("Entries"));
              System.out.println("Quit entered fot the first name ends the " + "application.");
              System.out.print("Enter first name: ");
              first=in.readLine();
              while (first.compareTo("Quit") !=0)
                   System.out.print("Enter last name: ");
                   last=in.readLine();
                   System.out.print("Enter middle name: ");
                   middle=in.readLine();
                   name=new Name(first, last, middle);
                   System.out.print("Enter street address: ");
                   street=in.readLine();
                   System.out.print("Enter city: ");
                   city=in.readLine();
                   System.out.print("Enter state: ");
                   state=in.readLine();
                   System.out.print("Enter ZIP code: ");
                   zip=in.readLine();
                   address=new Address(street, city, state, zip);
                   System.out.print("Enter areaCode: ");
                   areaCode = Integer.parseInt(in.readLine());
                   System.out.print("Enter number: ");
                   number=Integer.parseInt(in.readLine());
                   phone=new Phone(areaCode, number);
                   entry= new Entry(name, address, phone);
                   entry.writeToFile(outFile);
                   System.out.print("Enter first name: ");
                   first=in.readLine();
              outFile.close();
    Entry:
    package addressBook;
    import java.io.*;
    public class Entry
         Name name;
         Address address;
         Phone phone;
    public Entry(Name newName, Address newAddress, Phone phoneNumber)
         name = newName;
         address = newAddress;
         phone = phoneNumber;
    public Name knowName()
         return name;
    public Address knowAddress()
         return address;
    public Phone knowPhone()
         return phone;
    public void writeToFile(PrintWriter outFile)
         outFile.println(name.knowFirstName());
         outFile.println(name.knowLastName());
         outFile.println(name.knowMiddleName());
         oufFile.println(address.knowStreet());
         outFile.println(address.knowState());
         outFile.println(address.knowCity());
         outFile.println(address.knowZip());
         outFile.println(phone.knowAreaCode());
         outFile.println(phone.knowDigits());
    Address:
    package addressBook;
    public class Address
         String street;
         String city;
         String state;
         String zipCode;
         public Address(String newStreet, String newCity, String newState, String zip)
              street=newStreet;
              city=newCity;
              state=newState;
              zipCode=zip;
         public String knowStreet()
              return street;
         public String knowCity()
              return city;
         public String knowState()
              return state;
         public String knowZip()
              return zipCode;
    }

  • HT201210 I have tried to update my iPhone 4 many times (from iOS 5.1 to latest version), but everytime it fails and says that it cannot be updated. unknown error (3194). please help.

    I have tried to update my iPhone 4 many times (from iOS 5.1 to latest version), but everytime it fails and says that it cannot be updated. unknown error (3194). please help.
    <E-mail Edited by Host>

    You might try reading the entire help document you linked from:
    Unable to contact the iOS software update server gs.apple.com
    Error 1004, 1013, 1638, 3014, 3194: These errors may be the result of the connection to gs.apple.com being redirected or blocked. Follow these steps to resolve these errors:
    Install the latest version of iTunes.
    Check security software. Ensure that communication to gs.apple.com is allowed. Follow this article for assistance with security software. iTunes for Windows: Troubleshooting security software issues.
    Check the hosts file. The restore will fail if there is an active entry to redirect gs.apple.com. FollowiTunes: Advanced iTunes Store troubleshooting to edit the hosts file or revert to a default hosts file. See section "Blocked by configuration: (Mac OS X/Windows) > Rebuild network information".
    Try to restore from another known-good computer and network.
    If the errors persist on another computer, the device may need service.

  • Need help - method call error cannot resolve symbol

    My code compiles fine but I continue to receive a method call error "cannot resolve symbol - variable superman" - can't figure out why. Here is my code:
    public static String caesar(String message, int shift)
    {   [b]String result = "";
    for(int i = 0; i < message.length(); ++i)
    {   [b]char newChar = message.charAt(i + shift);
    result += newChar;
    return result.toUpperCase();
    I entered "superman" for message and "3" for the shift. Can someone please help? Thanks!

    Your post worked great - especially since it made me realize I was going about it all wrong! I was attempting to convert "superman" to "vxshupdq" - basically a cipher shift starting at index 0 and shifting it 3 character values which would result in s changing to v. I restructured my code:
    public static String caesar(String message, int shift)
    {   [b]String result = "";
    for(int i = 0; i < message.length(); ++i)
    {   [b]char newChar = message.charAt(i);
    result += (newChar + shift) % message.length();
    return result.toUpperCase();
    But it's displaying the result as a "60305041". How can I get it to display the actual characters?

  • Help!!! error: cannot resolve symbol

    can anyone tell me how to solve the following problem
    thank you
    cannot resolve symbol
    symbol : method decode (java.lang.String)
    location: class java.lang.Short
    Short psmShort = Short.decode(psmString);
    ^
    Long bdAddrLong = Long.decode("0x" + bdAddrString);
    ^

    that is because these methods does not exist. What you can use instead is parseShort(String) or parseLong.
    Maybe reading the javadoc could help you next time ;-)
    hth
    Kay

  • Illegal start of expression and cannot resolve symbol HELP

    Can someone pls help me?
    These are the two problems:
    --------------------Configuration: j2sdk1.4.1_02 <Default>--------------------
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:291: illegal start of expression
    public void inputJButtonActionPerformed( ActionEvent event )
    ^
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:285: cannot resolve symbol
    symbol: method inputJButtonActionPerformed (java.awt.event.ActionEvent)
                   inputJButtonActionPerformed( event);
    Here is my code :
    //Mind boggler quiz
    //Marcelyn Samson
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.lang.*;
    public class Mindboggler extends JFrame
              // JPanel for welcome window
              private JPanel welcomeJPanel;
              private JPanel presetJPanel;
         private JLabel titleJLabel;
         private JLabel quizJLabel;
         private JLabel girlJLabel, headJLabel;
         private JLabel introJLabel;
         private JButton startJButton;
         // JPanel for questionone window
         private JPanel questiononeJPanel;
         private JLabel textJLabel;
         private JPanel becksJPanel;
         private JButton oneJButton, twoJButton, threeJButton, fourJButton, nextJButton;
              //JPanel for questiontwo window
              private JPanel questiontwoJPanel;
              private JPanel orlandoJPanel;
              private JLabel q2JLabel;
              private JCheckBox lordJCheckBox;
              private JCheckBox faceJCheckBox;
              private JCheckBox piratesJCheckBox;
              private JButton next2JButton;
         private JButton inputJButton;
         //JPanel for questionthree
         private JPanel questionthreeJPanel;
         private JPanel howmuchJPanel;
         private JLabel howmuchJLabel;
         private JLabel nameJLabel;
         private JTextField nameJTextField;
         private JLabel moneyJLabel;
         private JTextField moneyJTextField;
         private JButton next3JButton;
         //Publics
         public JPanel welcomeJFrame, questionJFrame, questiontwoJFrame, questionthreeJFrame;
         //contentPane
              public Container contentPane;
              //no argument constructor
              public Mindboggler()
                   createUserInterface();
              //create and position components
              private void createUserInterface()/////////////////////////; semo colon do not edit copy paste
                   //get contentPane and set layout to null
                   contentPane = getContentPane();
                   contentPane.setLayout ( null );
                   welcome();
                   //set properties of applications window
                   setTitle( "Mindboggler" ); // set JFrame's title bar string
              setSize( 600, 400 ); // set width and height of JFrame
              setVisible( true ); // display JFrame on screen
              } // end method createUserInterface
              public void welcome(){
                        // set up welcomeJPanel
                   welcomeJPanel = new JPanel();
                   welcomeJPanel.setLayout( null );
                   welcomeJPanel.setBounds(0, 0, 600, 400);
                   welcomeJPanel.setBackground( Color.GREEN );
                   // set up textJLabel
                   titleJLabel = new JLabel();
                   titleJLabel.setText( "Mind Boggler" );
                   titleJLabel.setLocation( 30, 10);
                   titleJLabel.setSize( 550, 70);
                   titleJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 30 ) );
                   titleJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add( titleJLabel );
                   // set up presetJPanel
                   presetJPanel = new JPanel();
                   presetJPanel.setLayout( null );
                   presetJPanel.setBounds( 150, 10, 300, 80 );
                   presetJPanel.setBackground( Color.GRAY );
                   welcomeJPanel.add( presetJPanel );
                   //setup Intro JLabel
                   introJLabel = new JLabel();
                   introJLabel.setText( "Think, think, think. Can you get all the questions right?" );
                   introJLabel.setBounds( 40, 100, 500, 200 );
                   introJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 18 ) );
                   introJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(introJLabel);
                   //set up head JLabel
                   headJLabel = new JLabel();
                   headJLabel.setIcon( new ImageIcon( "head.jpeg") );
                   headJLabel.setBounds( 540, 5, 40, 160 );
                   headJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(headJLabel);
                        //setup girlJLabel
                   girlJLabel = new JLabel();
                   girlJLabel.setIcon( new ImageIcon( "girl.Jjpeg") );
                   girlJLabel.setBounds( 5, 10, 60, 100 );
                   girlJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(girlJLabel);
                        //set up startJbutton
                   startJButton = new JButton();
                   startJButton.setText( "Start" );
                   startJButton.setBounds(250, 300, 100, 30);
                   startJButton.setFont( new Font( "SansSerif", Font.BOLD, 14) );
                   welcomeJPanel.add(startJButton);
                   contentPane.add(welcomeJPanel);
                   startJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  question();
              public void question()
                   //set up question one JPanel
                   welcomeJPanel.setVisible(false);
                   questiononeJPanel = new JPanel();
         questiononeJPanel.setLayout( null );
              questiononeJPanel.setBounds(0, 0, 600,400);
              questiononeJPanel.setBackground( Color.GREEN );
              // set up textJLabel
              textJLabel = new JLabel();
              textJLabel.setText( "Who did Beckham supposedly cheat with?" );
              textJLabel.setLocation( 20, 20);
              textJLabel.setSize( 550, 70);
              textJLabel.setFont( new Font( "SansSerif", Font.BOLD, 20 ) );
              textJLabel.setHorizontalAlignment( JLabel.CENTER );
              questiononeJPanel.add( textJLabel );
                   // set up presetJPanel
              becksJPanel = new JPanel();
              becksJPanel.setLayout( null );
              becksJPanel.setBorder( new TitledBorder(
         "Question 1" ) );
              becksJPanel.setBounds( 10, 10, 570, 80 );
              becksJPanel.setBackground( Color.GRAY );
              questiononeJPanel.add( becksJPanel );
                   // set up oneJButton
              oneJButton = new JButton();
              oneJButton.setBounds( 10, 120, 300, 40 );
              oneJButton.setText( "Britney Spears" );
              oneJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( oneJButton );
              // set up twoJButton
              twoJButton = new JButton();
              twoJButton.setBounds( 10, 180, 300, 40 );
              twoJButton.setText( "Meg Ryan" );
              twoJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( twoJButton );
              // set up threeJButton
              threeJButton = new JButton();
              threeJButton.setBounds( 10, 240, 300, 40 );
              threeJButton.setText( "Rebecca Loos" );
              threeJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( threeJButton );
              // set up fourJButton
              fourJButton = new JButton();
              fourJButton.setBounds( 10, 300, 300, 40 );
              fourJButton.setText( "Angelina Jolie" );
              fourJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( fourJButton );
                   // set up nextJButton
                   nextJButton = new JButton();
                   nextJButton.setBounds ( 375, 300, 150, 40 );
                   nextJButton.setText("Next");
                   nextJButton.setBackground( Color.GRAY );
                   questiononeJPanel.add( nextJButton );
                   contentPane.add(questiononeJPanel);
              nextJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  questiontwo();
              public void questiontwo()
                   //set up question two JPanel
                   questiononeJPanel.setVisible(false);
                   questiontwoJPanel=new JPanel();
                   questiontwoJPanel.setLayout(null);
                   questiontwoJPanel.setBounds(0, 0, 600, 400);
                   questiontwoJPanel.setBackground( Color.GREEN );
                   // set up q2JLabel
              q2JLabel = new JLabel();
              q2JLabel.setBounds( 20, 20, 550, 70 );
              q2JLabel.setText( "What films has Orlando Bloom starred in?" );
              q2JLabel.setFont(new Font( "SansSerif", Font.BOLD, 20 ) );
         q2JLabel.setHorizontalAlignment( JLabel.CENTER );
    questiontwoJPanel.add(q2JLabel);
    //set up orlandoJPanel
    orlandoJPanel = new JPanel();
    orlandoJPanel.setLayout(null);
    orlandoJPanel.setBorder( new TitledBorder("Question 2"));
    orlandoJPanel.setBounds( 10, 10, 570, 80);
    orlandoJPanel.setBackground(Color.GRAY);
    questiontwoJPanel.add(orlandoJPanel);
    // set up lordJCheckBox
              lordJCheckBox = new JCheckBox();
              lordJCheckBox.setBounds( 16, 112, 200, 24 );
              lordJCheckBox.setText( "1. Lord of The Rings" );
              questiontwoJPanel.add( lordJCheckBox );
                   // set up faceJCheckBox
              faceJCheckBox = new JCheckBox();
              faceJCheckBox.setBounds( 16, 159, 200, 24 );
              faceJCheckBox.setText( "2. Face Off" );
              questiontwoJPanel.add( faceJCheckBox );
              // set up piratesJCheckBox
              piratesJCheckBox = new JCheckBox();
              piratesJCheckBox.setBounds( 16, 206, 200, 24 );
              piratesJCheckBox.setText( "3. Pirates of The Caribean" );
              questiontwoJPanel.add( piratesJCheckBox );
              // set up inputJButton
              inputJButton = new JButton();
              inputJButton.setBounds(20, 256, 200, 21 );
              inputJButton.setText( "Input answer" );
              questiontwoJPanel.add( inputJButton );
    inputJButton.addActionListener(
         new ActionListener()
              //event handler called when user clicks inputJButton
              public void actionPerformed( ActionEvent event )
                   inputJButtonActionPerformed( event);
    //show JOptionMessages when user clicks on JCheckBoxes and inputJButton
    public void inputJButtonActionPerformed( ActionEvent event )
         //display error message if no JCheckBoxes is checked
         if ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected() && !piratesJCheckBox.isSelected() ) )
              //display error message
              JOptionPane.showMessageDialog( null, "Please check two boxes", JOptionPane.ERROR_MESSAGE );
         // if lordjcheckbox and pirates is selected = right
         else
              if ( ( lordJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                   JOptionPane.showMessageDialog(null, "Thats RIGHT!");
              //if others are selected = wrong
              else
                   if ( (lordJCheckBox.isSelected() && faceJCheckBox.isSelected() ))
                        JOptionPane.showMessageDialog(null, "Thats WRONG");
                   else
                        ( (faceJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                             JOptionPane.showMessageDialog(null, "Thats WRONG");
    // set up nest2JButton
              next2JButton = new JButton();
              next2JButton.setBounds( 155, 296, 94, 24 );
              next2JButton.setText( "Next" );
              questiontwoJPanel.add( next2JButton );
    contentPane.add(questiontwoJPanel);
    next2JButton.addActionListener(
         new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   questionthree();
    } // end questiontwo
    public void questionthree()
         //setup questionthree JPanel
         questiontwoJPanel.setVisible(false);
         questionthreeJPanel = new JPanel();
         questionthreeJPanel.setLayout(null);
         questionthreeJPanel.setBounds(0, 0, 600, 400);
         questionthreeJPanel.setBackground( Color.GREEN);
              // main method
              public static void main( String[] args )
              Mindboggler application = new Mindboggler();
              application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              } // end method main
    }// end class
    WOULD BE VERY GEATFUL

    Just want to say thank you by the way for trying to help. Ive moved public void inputJButtonActionPerformed( ActionEvent event ) outside of brackets. Now i have a different problem on it. Sorry about this.
    PROBLEM: --------------------Configuration: <Default>--------------------
    C:\Documents and Settings\Laila\My Documents\CMT2080\Coursework\Game\Mindboggler.java:353: 'else' without 'if'
    else ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected && !piratesJCheckBox.isSelected() ) )
    ^
    1 error
    Process completed.
    MY CODE:
    //Mind boggler quiz
    //Marcelyn Samson
    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.lang.*;
    public class Mindboggler extends JFrame
              // JPanel for welcome window
              private JPanel welcomeJPanel;
              private JPanel presetJPanel;
         private JLabel titleJLabel;
         private JLabel quizJLabel;
         private JLabel girlJLabel, headJLabel;
         private JLabel introJLabel;
         private JButton startJButton;
         // JPanel for questionone window
         private JPanel questiononeJPanel;
         private JLabel textJLabel;
         private JPanel becksJPanel;
         private JButton oneJButton, twoJButton, threeJButton, fourJButton, nextJButton;
              //JPanel for questiontwo window
              private JPanel questiontwoJPanel;
              private JPanel orlandoJPanel;
              private JLabel q2JLabel;
              private JCheckBox lordJCheckBox;
              private JCheckBox faceJCheckBox;
              private JCheckBox piratesJCheckBox;
              private JButton next2JButton;
         private JButton inputJButton;
         //JPanel for questionthree
         private JPanel questionthreeJPanel;
         private JPanel howmuchJPanel;
         private JLabel howmuchJLabel;
         private JLabel nameJLabel;
         private JTextField nameJTextField;
         private JLabel moneyJLabel;
         private JTextField moneyJTextField;
         private JButton next3JButton;
         //Publics
         public JPanel welcomeJFrame, questionJFrame, questiontwoJFrame, questionthreeJFrame;
         //contentPane
              public Container contentPane;
              //no argument constructor
              public Mindboggler()
                   createUserInterface();
              //create and position components
              private void createUserInterface()/////////////////////////; semo colon do not edit copy paste
                   //get contentPane and set layout to null
                   contentPane = getContentPane();
                   contentPane.setLayout ( null );
                   welcome();
                   //set properties of applications window
                   setTitle( "Mindboggler" ); // set JFrame's title bar string
              setSize( 600, 400 ); // set width and height of JFrame
              setVisible( true ); // display JFrame on screen
              } // end method createUserInterface
              public void welcome(){
                        // set up welcomeJPanel
                   welcomeJPanel = new JPanel();
                   welcomeJPanel.setLayout( null );
                   welcomeJPanel.setBounds(0, 0, 600, 400);
                   welcomeJPanel.setBackground( Color.GREEN );
                   // set up textJLabel
                   titleJLabel = new JLabel();
                   titleJLabel.setText( "Mind Boggler" );
                   titleJLabel.setLocation( 30, 10);
                   titleJLabel.setSize( 550, 70);
                   titleJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 30 ) );
                   titleJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add( titleJLabel );
                   // set up presetJPanel
                   presetJPanel = new JPanel();
                   presetJPanel.setLayout( null );
                   presetJPanel.setBounds( 150, 10, 300, 80 );
                   presetJPanel.setBackground( Color.GRAY );
                   welcomeJPanel.add( presetJPanel );
                   //setup Intro JLabel
                   introJLabel = new JLabel();
                   introJLabel.setText( "Think, think, think. Can you get all the questions right?" );
                   introJLabel.setBounds( 40, 100, 500, 200 );
                   introJLabel.setFont( new Font( "SansSerif", Font.PLAIN, 18 ) );
                   introJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(introJLabel);
                   //set up head JLabel
                   headJLabel = new JLabel();
                   headJLabel.setIcon( new ImageIcon( "head.jpeg") );
                   headJLabel.setBounds( 540, 5, 40, 160 );
                   headJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(headJLabel);
                        //setup girlJLabel
                   girlJLabel = new JLabel();
                   girlJLabel.setIcon( new ImageIcon( "girl.Jjpeg") );
                   girlJLabel.setBounds( 5, 10, 60, 100 );
                   girlJLabel.setHorizontalAlignment( JLabel.CENTER );
                   welcomeJPanel.add(girlJLabel);
                        //set up startJbutton
                   startJButton = new JButton();
                   startJButton.setText( "Start" );
                   startJButton.setBounds(250, 300, 100, 30);
                   startJButton.setFont( new Font( "SansSerif", Font.BOLD, 14) );
                   welcomeJPanel.add(startJButton);
                   contentPane.add(welcomeJPanel);
                   startJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  question();
              public void question()
                   //set up question one JPanel
                   welcomeJPanel.setVisible(false);
                   questiononeJPanel = new JPanel();
         questiononeJPanel.setLayout( null );
              questiononeJPanel.setBounds(0, 0, 600,400);
              questiononeJPanel.setBackground( Color.GREEN );
              // set up textJLabel
              textJLabel = new JLabel();
              textJLabel.setText( "Who did Beckham supposedly cheat with?" );
              textJLabel.setLocation( 20, 20);
              textJLabel.setSize( 550, 70);
              textJLabel.setFont( new Font( "SansSerif", Font.BOLD, 20 ) );
              textJLabel.setHorizontalAlignment( JLabel.CENTER );
              questiononeJPanel.add( textJLabel );
                   // set up presetJPanel
              becksJPanel = new JPanel();
              becksJPanel.setLayout( null );
              becksJPanel.setBorder( new TitledBorder(
         "Question 1" ) );
              becksJPanel.setBounds( 10, 10, 570, 80 );
              becksJPanel.setBackground( Color.GRAY );
              questiononeJPanel.add( becksJPanel );
                   // set up oneJButton
              oneJButton = new JButton();
              oneJButton.setBounds( 10, 120, 300, 40 );
              oneJButton.setText( "Britney Spears" );
              oneJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( oneJButton );
              // set up twoJButton
              twoJButton = new JButton();
              twoJButton.setBounds( 10, 180, 300, 40 );
              twoJButton.setText( "Meg Ryan" );
              twoJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( twoJButton );
              // set up threeJButton
              threeJButton = new JButton();
              threeJButton.setBounds( 10, 240, 300, 40 );
              threeJButton.setText( "Rebecca Loos" );
              threeJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( threeJButton );
              // set up fourJButton
              fourJButton = new JButton();
              fourJButton.setBounds( 10, 300, 300, 40 );
              fourJButton.setText( "Angelina Jolie" );
              fourJButton.setBackground( Color.ORANGE );
              questiononeJPanel.add( fourJButton );
                   // set up nextJButton
                   nextJButton = new JButton();
                   nextJButton.setBounds ( 375, 300, 150, 40 );
                   nextJButton.setText("Next");
                   nextJButton.setBackground( Color.GRAY );
                   questiononeJPanel.add( nextJButton );
                   contentPane.add(questiononeJPanel);
              nextJButton.addActionListener(
                        new ActionListener(){
                             public void actionPerformed(ActionEvent e){
                                  questiontwo();
              public void questiontwo()
                   //set up question two JPanel
                   questiononeJPanel.setVisible(false);
                   questiontwoJPanel=new JPanel();
                   questiontwoJPanel.setLayout(null);
                   questiontwoJPanel.setBounds(0, 0, 600, 400);
                   questiontwoJPanel.setBackground( Color.GREEN );
                   // set up q2JLabel
              q2JLabel = new JLabel();
              q2JLabel.setBounds( 20, 20, 550, 70 );
              q2JLabel.setText( "What films has Orlando Bloom starred in?" );
              q2JLabel.setFont(new Font( "SansSerif", Font.BOLD, 20 ) );
         q2JLabel.setHorizontalAlignment( JLabel.CENTER );
    questiontwoJPanel.add(q2JLabel);
    //set up orlandoJPanel
    orlandoJPanel = new JPanel();
    orlandoJPanel.setLayout(null);
    orlandoJPanel.setBorder( new TitledBorder("Question 2"));
    orlandoJPanel.setBounds( 10, 10, 570, 80);
    orlandoJPanel.setBackground(Color.GRAY);
    questiontwoJPanel.add(orlandoJPanel);
    // set up lordJCheckBox
              lordJCheckBox = new JCheckBox();
              lordJCheckBox.setBounds( 16, 112, 200, 24 );
              lordJCheckBox.setText( "1. Lord of The Rings" );
              questiontwoJPanel.add( lordJCheckBox );
                   // set up faceJCheckBox
              faceJCheckBox = new JCheckBox();
              faceJCheckBox.setBounds( 16, 159, 200, 24 );
              faceJCheckBox.setText( "2. Face Off" );
              questiontwoJPanel.add( faceJCheckBox );
              // set up piratesJCheckBox
              piratesJCheckBox = new JCheckBox();
              piratesJCheckBox.setBounds( 16, 206, 200, 24 );
              piratesJCheckBox.setText( "3. Pirates of The Caribean" );
              questiontwoJPanel.add( piratesJCheckBox );
              // set up inputJButton
              inputJButton = new JButton();
              inputJButton.setBounds(20, 256, 200, 21 );
              inputJButton.setText( "Input answer" );
              questiontwoJPanel.add( inputJButton );
    inputJButton.addActionListener(
         new ActionListener()
              //event handler called when user clicks inputJButton
              public void actionPerformed( ActionEvent event )
                   inputJButtonActionPerformed( event);
    // set up nest2JButton
              next2JButton = new JButton();
              next2JButton.setBounds( 155, 296, 94, 24 );
              next2JButton.setText( "Next" );
              questiontwoJPanel.add( next2JButton );
    contentPane.add(questiontwoJPanel);
    next2JButton.addActionListener(
         new ActionListener(){
              public void actionPerformed(ActionEvent e){
                   questionthree();
    } // end questiontwo
    public void questionthree()
         //setup questionthree JPanel
         questiontwoJPanel.setVisible(false);
         questionthreeJPanel = new JPanel();
         questionthreeJPanel.setLayout(null);
         questionthreeJPanel.setBounds(0, 0, 600, 400);
         questionthreeJPanel.setBackground( Color.GREEN);
         //setup howmuchJLabel
         howmuchJLabel = new JLabel();
         howmuchJLabel.setText("I'm a student and would be very greatful if you could donate some money as it would help me very much.");
         howmuchJLabel.setBounds(20, 20, 550, 70);
         howmuchJLabel.setFont(new Font("SansSerif",Font.BOLD,14));
         howmuchJLabel.setHorizontalAlignment(JLabel.CENTER);
         questionthreeJPanel.add(howmuchJLabel);
         //setup howmuchJPanel
         howmuchJPanel = new JPanel();
         howmuchJPanel.setLayout(null);
         howmuchJPanel.setBorder( new TitledBorder("Question 3"));
         howmuchJPanel.setBounds(10, 10, 570, 80);
         howmuchJPanel.setBackground( Color.GRAY);
         questionthreeJPanel.add(howmuchJPanel);
         //setup nameJLabel
         nameJLabel = new JLabel();
         nameJLabel.setText("Name");
         nameJLabel.setBounds(10, 160, 150, 24);
         nameJLabel.setFont(new Font("SansSerif",Font.BOLD,12));
         questionthreeJPanel.add(nameJLabel);
         //setup nameJTextField
         nameJTextField = new JTextField();
         nameJTextField.setBounds(125, 160, 200, 24 );
         questionthreeJPanel.add(nameJTextField);
         contentPane.add(questionthreeJPanel);
         //show JOptionMessages when user clicks on JCheckBoxes and inputJButton
    public void inputJButtonActionPerformed( ActionEvent event )
         //display error message if no JCheckBoxes is checked
         else ( ( !lordJCheckBox.isSelected() && !faceJCheckBox.isSelected && !piratesJCheckBox.isSelected() ) )
              //display error message
              JOptionPane.showMessageDialog( null, "Please check two boxes", JOptionPane.ERROR_MESSAGE );
         // if lordjcheckbox and pirates is selected = right
         else
              if ( ( lordJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                   JOptionPane.showMessageDialog(null, "Thats RIGHT!");
              //if others are selected = wrong
              else
                   if ( (lordJCheckBox.isSelected() && faceJCheckBox.isSelected() ))
                        JOptionPane.showMessageDialog(null, "Thats WRONG");
                   else
                        ( (faceJCheckBox.isSelected() && piratesJCheckBox.isSelected() ))
                             JOptionPane.showMessageDialog(null, "Thats WRONG");
              // main method
              public static void main( String[] args )
              Mindboggler application = new Mindboggler();
              application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              } // end method main
    }// end class

  • Someone meet the problem, I am not abble install mac OS 10.6 snow leopard on intel based machine, (intel core 2 duo, 2,8 ghz, 4GB RAM, 320 GB HDD, OSX 10.5.8) system every time wrote "OS X snow leopard cannot be install on this machine" please help, Majo

    omeone meet the problem, I am not abble install mac OS 10.6 snow leopard on intel based machine, (intel core 2 duo, 2,8 ghz, 4GB RAM, 320 GB HDD, OSX 10.5.8) system every time wrote "OS X snow leopard cannot be install on this machine" please help, Majo

    It is retail disk, i bought it in apple store. I also resetter PRRAM and SMC and checked disk. I also tried clean installation and upgrade, nothing works, after run installation program after few seconds wrote: OS X Snow Leopard cannot be install on this machine :-(
    Thank you for your answer
    Majo

  • Please?!? Cannot Resolve Symbol Error Message

    //Elizabeth Skelton Section 001 Homework Set 3
    import javax.swing.JOptionPane;
    public class skeltonMaxofThree
         public static void main (String[] args)
              //ask user for numbers
              String stringnum1= JOptionPane.showInputDialog(null, "Please enter first number", "Input", JOptionPane.QUESTION_MESSAGE);
              String stringnum2=JOptionPane.showInputDialog(null, "Please enter second number", "Input", JOptionPane.QUESTION_MESSAGE);
              String stringnum3=JOptionPane.showInputDialog(null, "Please enter third number", "Input", JOptionPane.QUESTION_MESSAGE);
              //convert to numerical
              double num1=Double.parseDouble(stringnum1);
              double num2=Double.parseDouble(stringnum2);
              double num3=Double.parseDouble(stringnum3);
              //call max method
              double biggest=maximum(num1,num2,num3);
              //display answer
              String output = "The biggest is " + biggest;
              JOptionPane.showMessageDialog(null, output, "Result", JOptionPane.INFORMATION_MESSAGE);
              System.exit(0);
         public static double maximum(double num1, double num2, double num3)
              //determine biggest
              double biggest=Math.max(num1,num2,num3);
              return biggest;
    Returns error:
    :\My Documents\BD120\skeltonMaxofThree.java:36: cannot resolve symbol
    symbol : method max (double,double,double)
    location: class java.lang.Math
              double biggest=Math.max(num1,num2,num3);
    ^
    1 error
    Tool completed with exit code 1

    the max method of the Math class requires 2 parameters not 3...to find the maximum of 3 numbers u can do something like this...
    double biggest = Math.max(num1, Math.max(num2, num3));

  • "cannot resolve symbol" help..

    Here is a very short and simpel program that won't compile after I reinstalled java on my computer.
    import java.lang.Math.*;
    import java.awt.*;
    public class PiTest extends Frame {
         public static void main(String[] p){
         System.out.println("testing MATHs");
         System.out.println(""+sin(10));
    I get the following error:
    PiTest.java:8: cannot resolve symbol
    symbol : method sin (int)
    location: class PiTest
    System.out.println(""+sin(10));
    ^
    [total 1553ms]
    1 error
    Why doesn't the compiler recognise the sine function? I have set my classpath to c:\j2sdk1.4.1_01\lib.
    I don't know what I'm doing wrong...

    Replace sin(10) with Math.sin(10), it should work.
    import java.lang.Math.*;
    import java.awt.*;
    public class PiTest extends Frame {
    public static void main(String[] p){
    System.out.println("testing MATHs");
    //System.out.println(""+sin(10));
    System.out.println(""+Math.sin(10));

  • BufferedReader cannot resolve symbol

    Hi,
    I need some help with a java program which reads xml files to a specified location, running it on a UNIX machine using Java 1.4.1. I modified the code to include the BufferedReader class, but it keeps complaining about not being able to resolve symbol at line 50 & 53. Any help here would be appreciated, since I'm a newbie.
    bash-2.05$ javac outputScript.java
    outputScript.java:50: cannot resolve symbol
    symbol : constructor InputStreamReader (java.lang.String)
    location: class java.io.InputStreamReader
    BufferedReader in = new BufferedReader(new InputStreamReader("in"));
    ^
    outputScript.java:53: cannot resolve symbol
    symbol : method available ()
    location: class java.io.BufferedReader
    while (in.available() !=0)
    Here's the code:
    //package cognos8_3;
    import java.io.*;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.File;
    * outputScript.java
    * Copyright Cognos Incorporated. All Rights Reserved.
    * Cognos and the Cognos logo are trademarks of Cognos Incorporated.
    * Description: (KB 1013700) - Sample script that will rename output files generated by CM.OUTPUTLOCATION - Cognos 8.3
    class outputScript
    public static void main(String args[])
         String reportName = "";
         String reportViewName = "";
         String outputLocation = "/data/cognos/rn_filecp/";
         String defName = "";
         String ofTime = "";
         String burstKey = "";
         int countRenamed = 0;
         // get the list of desc files in the outputlocation
         File descFiles = new File(outputLocation);
         String[] children = descFiles.list();
         if (children == null || children.length == 0)
              System.out.println("Invalid file location or no reports found to rename.");
         else
                   System.out.println("Found " + children.length + " files in this location, search for file names containing '_desc.'.");
              for (int i=0; i<children.length; i++)
                   try
                        // Get filename of file or directory
                        String filename = children;
                        if (filename.indexOf("_desc.")>=0)
                             // Open the file that is the first
                             // command line parameter
                             FileInputStream fstream = new FileInputStream(outputLocation+filename);
                             FileInputStream bis = new FileInputStream(fstream);
                                  BufferedReader in = new BufferedReader(new InputStreamReader("bis.in"));
                             //      Continue to read lines while there are still some left to read
                             while (in.available() !=0)
                                  String temp = in.readLine();
                                  System.out.println(temp);
                                  // check for report name
                                  if (temp.indexOf("report[@name=")>0)
                                       // get beginning of name
                                       int startIndex = temp.indexOf("report[@name=&apos;");
                                       String startString;
                                       int endIndex = 0;
                                       if (startIndex > 0)
                                            startString = temp.substring(startIndex);
                                            startIndex = startString.indexOf("&apos;") + 5; //&apos; 6 characters
                                            endIndex = startString.lastIndexOf("&apos;");
                                       else
                                            startIndex = temp.indexOf("report[@name=");
                                            startString = temp.substring(startIndex);
                                            startIndex = startString.indexOf("@name=") + 6; //&apos; 6 characters
                                            endIndex = startString.lastIndexOf("]");
                                       // get report name
                                       reportName = startString.substring(startIndex+1, endIndex);
                                       //System.out.println("Found report name - " + reportName);
                                  else if (temp.indexOf("reportView[@name=")>0)
                                       // get beginning of name
                                       int startIndex = temp.indexOf("reportView[@name=&apos;");
                                       String startString;
                                       int endIndex = 0;
                                       if (startIndex > 0)
                                            startString = temp.substring(startIndex);
                                            startIndex = startString.indexOf("&apos;") + 5; //&apos; 6 characters
                                            endIndex = startString.lastIndexOf("&apos;");
                                       else
                                            startIndex = temp.indexOf("reportView[@name=");
                                            startString = temp.substring(startIndex);
                                            startIndex = startString.indexOf("@name=") + 6; //&apos; 6 characters
                                            endIndex = startString.lastIndexOf("]");
                                       // get report name
                                       reportViewName = startString.substring(startIndex+1, endIndex);
                                       //System.out.println("Found reportView name - " + reportViewName);
                                  else if (temp.indexOf("</fileName>")>0) //check for default name
                                       defName = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
                                  else if (temp.indexOf("asOfTime")>=0) // get the time to assure uniqueness when saving
                                       ofTime = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
                                       // clean colons from time
                                       ofTime = ofTime.replaceAll(":","_");
                                  else if (temp.indexOf("</burstKey>")>=0)
                                       burstKey = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
                             in.close();
                             if (reportName.length() == 0)
                                  reportName = reportViewName;
                                  //System.out.println("Renaming using view name - no report name found");
                                       String format = defName.substring(defName.length()-3, defName.length());
                             // new description xml file
                                       File file = new File(outputLocation+filename);
                             File newDescFile = new File(outputLocation + reportName+"_"+burstKey+"_"+ofTime+"DESC_" + format+ ".xml");
                                       // new renamed specific format file.
                             File file3 = new File(outputLocation+defName);
                             File newDefFile = new File(outputLocation + reportName+"_"+burstKey+"_"+ofTime+"."+format);
                             boolean success = file3.renameTo(newDefFile);
                             if (!success)
                                  // File was not successfully renamed
                                  System.out.println("ERROR attempting to rename - " + file3.getAbsolutePath() + " to \n\t\t" +
                                            newDefFile.getAbsolutePath());
                             else
                                  countRenamed++;
                                  // File was successfully renamed
                                  System.out.println(countRenamed +") Renamed - " + file3.getAbsolutePath() + " to \n\t\t" +
                                            newDefFile.getAbsolutePath());
                             // Rename file (or directory)
                             success = file.renameTo(newDescFile);
                             if (!success)
                                  // File was not successfully renamed
                                  System.out.println("ERROR attempting to rename - " + file.getAbsolutePath() + " to \n\t\t" +
                                            newDescFile.getAbsolutePath());
                             else
                                  // File was successfully renamed
                                  System.out.println(" - " + file.getAbsolutePath() + " to \n\t\t" +
                                            newDescFile.getAbsolutePath());
                   catch (Exception e)
                        System.err.println("File input error " + e.getMessage()) ;
         System.out.println("Complete.");
    Thanks,
    Nick
    Edited by: nickmills on Aug 31, 2008 5:05 PM

    First, you only need to create the FileInputStream once. Then that's what you pass to the InputStreamReader constructor. Your code for reading from the BufferedReader is also wrong.FileInputStream fstream = new FileInputStream(outputLocation+filename);
    // FileInputStream bis = new FileInputStream(fstream);  <-- remove this line
    BufferedReader in = new BufferedReader(new InputStreamReader(fstream));
    // available() doesn't do what you think it does; forget about it.
    // Here's the standard way to use a BufferedReader
    String line = null;
    while ((line = in.readLine()) != null)
      // process 'line'
    } There are probably other errors in the code, but reading all that unformatted code is too much of a hassle. In future, please use &#x7B;code} tags when posting source code.

  • Cannot resolve symbol when the classes are in the same package

    i have one interface and two classes all in the same package. am getting " cannot resolve symbol", when the code refers to the interface or the class .
    the package name is collections.impl and
    the directory i used to store all the java files:
    c:\jdk\bin\collections\impl.
    isthere any othe option other than compiling all the files from the comand line at the same time?
    please help - i m new to java.

    If you have:
    I.java:
    package some;
    public interface I {
        void method();
    }A.java:
    package some;
    public class A implements I {
        public void method() {
            new B();
    }B.java:
    package some;
    public class B implements I {
        public void method() {
            new A();
    }in c:/temp/some for example
    you can compile your files with
    javac c:/temp/some/*.java
    It seems that you have errors in your code.
    Recheck it twice or use NetBeans IDE(http://www.netbeans.org) it will do this for you ;)

Maybe you are looking for

  • Email Spool Very Slow

    Just migrated my site from CF 4.5 to CFMX7 on a new server. Wow! MX7 fills the spool with our 7K+ emails in a flash! Used to take 20 minutes on CF 4.5! But MX7 is very slow on the outbound side! CF4.5 used to send 100 emails per spool cycle to the em

  • Issues with animated rollovers

    I am having trouble figuring out how to use ImageReady to make my navigation menu. I want several links all with normal, over, and down states. On the down state a sub menu should animate in and provide sub links to pages within each category. The pr

  • At line selection in module pool

    Hello Experts. I am working on module pool. I have created a transaction where I need to create a order number when I press the 'SAVE' button. My order number is getting created but my issue is I need to call a transaction when I click on this order

  • Formular and back

    Hello my problem in some sentences i have a form with one textfield now i fill the field and submit the form so i get on the result page now i use the back button of the browser so i am back on the first site in the text field still is standing what

  • Dynamic logo doesn't appear for multiple outbound payments in IBY

    Product: BI Publisher 10.1.2.3 Oracle Payments (IBY) 12.1.3 Logo for each organization on check printing appears correctly for single outbound payment but for multiple outbound payments, it doesn't appear. Any help would be greatly appearciated. Than