Can not resolve symbol in method showMessageDialog

I tried to dispaly a mesg using JOptionPane, it gives error mesg like
HWS.java:27: cannot resolve symbol
symbol : method showMessageDialog (<anonymous java.awt.event.ActionListener>,j
ava.lang.String,java.lang.String,int)
location: class javax.swing.JOptionPane
JOptionPane.showMessageDialog (this, "The","Exit", JOptionPane.INFORMATION_M
ESSAGE);
^
pls help.
Sabarish
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class HWS extends JFrame{
public HWS() {
super("Learning...");
setSize(300,300);
JLabel label2 = new JLabel("Jegan Rao");
JButton button = new JButton("Click here");
Container pane = getContentPane();
pane.setLayout(new FlowLayout());
pane.add(button);
pane.add(label2);
ActionListener al = new ActionListener(){
public void actionPerformed (ActionEvent ae){
JOptionPane.showMessageDialog (this, "The","Exit", JOptionPane.INFORMATION_MESSAGE);
button.setHorizontalAlignment(JButton.CENTER);
button.addActionListener(al);
button.setVerticalAlignment(JButton.CENTER);
label2.setHorizontalAlignment(JLabel.CENTER);
label2.setVerticalAlignment(JLabel.CENTER);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
public static void main(String [] args){
HWS h = new HWS();
}

Please post code using the code tags. There is a code button when you enter text for your message. Click on it then paste your code between the tags.
All of the JOptionPane showMessageDialog() methods require a Component as the first object argument. Your code calls showMessageDialog from inside an actionPerformed() method, which is inside an ActionListener. So 'this' is an ActionListener, not a JFrame or other Component.
Are you sure you want to call up a dialog in an actionPerformed() method? This method is called from the event thread, and blocks this thread until the dialog completes. This means no events can occur until the dialog completes, but it may require an event to complete the dialog.

Similar Messages

  • Error in Hashtable put method-Can not resolve symbol

    Hi there!I am new to using java.util.Hashtable.
    I am using it for a command line instant messaging program for holding the list of clients and list of client names currently connected to the server.
    However when I compile my server with the command javac server.java it seems to give errors can not resolve symbol method put (java.lang.object,int).
    Here is my code for my server:
    * @(#)server.java
    * @author
    * @version 1.00 2008/3/22
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.util.*;
    public class server {
              static int key1=0;
              static Hashtable nameHolder=new Hashtable();
              //static ArrayList nameHolder=new ArrayList();
              //static ArrayList clientsConnected =new ArrayList();
              static Hashtable clientsConnected =new Hashtable();
         public static void main(String[] args) throws IOException {
              //nameHolder.add("controlelement");
              Socket connect=null;
              String name =null;
              PrintWriter out=null;
              BufferedReader in =null;
              String machinename;
              int port=0;
         ServerSocket serverSocket = null;
         serverSocket = new ServerSocket(2222);
         boolean listeningports = true;
         try {
                   if(args.length > 0)
                   port = Integer.parseInt(args[0]);
                   System.out.println(port);
                   else
                        System.out.println("You must enter port number");
                        System.exit(1);
                   while(true)
                             System.out.println("Hakan");
                             connect=serverSocket.accept();
                   in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                        System.out.println("Hakan");
                   String girdi = in.readLine();
                   StringTokenizer nameAl=new StringTokenizer(girdi);
                   String ad=null;
                   String host=null;
                   int portofclient=0;
                   int m=0;
                   while(nameAl.hasMoreTokens())
                        if(m==0)
                             ad=nameAl.nextToken();
                             System.out.println("Adim"+ad);
                        else if(m==1)
                             host=nameAl.nextToken();
                             System.out.println("Hostum"+host);
                        else if(m==2)
                             portofclient = Integer.parseInt(nameAl.nextToken());
                             System.out.println("Listening portum"+portofclient);
                             break;
                        m++;
                   out = new PrintWriter(connect.getOutputStream(), true);
                   System.out.println("Haso");
                   if(!isUsed(ad))
                        System.out.println(girdi);
                        System.out.println("H�so");
                        //Object fason=(Object)ad;
                        nameHolder.put(key1,ad);
    //The error seems to occur here
                        client myclient=new client(ad,host,portofclient);
                        //Object garson=(Object)myclient;
                        clientsConnected.put(key1,myclient);
                        key1++;
                        //clientInfoHolder.add(girdi);
                        out.println("Kullan&#305;mda");
                        System.out.println("Haso");
                        new MultiClientManager(connect).start();
                   else
                        //System.out.println("kulanilmaz");
                        out.println("Kullanim disi");
         catch(Exception e)
              System.out.println("You did not specify port number");
              System.out.println("Or connection was not established due to specifying invalid or used port");
              e.printStackTrace();
         public static boolean isUsed( String name )
                   if( nameHolder.containsValue(name) )
                        return true;
                   return false;
         public static client Ask(String name)
              ArrayList lombak=(ArrayList) clientsConnected.values();
              for(int i=0;i<lombak.size();i++)
                   client semsi = (client)lombak.get(i);
                   if(semsi.nickname.compareTo(name)==0)
                        return semsi;
              return null;
         public static int returnkeyoffromclients(String name)
              ArrayList lombak=(ArrayList)clientsConnected.values();
              for(int i=0;i<lombak.size();i++)
                   client semsi = (client)lombak.get(i);
                   if(semsi.nickname.compareTo(name)==0)
                        return i;
              return 0;
         public static int returnkeyoffromnames(String name)
              ArrayList lombak=(ArrayList)nameHolder.values();
              for(int i=0;i<lombak.size();i++)
                   String semsi = lombak.get(i).toString();
                   if(semsi.compareTo(name)==0)
                        return i;
              return 0;
    }

    Excuse me for not putting my code between tags. I am just sleepless.
    I am sending it again.
    * @(#)server.java
    * @author
    * @version 1.00 2008/3/22
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.util.*;
    public class server  {
              static int key1=0;
              static Hashtable nameHolder=new Hashtable();
              //static ArrayList nameHolder=new ArrayList();
              //static ArrayList clientsConnected =new ArrayList();
              static Hashtable clientsConnected =new Hashtable();
             public static void main(String[] args) throws IOException {
                  //nameHolder.add("controlelement");
                  Socket connect=null;
                  String name =null;
                  PrintWriter out=null;
                  BufferedReader in =null;
                  String machinename;
                  int port=0;
                 ServerSocket serverSocket = null;
                 serverSocket = new ServerSocket(2222);
                 boolean listeningports = true;
                 try {
                        if(args.length > 0)
                             port = Integer.parseInt(args[0]);
                             System.out.println(port);
                        else
                             System.out.println("You must enter port number");
                             System.exit(1);
                        while(true)
                                  System.out.println("Hakan");
                                   connect=serverSocket.accept();
                             in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                                  System.out.println("Hakan");
                             String girdi = in.readLine();
                             StringTokenizer nameAl=new StringTokenizer(girdi);
                             String ad=null;
                             String host=null;
                             int portofclient=0;
                             int m=0;
                             while(nameAl.hasMoreTokens())
                                  if(m==0)
                                       ad=nameAl.nextToken();
                                       System.out.println("Adim"+ad);
                                  else if(m==1)
                                       host=nameAl.nextToken();
                                       System.out.println("Hostum"+host);
                                  else if(m==2)
                                       portofclient = Integer.parseInt(nameAl.nextToken());
                                       System.out.println("Listening portum"+portofclient);
                                       break;
                                  m++;
                             out = new PrintWriter(connect.getOutputStream(), true);
                             System.out.println("Haso");
                             if(!isUsed(ad))
                                  System.out.println(girdi);
                                  System.out.println("H�so");
                                  //Object fason=(Object)ad;
                                  nameHolder.put(key1,ad);
                                  client myclient=new client(ad,host,portofclient);
                                  //Object garson=(Object)myclient;
                                  clientsConnected.put(key1,myclient);
                                  key1++;
                                  //clientInfoHolder.add(girdi);
                                  out.println("Kullan&#305;mda");
                                  System.out.println("Haso");
                                  new MultiClientManager(connect).start();
                             else
                                  //System.out.println("kulanilmaz");
                                  out.println("Kullanim disi");
                 catch(Exception e)
                      System.out.println("You did not specify port number");
                      System.out.println("Or connection was not established due to specifying invalid or used port");
                      e.printStackTrace();
             public static boolean isUsed( String name )
                       if( nameHolder.containsValue(name) )
                            return true;
                       return false;
             public static client Ask(String name)
                  ArrayList  lombak=(ArrayList) clientsConnected.values();
                  for(int i=0;i<lombak.size();i++)
                       client semsi = (client)lombak.get(i);
                       if(semsi.nickname.compareTo(name)==0)
                            return semsi;
                  return null;
             public static int returnkeyoffromclients(String name)
                  ArrayList lombak=(ArrayList)clientsConnected.values();
                  for(int i=0;i<lombak.size();i++)
                       client semsi = (client)lombak.get(i);
                       if(semsi.nickname.compareTo(name)==0)
                            return i;
                  return 0;
             public static int returnkeyoffromnames(String name)
                  ArrayList lombak=(ArrayList)nameHolder.values();
                  for(int i=0;i<lombak.size();i++)
                       String semsi = lombak.get(i).toString();
                       if(semsi.compareTo(name)==0)
                            return i;
                  return 0;
         These are the lines that are responsible from the error.
    nameHolder.put(key1,ad);
    client myclient=new client(ad,host,portofclient);
    //Object garson=(Object)myclient;
    clientsConnected.put(key1,myclient);

  • Can not resolve symbol? what is the problem with this braclet?

    Hi to all!
    I've got a problem understanding the output of javac. Here's the code and below the javac message.
    class ExtComboBoxUI extends BasicComboBoxUI
    private Object sourceBase;
    ExtComboBoxUI(Object source)
    --> {
    sourceBase = source;
    ExtComboBoxUI.java:28: cannot resolve symbol
    symbol : constructor BasicComboBoxUI ()
    location: class BasicComboBoxUI
    Could someone please give me an idea why javac cannot resolve this braclet?
    I am helpless - I really don't know how to get rid of this bug.
    Regards,
    LeaH

    Hi Leah,
    Please check whether you had included all the packages required for your program/application and also check that the packages has been set to the classpath.
    Specify the classpath and check once again.
    Regards,
    Anil.
    Technical Support Engineer.

  • Can not find symbol

    i am wrting a bean which has methods and i am passing that bean
    object to the method of another class but when i compile the second class i get the error can not find symbol and the method name of bean
    which i want to acces in second class.

    i a using Role.java bean in RoleManager.java the files are as follows
    and when compiling the RoleManager.java i get the above error by showing method getOrderby() can not find symbol
    /******** Role.java (bean class) ************************/
    package com.tattva.pms.employee;
    import java.beans.*;
    public class Role implements java.io.Serializable
    /** Holds value of property code. */
    private String code;
    /** Holds value of property type. */
    private String type;
    /** Holds value of property description. */
    private String description;
         /** Holds value of property orderby */
         private String orderby;
    /** Creates new Role */
    public Role() {
    /** Getter for property code.
    * @return Value of property code.
    public String getCode() {
    return code;
    /** Setter for property code.
    * @param code New value of property code.
    public void setCode(String code) {
    this.code = code;
    /** Getter for property type.
    * @return Value of property type.
    public String getType() {
    return type;
    /** Setter for property type.
    * @param type New value of property type.
    public void setType(String type) {
    this.type = type;
    /** Getter for property description.
    * @return Value of property description.
    public String getDescription() {
    return description;
    /** Setter for property description.
    * @param description New value of property description.
    public void setDescription(String description) {
    this.description = description;
         /** Getter for property code.
    * @return Value of property code.
    public String getOrderby() {
    return orderby;
    /** Setter for property code.
    * @param code New value of property code.
    public void setOrderby(String orderby) {
    this.orderby = orderby;
    /****************************RoleManager.java*************************
    package com.tattva.pms.employee;
    import com.tattva.pms.employee.*;
    //package com.tattva.pms.dept;
    import com.tattva.pms.database.*;
    //import com.tattva.pms.dept.*;
    import java.sql.*;
    import java.util.*;
         * Insert the type's description here.
         * Creation date: (5/22/02     1:53 PM)
         * @author: Sachin Bhansali
    //public class DeptManager
    public class RoleManager
         * The Declaration of the fields
         * to be used.
         * Decleration of Global variables
    //private ConnectionPool ovPool = null;
    //     private QueryManager ovQuery     = null;
         //private ResultSet ovResultSet     = null;
         private int rowCount          = 0;
    /** Creates new DeptManager */
    // public DeptManager()
         public RoleManager()
              super();
         * Creates new JobDtlManager
         * Commented constructor
    /* public DeptManager(ConnectionPool conPool)throws SQLException{
    ovPool = conPool;
    ovQuery = new QueryManager(ovPool);
    conPool = null;
         * throws exception PMSException and the general Exception
         * @param DeptBean contaning the details.
         // public int addDept(DeptBean dept)throws PMSException, Exception
         public int addRole(Role role)throws PMSException,Exception
              ConnectionPool ovPool = null;
              Connection ovCon = null;
              Statement ovStmt = null;
    String sqlStr = null;
    // The SQL query String
         /*     sqlStr = "Insert into DEPARTMENT_MST Name (V_CODE,V_NAME,V_LOCATION,V_FUNCTIONALITY, V_CREATED_BY) values ('"
                             + dept.getDeptCode() +"','" + dept.getDeptName() + "','" + dept.getDeptLoc() + "','" + dept.getDeptFun() +
                             "','" dept.getCreatedBy()"')";
         sqlStr = "Insert into ROLE_MST Name (V_CODE,V_TYPE,V_DESCRIPTION,N_ORDERBY) values "+
                        "('"+role.getCode()+"','"+role.getType()+"','"+role.getDescription()+"','"+role.getOrderby()+"')";
    //start of try block
                   try{
                        ovPool = new ConnectionPool();
                   // ovCon = ovPool.createConnection("DeptManager: addDept(DeptBean dept)");
                        ovCon = ovPool.createConnection();
                   ovStmt = ovCon.createStatement();
                        rowCount = ovStmt.executeUpdate(sqlStr);
                   return 0;
                   }catch(PMSException pmsEx){
                        throw pmsEx;
                   }catch(SQLException sqlEx){
    return sqlEx.getErrorCode();
                   }catch(Exception e){
                        //throw new PMSException("addJob() SQLException Wrapped! " + e.getMessage());
                        throw new PMSException("addRole() SQLException Wrapped! " + e.getMessage());
                   }finally{     
                        role=null;
                                  //dept = null;
                                  if(ovStmt != null)
    ovStmt.close();
                                  ovStmt =null;
                                  ovPool.close(ovCon);
    ovCon = null;
                                       ovPool =null;
    //end of try block
    }

  • HT204416 My Safari is no longer working with many sites.  However Chrome and Firefox work fine.  I would like to re-install Safari in an effort to clear up the problem I can not resolve.

    My Safari is no longer working with many sites.  However Chrome and Firefox work fine.  I would like to re-install Safari in an effort to clear up the problem I can not resolve.

    1. From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.
    2. Select
              Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data...
    and confirm. Test.
    3. If the above steps don't resolve the problem, please describe it in more detail.

  • Service 'Apple Mobile Device' failed to start. Verify that you have sufficient services. i have followed all fixes and can not resolve this problem?

    I can not get apple mobile device to activate. When reinstalling itunes it still comes up with, Service 'Apple Mobile Device' failed to start. Verify that you have sufficient services. I have followed all fixes and can not resolve this problem?

    Thanks to the suggestion of Doehunter the problem has been resolved

  • HT1918 I can not  change my payment method. My payment mothod said 'None' but I would like to change to visa type

    I can not  change my payment method. My payment mothod said 'None' but I would like to change to visa type. I did change actually but it said my credit card doesn't match with bank's information even I live in US and use Wells Fargo Bank.

    Have you contacted iTunes Support (these are user-to-user forums) ? If not then you can do so via this link and ask them why the message is appearing (we won't know why) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • OPA 10.4.1 on JBoss 6.1 - can not resolve path: plugins

    Having difficulties in deploying my web-determinations.war to JBoss 6.1.
    Same thing works well in OPM (Build and Debug).
    PS: Getting the same error when deploying the examples provided in the OPA Java Runtime.
    Any suggestions ?
    Error Log:
    2012-09-21 16:35:40,657 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6) 0 [ResourceContainer.invoker.nonDaemon-6] WARN com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext - Plugin directory could not be initialised. No plugins will be loaded
    2012-09-21 16:35:40,657 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6) java.lang.IllegalArgumentException: can not resolve path: plugins
    2012-09-21 16:35:40,657 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at com.oracle.util.plugins.PluginRegistry.addPluginsFromDir(PluginRegistry.java:118)
    2012-09-21 16:35:40,657 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext.init(WebDeterminationsServletContext.java:159)
    2012-09-21 16:35:40,658 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext.<init>(WebDeterminationsServletContext.java:116)
    2012-09-21 16:35:40,658 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at com.oracle.determinations.web.platform.servlet.WebDeterminationsServlet.init(WebDeterminationsServlet.java:73)
    2012-09-21 16:35:40,658 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1208)
    2012-09-21 16:35:40,659 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1108)
    2012-09-21 16:35:40,659 INFO [STDOUT] (ResourceContainer.invoker.nonDaemon-6)      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3628)
    Edited by: 960661 on Sep 21, 2012 1:43 PM

    Its working now, I assumed it wasn't working by looking at the logs. Accessing the rulebase "/JBossPOC/startsession/JBossPOC/" - i could see that plugin is working.
    Do i need to make any other changes to remove the following warnings ?
    12:12:52,522 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "JBossPOC.war"
    12:12:55,346 WARN [com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext] (MSC service thread 1-4) Plugin directory could not be initialised. No plugins will be loaded: java.lang.IllegalArgumentException: can not resolve path: plugins
         at com.oracle.util.plugins.PluginRegistry.addPluginsFromDir(PluginRegistry.java:118) [determinations-utilities.jar:]
         at com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext.init(WebDeterminationsServletContext.java:159) [web-determinations.jar:]
         at com.oracle.determinations.web.platform.servlet.WebDeterminationsServletContext.<init>(WebDeterminationsServletContext.java:116) [web-determinations.jar:]
         at com.oracle.determinations.web.platform.servlet.WebDeterminationsServlet.init(WebDeterminationsServlet.java:73) [web-determinations.jar:]
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
         at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
         at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
         at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07]
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07]
         at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07]

  • I can not resolve my billing problem with iTunes store in India

    I can not resolve my billing problem with iTunes store in India

    Hi there puttockjuan,
    You may find the troubleshooting steps in the article below helpful.
    iPod not recognized in My Computer and in iTunes for Windows
    http://support.apple.com/kb/ts1369
    -Griff W. 

  • Can not find symbol error

    I have imported javax.swing.*; and I have a listener for my JList box but when I say impliments ListSelectionListener the compiler says can not find symbol. Can anyone help me on this?

    ListSelectionListener is part of the javax.swing.event package, which is not the same as the javax.swing package.
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/event/ListSelectionListener.html

  • Two seperate class files can not resolve (pls help me) THANKS!

    When i compile UseMusic.java i get the following:
    i can't figure it out..
    Thank You for Time!
    D:\java\cENG310\Ass2>javac UseMusic.java
    UseMusic.java:29: cannot resolve symbol
    symbol  : variable middlec
    location: class UseMusic
                       mm.caldis(middlec);  // compute freqs
                                 ^
    UseMusic.java:42: cannot resolve symbol
    symbol  : variable middlec
    location: class UseMusic
             mm.setzero(middlec); // reset middlec to zero
                        ^
    UseMusic.java:56: caldis(java.lang.String[],double[],double) in Music cannot be appli
                      mm.caldis(middlec);  // compute freqs
                        ^
    UseMusic.java:81: checkvaild(java.lang.String[],java.lang.String) in Music cannot be
    a.lang.String)
                boolean cv = mm.checkvaild(strkey);
                               ^
    UseMusic.java:86: getfreq(java.lang.String[],java.lang.String) in Music cannot be app
    ang.String)
                   int index = mm.getfreq(strkey);
                                 ^
    5 errors
    *  Filename    : UseMusic.java
    import iopack.Io;
    import java.text.DecimalFormat;
    * UseMusic this class is
    public class UseMusic {
          public static void main(String[] args) {
             Music mm = new Music();
                   DecimalFormat fmt = new DecimalFormat("0.###"); // round output to 3 decimals places
             boolean newmidc = false;
             boolean notelookup = false;  
             System.out.println("\n\tMusical Scales");
             System.out.println("\t---------------");     // display the title and instructions
             System.out.println("\n\tDefault note values are:");  
                 mm.caldis(middlec);  // compute freqs
             System.out.println("\n\t************************");
             System.out.println("\t* Notes  *  Frequency  *");
             System.out.println("\t************************"); 
             // print old results
             for (int i = 0; i < mm.noteName.length; i ++) {
                        // display values onto screen
                System.out.println("\t* " + mm.noteName[i] + "\n");
                System.out.println("      " + mm.noteFreq[i] + " Hz *\n");     
             mm.setzero(middlec); // reset middlec to zero
             // prompt user for value of midddle c
             while (!newmidc) {
                   //read value new value for middle c
                   double middlec = Io.readDouble("\n\tEnter value for Middle C [Between 250 - 265] (Hz)");
                   // vaildate value for middlec
                   // vaild if valeu for middle is between 250-265
                   if ((middlec > 250) && (middlec < 265)) {
                      System.out.println("\n\tNew note values");
                      System.out.println("\n\t----------------\n");
                      mm.caldis(middlec);  // compute freqs
                      System.out.println("\n\t************************");
                      System.out.println("\t* Notes  *  Frequency  *");
                      System.out.println("\t************************"); 
                      // print old results
                      for (int i = 0; i < mm.noteName.length; i ++) {
                            // display values onto screen
                            System.out.println("\t* " + mm.noteName[i] + "\n");
                            System.out.println("      " + mm.noteFreq[i] + " Hz *\n");     
                      break;   // get out of while
                   else {
                         System.out.println("\nError Invaild Input!\nValue must be between 250 Hz to 265 Hz.");         
                   } //end of else
             } // end of while for newmidc
             // prompt user for note
             while (!notelookup) {
                //read value new value for
                String strkey = Io.readString("\n\tEnter note value");
                boolean cv = mm.checkvaild(strkey);
                // vaildate value for middlec
                // vaild if valeu for middle is between 250-265
                if (cv == true) {
                   int index = mm.getfreq(strkey);
                   System.out.println("\nNote " + mm.getnoteName(index) + "has frequency of" + mm.getnoteFreq(index) + " Hz");
                   break;   // get out of while
                else {
                   System.out.println("Invaild note!, please try again.");          
                } //end of else
             } //end of while    
          }// end of static main
    } // end of Class UseMusic
    *  Filename    : Music.java
    import java.*;
    public class Music
       static int MAXSIZE = 12;                  // max # of elements (13 elements)
       static double INITALMIDDLEC = 256;     // set default value of middle c to 256
       double middlec;          // user value for middlec
       String[] noteName;   // array stores name of notes
       double[] noteFreq;     // array stores freq of notes
      boolean vaildstr;     // track whether entered string is vaild
       char replay;               // user's reponse to continue prompt
       boolean uContinue;     // whether or not to continue
       int sub;                         // index of searched string
       // Default Constructor
       Music () {
          String[] noteName = {"C","C#","D","D#","E","F","F#","G","G#","A","A#","B","C'"};
          double[] noteFreq = new double[noteName.length];
          middlec = INITALMIDDLEC; // default value of middlec to 256
              vaildstr = false;        // signify whether user entered value
          sub = 0;
       void caldis(String[] noteName, double[] noteFreq, double middlec) {
          // calculate the values based upon middlec
          double temp = 0; // dummy used to store value
          double semitone = (double)Math.pow(2,(1/12));
          temp = middlec;   //set the value of the first element to middlec   
          // fill noteFreq with values wrt middlec
          // no magic #s - noteName since noteFreq has # of elements
          for (int i = 0; i < noteName.length; i++) {
             temp = noteFreq[i-1]; // save value of previous elements 
             noteFreq[i] = temp + (temp * semitone);
          } //end of for
       double getmiddlec(double middlec) {
          return middlec;   // Returns the value of middlec
       int getfreq(String[] noteName, String strkey) {     
          for (int i = 0 ; i < noteName.length ; i++) {        
             if (strkey.compareTo(noteName) == 0) {           
    sub = i;
    return sub;
         double setzero(double middlec) {
              middlec = 0;
              return middlec;
    String getnoteName(int index) {
    return noteName[index];
    double getnoteFreq(int index) {
    return noteFreq[index];
    boolean checkvaild(String[] noteName, String strkey) {
    vaildstr = noteName.equals(strkey);
    return vaildstr;
    } //end of Class Music

    >
    What part can't you figure out? The compiler is
    telling you that it can't resolve "middlec", which it
    can't, because you apparently didn't define it
    anywhere. Actually he did define it, but he defined it after he passed it to those methods. If that's not simply an oversight on his part, I can't begin to understand what he was thinking.

  • Another DiveLog can't resolve symbol error

    I am using NetBeans to go through the DiveLog tutorial, which I have first typed, then cut/pasted in (hence I've not included it here). On compilation I get the following error:
    divelog/DiveLog.java [41:1] cannot resolve symbol
    symbol : method addTab (java.lang.String,<nulltype>,divelog.Welcome,java.lang.String)
    location: class javax.swing.JTabbedPane
    tabbedPane.addTab("Welcome",
    ^
    1 error
    Errors compiling divelog (->).
    The rest of the line looks like this:
    tabbedPane.addTab("Welcome",
         null,
         new Welcome(),
         "Welcome to the Dive Log");
    (Note that I have cut out all the other tabs, just to focus the mind)
    As I am sure you expect if I set the component parameter to null (rather than new Welcome()) it compiles just fine.
    I have read the troubleshooting tips on the tutorial, and understand that I am not compiling the whole package, but as far as I know I am! I highlight the package and compile all, I have compiled the project, and both with the same result. I have also read many, many newsgroup entries on the same subject and I have been trying all the various solutions for the last two days.
    I note that whilst the others have an error that points to Welcome, the error message I get is on the symbol addTab.
    I get the same error if I javac it too. (from the Divelog directory I typed javac -classpath d:\java\myjava\ DiveLog.java, and also tried setting a CLASSPATH environmental variable)
    I have my path (environmental variable) set to: d:\java\j2sdk_nb\j2sdk1.4.2\bin
    I have also set CLASSPATH to d:\java\myJava
    Please remember the pain of newbie!
    Thanks, Myles
    PS I am working in Windows XP

    The compiler is saying that in the JTabbedPane class, there is no method that takes a String, a null, a divelog.Welcome, and another String as parameters. I am guessing that in the divelog.Welcome class source code, you are missing something like the bolded text below.
    public class Welcome extends JPanel
    I'm making this guess because the JTabbedPane needs a Component for the third argument. If you still can't make sense of this, post the page of the tutorial so we can look at it.

  • I can not resolve a plugin-container.exe error while processing payroll through ADP &have been unable to find the right fix for this. I can send error report.

    I have been receiving this error now for a few weeks and have been through multiple layers of IT help trying to resolve it with ADP/Chase Payroll services. When I go to print pay vouchers I get the plugin-container.exe error and I can not print the vouchers. I can provide screen shots if this would help. Can you please advise on how to proceed to resolve this?

    This is an issue with that plugin crashing, which isn't something we can really resolve for you. Try to disable it, find a replacement, update it, or contact their support

  • Package can not resolve

    Hi I have this import package
    import java.util.regex.*;
    Now this package is only in 1.4 api not 1.3 api.
    I am using websphere 5.1 with follwoing jre
    IBM\WebSphere Studio\Application Developer\v5.1.2\runtimes\base_v5\java\jre.
    but error message is coming import can not be resolved.
    now at installation time websphere uses 1.3 but i changed wverywhere from 1.3 to 1.4 but problem still persisting
    thanxs and regards

    use base_v51 not base_v5.
    solved

  • Can not find location of method in Flash example

    The issue that I am having is that I have search high and low to find where the method "flashmo_graphic()" is defined in the example that can be found here:
    http://www.flashmo.com/preview/flashmo_158_heart_effect
    I also attached folder.  There is a "caurina.transitions.*;"  folder being imported, it is attached.  Anyways, you will notice that there is only 1  action script frame and in it around midway there is the code:
    function flashmo_create(e:Event):void
        var mc:MovieClip = new flashmo_graphic();
        mc.gotoAndStop( Math.floor( flashmo_group.numChildren % mc.totalFrames ) + 1 );
    The issue that I am having is finding out what flashmo_graphic() is.  Can anyone tell me what this method is and better yet how I would find out for myself?
    Thanks,
    Brian

    var mc:MovieClip = new flashmo_graphic();
    This is the script to add a movieclip to the stage.
    Go to library.Right click on the first symbol(flashmo graphic) and select linkage you see a pop up with some properties of the symbol.
    In the class you can see  flashmo_graphic  which is the linkage name of the symbol.

Maybe you are looking for

  • I purchased a used Macbook Pro and the serial number is registered to another user.

    How can I register this computer under my name?

  • Why do I have 2 iPhoto Library icons?

    Hello I have 2 unrelated issues. (I believe) First, In my home folder...picutures folder, I have 2 iPhoto Library icons. one with a date modified 20/6/2010 size 45.98GB. the other date modified Today 44.65 GB. In the last few days I have been deletin

  • Regarding mile stone billing

    once u raise the sales order, how you will do milestone billing (this is for order related billing) billing will be done reference to with slaes order numbers so help me how we will do mile stone billing.

  • Floating static routes

    if a rip enabled primary interface goes down and is backed up by a dialer 1 Floating static route with an admin distance of e.g 200 can a second Dialer 2 be configured to connect to the same location via a second floating static route e.g admin cost

  • Failed Backup Message on mac

    I just purchased a new MacBook Pro, and transferred everything on my old hard drive over to my new laptop. When I tried to backup my BlackBerry Curve for the first time, my old BlackBerry Desktop software failed to recognize my device. Then I downloa