Help importing a class and initializing it

Hi guys...
I have a (what I think is) a little problem but after being the whole night awake I can´t think anymore...
I have a button which sends you to frame 10 and in frame 10 I suppose to intialize the class I imported:
import Payment;
getpremium.addEventListener(MouseEvent.CLICK, PI);
function PI(e:MouseEvent):void {
     gotoAndStop(10);
Now in frame 10 the only thing I have is:
Payment();
and the class (how it starts) is:
package
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.events.MouseEvent;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.text.TextField;
    import flash.text.TextFormat;  //etc
public class Payment extends Sprite
        private var paymentSystem:PaymentSystem;
        private var buyList:List;
        private var loader:URLLoader;
        private var pastPurchases:Array = [];
        private var alltextformats:TextFormat = new TextFormat();
        public function Payment()
            paymentSystem = new PaymentSystem(); //etc
What do I suposse to write down on frame 10 for the class to be initialized?
Thanks!!!

Normally what you need to do is instantiate a Payment object...
import Payment;
var payment:Payment = new Payment();

Similar Messages

  • Only to import  JAVA CLASS  and JAVA SOURCE  from .DMP file using IMPDP

    hi,
    I have a schema X, In that schema some of the *"JAVA CLASS" and "JAVA SOURCE"* objects are missing ..
    The procedures ,functions..etc objects were updated at X schema..
    I have 1 dmp file of Y schema , containing the missing "JAVA CLASS" and "JAVA SOURCE" s.. Can I import the the same to the schema X using IMPDP
    i tried using INCLUDE clause but it is not working
    eg:
    impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA CLASS","JAVA CLASS"but error..
    ORA-39001: invalid argument value
    ORA-39041: Filter  "INCLUDE" either identifies all object types or no object types.regards,
    jp

    Double post: IMPDP to import  JAVA CLASS  and JAVA SOURCE from .DMP file
    Already replied.
    Regards
    Gokhan

  • I need help importing navigation bars and rollover buttons from fireworks?

    I need help importing navigation bars and rollover buttons from fireworks, drop down menus and rollover states won't work!
    Thanks

    In my experience, the code created by graphics apps is less than satisfactory. And image based menus are very awkward for several reasons. 
    #1 If you decide to change your menu later, you must go back to your graphics app and re-craft the whole thing.  After 2-3 times of this, it gets old in a hurry.
    #2 Image based menus cannot be "seen" by search engines, screen readers and language translators.
    #3 CSS styled text menus are better for your site's visibility, accessibility and they are a snap to edit in Dreamweaver.
    That said, if you're still married to image based menus, use Fireworks to create images only. Use Dreamweaver's Image Rollover Behaviors to create your rollover scripts.
    Nancy O.

  • IMPDP to import  JAVA CLASS  and JAVA SOURCE from .DMP file

    hi,
    I have a schema X, In that schema some of the *"JAVA CLASS" and "JAVA SOURCE"* objects are missing ..
    The procedures ,functions..etc objects were updated at X schema..
    I have 1 dmp file of Y schema , containing the missing "JAVA CLASS" and "JAVA SOURCE" s.. Can I import the the same to the schema X using IMPDP
    i tried using INCLUDE clause but it is not working
    eg:
    impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA CLASS","JAVA CLASS"but error..
    ORA-39001: invalid argument value
    ORA-39041: Filter  "INCLUDE" either identifies all object types or no object types.regards,
    jp

    Hello,
    You should type JAVA_CLASS and JAVA_SOURCE (use underscore instead of space).
    impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA_CLASS","JAVA_CLASS"Best Regards,
    Gokhan Atil
    If this question is answered, please mark appropriate posts as correct/helpful and the thread as closed. Thanks

  • Need help w/ created classes and objects

    I am having a difficult time understanding what is wrong w/ my classes and objects. I've looked in two books and have messed around a bit. Here is what I am -attempting- to do.
    I want to make a class called CLOTHING. In this class i want objects such as shirt and pants (for now).
    these are the errors im getting:
    .\Shirt.java:6: invalid method declaration; return type required
         public Shirt(int size){
                   ^
    .\Shirt.java:3: class Clothing is public, should be declared in a file named Clothing.java
    public class Clothing {
           ^
    MyClassHW.java:10: cannot resolve symbol
    symbol  : constructor Shirt  (int,int)
    location: class Shirt
              myShirt = new Shirt(1,1);
                              ^
    3 errors------------------------------------------------------------
    This is the code for my Clothing class:
    import java.awt.*;
    public class Clothing {
         private int shirtSize;
         private void Shirt(Graphics s, int h, int v){
         Polygon shirts;
              shirts = new Polygon();
              shirts.addPoint(5+h,8+v); // 1
              shirts.addPoint(17+h,12+v); // 2
              shirts.addPoint(19+h,13+v); // 3
              shirts.addPoint(33+h,8+v); // 4
              shirts.addPoint(37+h,13+v); // 5
              shirts.addPoint(25+h,20+v); // 6
              shirts.addPoint(25+h,28+v); // 7
              shirts.addPoint(15+h,28+v); // 8
              shirts.addPoint(15+h,20+v); // 9
              shirts.addPoint(1+h,12+v); //10
              s.fillPolygon(shirts);
    }from what i understand each object is essentially a method...
    Here is the code for the java applet I'm making:
    import java.awt.event.*;
    import java.awt.*;
    import java.applet.*;
    public class MyClassHW extends Applet { // implements ActionListener, AdjustmentListener {
         Shirt myShirt;
         int size;
         public void init(){
              myShirt = new Shirt(1,1);
    // <applet code = "MyClassHW.class" height = 300 width=300> </applet>thank you for your time and help. as always, your efforts are appriciated.

    .\Shirt.java:6: invalid method declaration; return type required     public Shirt(int size){
    I guess, public Shirt(int size) is constructor in class shirt. You have one int in this constructor. Shirt(int size)
    Here you initialize your shirt with two int:
    MyClassHW.java:10: cannot resolve symbolsymbol : constructor Shirt (int,int)location: class Shirt          myShirt = new Shirt(1,1);
    Shirt(int size, int what?)
    It's why it show such message.
    But even if you fix it seems like you have very vague ideas about what you are doing.
    As far as I understood you need three classes.
    First applet Clothing:
    public class Clothing extends Applet{
    Shirt myShirt;
    Pants myPants;
    public void init() {
    myShirt = new Shirt(1); // small shirt
    myPants = new Pants(32, 40); // medium waist and long legs
    Second and third your classes Shirt and Pants:
    public class Shirt extends Object {
    int size;
    public Shirt(int s) {
    size = s;
    public int getSize () {
    return size;
    same for Pants, only you need two parameters for it or whatever you want.
    You could design it diffrently if you want derive your Shirts and Pants from Clothing and then to use them in your applet. But, indeeed, you desperately have to do some serious reading, where authors are accurate in they definitions and stuff, because it's kind of complicated.

  • ToString meathod help in a class and arrys

    I can't get the toString method to work, i have a temp class and a temp client and I'm trying to call the toString method from the class in the client but its not working. Can anyone please help me out with this. THANKS!
    Here's the Temp Client:
    import java.util.Scanner;
    public class TempClient
        public static void main(String [] args)
                 Scanner scan = new Scanner(System.in);
                 int [] dailyTemps = new int [7];
                 int [] inputTemps = { 32, 45, 52, 66, 76, 53, 31};
                   Temp t1 = new Temp (inputTemps);
                   Temp t2 = new Temp (dailyTemps);
                   for ( int i = 0; i < dailyTemps.length; i ++)
                        System.out.print(" Enter the temperature for day  " + (i + 1) + "\t");
                        dailyTemps[i] = scan.nextInt ();
                                   System.out.println( t1.toString() );
                        hers the Temp class:
    import java.util.Scanner;
       public class Temp
              public final int TEMPS = 7;
              int temp;
              //String dailyTemps;     
              int [] dailyTemps;
                int [] inputTemps;
              int Temp;
              String temp1;
             //constructor
          public  Temp()
              public Temp( int [] dailyTemps)
              public  Temp(int newTemp)
                   temp = newTemp;
            public int getTemp()
                   return temp;
              public void setTemp( int changeTemp )
                   temp = changeTemp;
              public String toString(int [] inputTemps)
              String returnValue = " ";
              for(int i = 0; i < inputTemps.length; i++)
                   returnValue = returnValue + inputTemps + "\t";
                   returnValue += "\n";
                        return returnValue;

    TripleA wrote:
    man if i knew how to fix this i would not ask for help. so if you could please help me out? if not just tell me so i can go find help else where. He was being humorous (a bit). Your telling us "now it's not printing anything" gives us about as much useful information as BDLH describing his afternoon snack. You're welcome to go someplace else but they'll not be able to help you either. If it were me, I'd display my current code, and give more explanation on what's going on, but your mileage may vary.

  • Help with Runtime class and timeout of Process

    Hi,
    Question regarding using Runtime class, and yes I have looked at the javadocs, but I am still confused and frustrated.
    Here is part of my code.
    Process p;
    Runtime runtime = Runtime.getRuntime();
    p = runtime.exec("rsh localhost ls");
    if you are not familiar with rsh all it does is remote shell into the computer localhost and executes the command ls.
    Now, I dont have rsh running on my computer so it will hang at that line for about 40 sec and eventually time out on its own. Is there anyway I can specify a timeout argument like there is for the ping command? Like if there is no response from localhost after 3 sec, then just kill the process?
    I looked at the Runtime javadoc and Process javadoc and the closest thing I could come to with is something to do with envp (environment parameters), but I dont know what that is.
    Thanks guys.

    You can't timeout the "runtime.exec("rsh localhost ls");" call but if you execute the call in a seperate thread you can "timeout" and continue executing on the original thread (while letting the "runtime" thread to timeout on its own).
    Check the following class that I created for cases like this:
    abstract public class TimeoutHelper implements Runnable
        private Throwable error;
        private boolean running = true;
        private Object retValue;
        protected String name;
        private long waitTime;
        private Thread thread;
         * Creates a new helper. Use {@link #start} to run the code.
         * @param name A name that will be used in the helper thread name
         * @param waitTime The time (in msec) to wait before timeout.
        public TimeoutHelper(String name, long waitTime)
            this.name = name;
            this.waitTime = waitTime;
        public Object start() throws Throwable
            return asyncExecute();
        abstract protected Object execute() throws Throwable;
        private synchronized Object asyncExecute() throws Throwable
            createThread().start();
            if (running)
                try
                    wait(waitTime);
                    if (running)
                        // Timeout!!
                        abortThread();
                        throw new TimeOutException("Timeout for: " + name);
                catch (InterruptedException ie)
                    // Ignore
            if (error != null)
                throw error;
            return retValue;
        private void abortThread()
            if (thread != null)
                thread.interrupt();
        protected Thread createThread()
            thread = new Thread(this, name);
            return thread;
        public void run()
            try
                retValue = execute();
            catch (Throwable th)
                error = th;
            synchronized (this)
                running = false;
                notifyAll();
    }You use the class by extending it and implementing "execute". For example:
            TimeoutHelper helper = new TimeoutHelper("Runner", 5000)
                protected Object execute() throws Throwable
                    Runtime runtime = Runtime.getRuntime();
                    return runtime.exec("rsh localhost ls");
            try
                Process p = (Process)helper.start();
            catch (TimeOutException e)
                // Handle timeout here
            catch (Exception e)
                // Handle other errors here.
            }

  • Help - import own classes in jsp

    Hey guys..
    I'm working on a Shopping cat project which is in the directory -
    C:\Tomcat 6\webapps\ROOT\cart
    I've written one code in shop-product.jsp as below -
    <%@ page language = "java" contentType = "text/html"
             import = "ShoppingBasket, Product, java.sql.*"
             errorPage = "errorpage.jsp" %>
    <html>
    <head> <title>Welcome to Shop</title></head>
    <body>
    <table width = "385" border="0" cellspacing="0">
    <tr>
    <td colspan="4">More Books from me</td>
    </tr><tr>
    <td colspan="4" align ="right">
    <a href = "<%=response.encodeURL("shop-basket.jsp") %>"> View Basket </a></td>
    </tr><tr>
    <td><b>Ref</b></td><b>Title</b></td>
    <td><b>Price</b></td></td></tr>
    <%
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    Connection connection = null;
    connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/shop", "root", "rahul");
    Statement stmt = null;
    ResultSet RS = null;
    stmt = connection.createStatement();
    RS = stmt.executeQuery("select * from items");
    int rowCounter = 0;
        while(RS.next())
          String item_id = RS.getString("id");
          String title = RS.getString("title");
          String desc = RS.getString("desc");
          String price = RS.getString("price");
          rowCounter=rowCounter+1;
          String bg=  (rowCounter % 2 !=0) ?"#C0C0C0":"#ffffff";
    %>
    <tr bgcolor = <%=bg%>">
    <td><%=item_id%></td>
    <td><b><%=title %></b><br/><%=desc%></td>
    <td><b><%=price %></b></td>
    <td>
    <a href =" <% response.encodeURL("shop-products.jsp?title="+title+"&item_id="+item_id+"&price="+price); %> "> Add to Cart </a></td>
    </tr>
    <% } RS.close(); connection.close(); %>
    </table>
    <jsp:useBean id = "basket" class = "ShoppingBasket" scope = "session"/>
    <% String title = request.getParameter("title");
       if(title!=null)
         String item_id = request.getParameter("item_id");
         double price = Double.parseDouble(request.getParameter("price"));
         Product item = new Product (item_id, title, price);
         basket.addProduct(item);
    %>
    </body></html>{code}
    in which ShoppingBasket and Product are the classes which I want to import. Where should I put those class files if my project path is 
    +C:\Tomcat 6\webapps\ROOT\cart+
    I've put class files into Tomcat_home/lib but it is giving me error
    {code}type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 6 in the generated java file
    The import ShoppingBasket cannot be resolved
    An error occurred at line: 7 in the generated java file
    The import Product cannot be resolved
    An error occurred at line: 62 in the jsp file: /cart/shop-products.jsp
    The method addProduct(Product) in the type ShoppingBasket is not applicable for the arguments (Product)
    59:      String item_id = request.getParameter("item_id");
    60:      double price = Double.parseDouble(request.getParameter("price"));
    61:      Product item = new Product (item_id, title, price);
    62:      basket.addProduct(item);
    63:    }
    64: %>
    65: </body></html>
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.{code}
    Please assist me on, how to import my custom made class files..
    Thanks,
    Rahul...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    What You need to do is to place ShoppingBasket class in a package and import to fully qualified class name (which is class name with package name). I also discourage You to use scriptlets - it's an obsolete, old technology.

  • Only a type can be imported. package.Class resolves to a package

    Hi,
    I made a class for database connection named ConnectionClass.class.
    The JSPs in public_html directory working fine with import and session variables.
    but JSPs under public_html/subdirectory are unable to import this Class and also unable to access session variables.
    I have deploy this class under public_html/WEB-INF/classes/ directory.
    and also in a jar file vidyabharti.jar under public_html/WEB-INF/lib directory
    I am importing it in JSPs like
    <%@ page import="vidyabharti.ConnectionClass, java.sql.*" %>
    but i am getting following error
    An error occurred at line: 6 in the generated java file
    Only a type can be imported. vidyabharti.ConnectionClass resolves to a package
    An error occurred at line: 110 in the jsp file: /welcome.jsp
    ConnectionClass cannot be resolved to a type
    109: <%
    110: ConnectionClass cs=null;
    An error occurred at line: 115 in the jsp file: /welcome.jsp
    ConnectionClass cannot be resolved to a type
    cs=new ConnectionClass();
    i am using Tomcat 5.5.28.
    please help me.

    Hello,
    It's a possible issue whith the JDT compiler version of your tomcat distribution.
    You know that jasper is the engine that transform jsp to classes and to achive this goal uses a jdt compiler or the ant task javac compiler.
    First check that the JDT compiler class is present in the trace of the exception you have.
    If this is the case follow the steps of the tomcat documentation in order to use the ant compiler.
    http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html
    Apache Ant, which was used in previous Tomcat releases, can be used instead instead of the new compiler by simply removing the common/lib/jasper-compiler-jdt.jar file, and placing the ant.jar file from the latest Ant distribution in the common/lib folder. If you do this, you also need to use the "javac" argument to catalina.sh.
    If you check the code of the tomcat compilation context seems that you can do the same, without removing any file, by setting the compile parameter of the JspServlet to an arbitrary value diferent from null.
    Try this other alternative by editing the file %TOMCAT_HOME%\conf\web.xml
    and set the compiler attribute as follow
        <servlet>
            <servlet-name>jsp</servlet-name>
            <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
            <init-param>
                <param-name>fork</param-name>
                <param-value>false</param-value>
            </init-param>
            <init-param>
                <param-name>xpoweredBy</param-name>
                <param-value>false</param-value>
            </init-param>
            <init-param>
                <param-name>compiler</param-name>
                <param-value>Ant</param-value>
            </init-param>
            <load-on-startup>3</load-on-startup>
        </servlet>If this works for your problem we can check the jdt code and perhaps make a patch.
    Best reggards,

  • Need help in Creating classes for my assignment

    Hi ,
    I just started learning Java and have the following requirement
    1)     Create the following classes/interfaces using descriptions:
    a)     Account � data members : id:String, type:String, balance:BigDecimal, methods : Account, Account with String parameter, getId, getType, getBalance, setId, setType, setBalance, deposit, withdraw, compareTo, toString
    b)     Bank � data members: instance:Bank, accountsMap:Map, customersMap:Map, customersAccount:Map, transactionMap:Map, methods: getAccountsMap, getCustormersMap, getCustomersAccounts, getTransactionMap, associate, addTransaction, getAccount, getCustomer, getAccounts, getTransactions, deposit, withdraw, transfer
    c)     AccountDoesNotExistException, BankException, CustomerDoesNotExistException, InsufficientFundsException, InvalidAmountException, ZeroAmountException
    2)     Create the util package using the following class
    a)     AmountConverter � methods: fromDecimal(BigDecim     al), fromString(String)
    In 1 b how to Create Instance:bank in the class .Also how to do part2.If possible can you help me with all the parts.Based on these I've some more to do.

    Here is what I've come with
    ACCOUNT.JAVA
    import java.math.*;
    public class Account {
    private String Id;
    private String Type;
    private BigDecimal balance;
    public Account( ) {
    public Account(String Id,String Type,BigInteger balance) {
    this.Id = Id;
    this.Type = Type;
    this.balance = balance;
    public String getId( ) {
    return Id;
    public void setId(String Id) {
    this.Id = Id;
    public String getType( ) {
    return Type;
    public void setType(String Title) {
    this.Title = Type;
    public String getBalance( ) {
    return id;
    public void setBalance(String balance) {
    this.balance = balance;
    public String withdraw( ) {
    public String deposit( ) {
    public void setLastName(String LastName) {
    this.id = id;
    CUSTOMER.JAVA
    public class Customer {
    private String Id;
    private String Title;
    private String firstName;
    private String lastName;
    /** Construct a Customer with no data -- must be a no-argument */
    public Customer( ) {
    /** Construct a Customer with String Parameter */
    public Customer(String Id,String Title,String firstName,String lastName) {
    this.Id = Id;
    this.Title = Title;
    this.firstName = firstName;
    this.lastName = lastName;
    /** Return the Id. */
    public String getId( ) {
    return Id;
    /** Set the Id */
    public void setId(String Id) {
    this.Id = Id;
    /** Return the Title */
    public String getTitle( ) {
    return Title;
    /** Set the Title */
    public void setTitle(String Title) {
    this.Title = Title;
    /** Return the Firstname. */
    public String getFirstName( ) {
    return id;
    /** Set the Firstname. */
    public void setFirstName(String FirstName) {
    this.id = id;
    /** Return the Lastname. */
    public String getLastName( ) {
    return LastName;
    /** Set the Lastname. */
    public void setLastName(String LastName) {
    this.id = id;
    TRANSRECORD.JAVA
    import java.util.*;
    import java.math.*;
    public class TransRecord implements Comparable{
    private Date timeStamp;
    private String transType;
    private BigDecimal transAmt;
    /** Construct a Trans Record with no data -- must be a no-argument */
    public TransRecord( ) {
    /** Construct a Customer with String Parameter */
    public Customer(String transType,String transAmt) {
    this.transType = transType;
    this.transAmt = transAmt;
    /** Return the timeStamp. */
    public String gettimeStamp( ) {
    return timeStamp;
    /** Set the timeStamp */
    public void settimeStamp(Date timeStamp) {
    this.timeStamp = timeStamp;
    /** Return the TransType */
    public String getTransType( ) {
    return TransType;
    /** Set the TransType */
    public void setTransType(String TransType) {
    this.TransType = TransType;
    /** Return the TransAmt */
    public String getTransAmt( ) {
    return TransAmt;
    /** Set the TransAmt */
    public void setTransAmt(String TransAmt) {
    this.TransAmt = TransAmt;
    /** Return a String representation. */
    public String toString( ) {
    /** CompareTo method */
    public int compareTo(Object argument)
    ===============
    ACCOUNTDOESNOTEXISTEXCEPTION.JAVA
    public class AccountDoesNotExistException
                   extends Exception
         public AccountDoesNotExistException()
              super();
         public AccountDoesNotExistException(String message)
              super(message);
    =================
    BANKEXCEPTION.JAVA
    public class BankException
                   extends Exception
         public BankException()
              super();
         public BankException(String message)
              super(message);
    CUSTOMERDOESNOTEXISTEXCEPTION.JAVA
    public class CustomerDoesNotExistException
                   extends Exception
         public CustomerDoesNotExistException()
              super();
         public CustomerDoesNotExistException(String message)
              super(message);
    ACCOUNTDOESNOTEXISTEXCEPTION.JAVA
    public class AccountDoesNotExistException
                   extends Exception
         public AccountDoesNotExistException()
              super();
         public AccountDoesNotExistException(String message)
              super(message);
    INSUFFICIENTFUNDSEXCEPTION.JAVA
    public class InsufficientFundsException
                   extends Exception
         public InsufficientFundsException()
              super();
         public InsufficientFundsException(String message)
              super(message);
    INVALIDAMOUNTEXCEPTION.JAVA
    public class InvalidAmountException
                   extends Exception
         public InvalidAmountException()
              super();
         public InvalidAmountException(String message)
              super(message);
    ZEROAMOUNTEXCEPTION.JAVA
    public class ZeroAmountException
                   extends Exception
         public ZeroAmountException()
              super();
         public ZeroAmountException(String message)
              super(message);
    I need help with Bank Class and the util class.Correct me If I've missed any exceptions or if any syntax is wrong
    THanks
    AKsh

  • Help Importing New Pictures & Text in Document

    Dear Adobe Customer Service,
           I just purchased your servcie and would greatly appreciate your help importing new photos and text in the document that has been changed from pdf to docx.  I have a Mac and when attempting to change or update photos or text in the document the alignment is totally off and will not allow.
            Can you please help?  Please call me and walk me through the process.  If this matter cannot be resolved I will need to cancel my subscription and get a full refund.
    Thank You
    Dr. Joy Macci
    214-223-3738

    OK, if this is a template file and you are trying to customize a single word, or a list of words that are always in the same places (I was thinking at first that you want to change words in one part of a paragraph if some other trigger word appeared), like a form letter that needs to have the recipients name inserted, then you can use either a custom text variable or Data Merge.
    For one-off production the variable is probably easier -- just redifine the text string  each time you make a new copy, but if you have a list of words and want to make a copy for each one in a single session, Data Merge would be more efficient.

  • Importing unpackaged classes

    Hi,
    Here is a simplified example of what I'm trying to do. From a packaged class, I want to instantiate an object which is of type of an unpackaged class.
    package foo.bar
    public class ClassA {
    public ClassA() {
    public static void main()
    ClassB b = new ClassB();
    public class ClassB {
    public ClassB() {
    When trying to compile .. (where ClassB.java is in the directory C:\ClassB)
    C:\foo\bar> javac -classpath C:\ClassB ClassA.java
    I get the following compilation error:
    ClassA.java:5: cannot resolve symbol
    symbol : class ClassB
    location: class ClassA
    ClassB b = new ClassB();
    ^
    ClassA.java:5: cannot resolve symbol
    symbol : class ClassB
    location: class ClassA
    ClassB b = new ClassB();
    ^
    2 errors
    I see no reason why the above example should fail, or am I doing something incredibly stupid? Anyone have an ideas?
    Cheers
    Andy

    If you are using J2SDK1.4, you can not use a class from an unnamed package in a class in a named package. In 1.3, you can import the class and it will work (assuming it is in the Classpath). Your only choice is to package the class or use 1.3 - I'm not sure what earlier versions support.

  • Eclipse plugin error (import java class)

    Hello, I am actually developing a complex interface program in JavaFx, the main component is a Swing component with a universe 3D inside (a map of a buildign). So in some javafx classes I have to import java classes and I obtain an import error. I have in the same package a java class and a javafx class with the same import and I only have the error in the javafx one.
    Does somebody have the same error? or know how can I fix it?
    Thanks and Regards

    Thanks for your suggestion, in fact I'm actually developing in Netbeans. My application is really complex I have a java3D universe in a swing component and the javaFx nodes are drawn on it. When I load some nodes and move them over the 3D I obtain a JVM error, I've read that it could be solved in some cases compiling the project in eclipse so I'm trying to do it.
    I tried to solve the JVM error hardly, at first it was thrown every time I load a new module in my scene an moved it, I improve the performance of my application and I've decreased the error a lot. In fact, the error only appear if I load the 3D universe and I'm sure that is because of the rendering. I've tried all I can imagine so now I'm trying that kind of stupid thing.
    Thanks and Regards

  • HELP, date class and parsing input

    I have reviewed many posts in these forums and have found that detail gets the best results so I apologize in advance if this is detailed. I am taking a Java class and am not doing so hot. The last time I programmed was in 1998 and that was Ada, I very soon moved to Networking. I guess those that can't program become networkers, I don't know, but I am frustrated here.
    Any how I am trying to write a rather simple program, but it is the manipulation of the date I am having difficulty with. Here are the requirements:
    Overall Requirements
    Create a class named Date that stores date values and prints out the date in either a pure numeric format or a name and number format (see sample session for format details).
    Date.java class file
    ? Date objects should store the date in two int instance variables &#9472; day and month, and it should include the String instance variable, error, initialized with null.
    Implement a 1-parameter Date constructor that receives a dateStr string parameter and performs complete error checking on the given dateStr value. The Date constructor is the entity that?s responsible for date error checking. That way, if a Date object is instantiated and if there are no errors, then you?re guaranteed that the Date object holds a legitimate date value. If any kind of error occurs, change the value of the error instance variable to a non-null string value, using an appropriate concatenation of a string constant, input substring, and/or API exception message.
    Constructors use the same exception handling rules as methods: In a try block, include the parsing of the month and day substrings and other error-checking logic that will not work if parsing fails.
    ? Take into account the actual number of days in each month, but assume that there are always 28 days in February.
    ? To extract day and month numbers from the given date string, use String?s indexOf method to find the location of the slash character, and String?s substring method to extract month and day substrings from the input string.
    ? Include a method for printing the date with a numeric format. Use the zero-pad flag in a printf method call to get exactly two digits for each month and day.
    ? Include a method for printing the date with an alphabetic format.
    Include a getError method which returns the value of the error instance variable.
    DateDriver.java class file : In your driver class, include a loop that repeatedly:
    ? Asks the user to enter a date or ?q? to quit. ? If the entry is not ?q?, instantiate a Date object.
    ? If the error variable is null: o Print the date using numeric format.o Print the date using alphabetic format. Otherwise, print the value of the error variable.
    I want to figure this out on my own as much as possible but have until tomorrow night to do so..............I need to understand how I can use Strings indexOf to parse the dateStr so I can locate the /. I see I can use it to find the position of a specified character, but I am not sure of the syntax I need to use. But then once I find the / I need to use the String's substring method to extract month and day. I think I might be able to get that, if I can get the / figured out.
    The below is what I have in my Class and my Driver so far:
    *DateDriver.java (driver program)
    * Christine Miller-Lane
    *Overall Requirements
    *Create a class named Date that stores date values and prints out the date in either a pure numeric
    format or a name and number
    *format (see sample session for format details).
    *DateDriver.java class file
    *In your driver class,
    *????????? If the error variable is null:
    *     &#9702;     Otherwise, print the value of the error variable.
    import java.util.*;
    public class DateDriver
    Date datevalue;
    public static void main(String[] args)
         Scanner stdIn = new Scanner(System.in);
         while (!xStr.equalsIgnoreCase("q"))
         try
              System.out.println("Enter a date in the form mm/dd ("q" to quit): ";
              value = stdIn.nextLine();
              datevalue = new Date(value);                                                        //instaniate the date object
              System.out.println //print date in numeric format
              System.out.println //print date in alphabetic format
              break;
              catch
              System.out.println("print value of error variable.");
              stdIn.next(); // Invalid input is still in the buffer so flush it.
         } //endloop
         }//end main
    } //end class?
    * Date.java
    * Christine Miller-Lane
    *Overall Requirements
    *Create a class named Date that stores date values and prints out the date in either a pure numeric format or a name
    *and number format (see sample session for format details).
    *Date.java class file
    *????????? Date objects should store the date in two int instance variables &#9472; day and month, and it should include
    *the String instance variable, error, initialized with null.
    *     ?     Implement a 1-parameter Date constructor that receives a dateStr string parameter and performs complete
    *     error checking on the given dateStr value. The Date constructor is the entity that?s responsible for date error
    *     checking. That way, if a Date object is instantiated and if there are no errors, then you?re guaranteed that the
    *     Date object holds a legitimate date value. If any kind of error occurs, change the value of the error instance
    *     variable to a non-null string value, using an appropriate concatenation of a string constant, input substring,
    *     and/or API exception message.?
    *     ?     Constructors use the same exception handling rules as methods: In a try block, include the parsing of the
    *     month and day substrings and other error-checking logic that will not work if parsing fails.
    *????????? Take into account the actual number of days in each month, but assume that there are always 28 days in February.
    *????????? To extract day and month numbers from the given date string, use String?s indexOf method to find the
    *location of the slash character, and String?s substring method to extract month and day substrings from the input string.
    import java.util.*;
    public class Date
         Scanner stdIn = new Scanner(System.in);
         boolean valid = false
         int day;
         int month;
         String error = null;
         String dayStr;
         String monthStr;
         String dateStr;
         public Date(String dateStr)
    // Look for the slash and set appropriate error if one isn't found. use String?s indexOf method to find the
    //location of the slash character and String?s substring method to extract month and day substrings from the input string.
    // Convert month portion to integer. Catch exceptions and set appropriate error if there are any.
    Integer.parseInt(dateStr);
    // Validate month is in range and set appropriate error if it isn't.
    // Convert day portion to integer. Catch exceptions and set appropriate error if there are any.
    // Validate day is in range based on the month (different days per month) and set appropriate error if it isn't.
    //public void printDate()      //Include a method for printing the date with a numeric format. Use the zero-pad flag in a printf method
                                       //call to get exactly two digits for each month and day.
    //{                                   //Include a method for printing the date with an alphabetic format.      
    //     } // end print report
    //     public getError()
                                  //Include a getError method which returns the value of the error instance variable.
    }//end class Date
    Here is sample out put needed::::::::
    Sample Session:
    Enter a date in the form mm/dd ("q" to quit): 5/2
    05/02
    May 2
    Enter a date in the form mm/dd ("q" to quit): 05/02
    05/02
    May 2
    Enter a date in the form mm/dd ("q" to quit): 52
    Invalid date format ? 52
    Enter a date in the form mm/dd ("q" to quit): 5.0/2
    Invalid format - For input string: "5.0"
    Enter a date in the form mm/dd ("q" to quit): 13/2
    Invalid month ? 13
    Enter a date in the form mm/dd ("q" to quit): 2/x
    Invalid format - For input string: "x"
    Enter a date in the form mm/dd ("q" to quit): 2/30
    Invalid day ? 30
    Enter a date in the form mm/dd ("q" to quit): 2/28
    02/28
    February 28
    Enter a date in the form mm/dd ("q" to quit): q
    I am trying to attack this ONE STEP at a time, even though I only have until Sunday at midnight. I will leave this post and get some rest, then attack it again in the morning.
    Edited by: stillTrying on Jul 12, 2008 8:33 PM

    Christine,
    You'r doing well so far... I like your "top down" approach. Rough out the classes, define ALL the methods, especially the public one... but just sketch out the requirements and/or implementation with a few comments. You'll do well.
    (IMHO) The specified design is pretty crappy, especially the Exception handling
    [The Constructor] performs complete error checking on the given dateStr value. The Date constructor is the entity that?s responsible for date error checking. That way, if a Date object is instantiated and if there are no errors, then you?re guaranteed that the Date object holds a legitimate date value. If any kind of error occurs, change the value of the error instance variable to a non-null string value, using an appropriate concatenation of a string constant, input substring, and/or API exception message.Please allow me to shred this hubris piece by piece.
    [The Constructor] performs complete error checking on the given dateStr value. The Date constructor is the entity that?s responsible for date error checking.Umm... Well I suppose it could... but NO, the constructor should delegate such "complex validation" to a dedicated validate (or maybe isValid) method... which might even be made publicly available... it's a good design.
    That way, if a Date object is instantiated and if there are no errors, then you?re guaranteed that the Date object holds a legitimate date value. If any kind of error occurs, change the value of the error instance variable to a non-null string value ...Utter Bollocks! When passed an invalid input string the, Date constructor should throw an InvalidDataException (or similar). It should not SILENTLY set some dodgy error errorMessage attribute, which is returned later by a "print" method. We tried that in masm, fortran, ada, basic, c, and pascal for twenty odd years. It sucked eggs. And it STILL sucks eggs. Java has a "proper" try/catch exception handling mechanism. Use it.
    I mean, think it through...
      someDate = get a date from the user // user enters invalid date, so someDate is null and errMsg is set.
      report = generateReport() // takes (for the sake of argument) three hours.
      emailReport(someDate, report) // only to fail at the last hurdle with an InvalidDataException!And anyways... such implementation details are traditionally the implementors choice... ie: it's usually between the programmer and there tech-manager (if they're lucky enough to have one).
    Cheers. Keith.

  • Problem importing classes and beans

    Hey there. Im having one major fustrating problem! When I code supporting classes and beans for my JSPs I get a code 500 internal server error when trying to import (via <%@ page import="class" %> and <jsp:useBean/>) Im storing my classes and beans in the WEB-INF folder and the calling JSPs are located in /ROOT/tests/8/jsp.jsp. Im using the following to import a class or bean:
    <%@ import="aClass" %>
    Seen as tho its in the WEB-INF folder I won't have to explicitly refer to where the class is located, just the class name.
    I never had this problem when I was using my hosting service. Its only on my localhost server in which I get the Internal Server error.
    Help appreciated, thx.
    PS: Im quite new to JSP/Java Servlet.

    import (via <%@ page import="class" %> and
    <jsp:useBean/>) Im storing my classes and beans in the
    WEB-INF folder try put your class file in WEB-INF/classes.
    or first put bean in the package, like WEB-INF/classes/packagename/beanclass
    in jsp page:
    <jsp:useBean id="Mybean" class="packagename.beanclass" scope="request" />
    Question: is /ROOT a context entry in your server.xml?
    Which JSP Container (version) you use? Maybe your localhost server's set up is different with your hosting.

Maybe you are looking for