Compile questions about example " DrawTest.java"

i install the j2sdk1.4.0 with windows98 operations system.
i want to recomplie the examples in c:\j2sdk1.4.0\demo\applets\DrawTest
javac DrawTest.java
12 errors occur as following:
DrawTest.java:185: cannot resolve symbol
symbol : variable orange
location: class Color
b.setForeground(Color.orange);
^
DrawTest.java:188: cannot resolve symbol
symbol : variable black
location: class Color
b.setForeground(Color.black);
^
DrawTest.java:194: cannot resolve symbol
symbol : variable lightGray
location: class Color
shapes.setBackground(Color.lightGray);
^
DrawTest.java:200: cannot resolve symbol
symbol : variable lightGray
location: class Color
g.setColor(Color.lightGray);
^
12 errors
how to solve this problem?
thanks a lot

Normally problems regarding cannot resolve symbol I've found are because the file you're working on uses another class file in the code, and the compiler from the prompt doesn't know where it's looking for the dependant classes. When compiling try using "javac -classpath "c:\whereyourclassesare" "c:\whereyourjavafileis.java""
That should work, hopefully :)

Similar Messages

  • A question about design of Java Application on java card.

    Hi every one,
    I have a question about design of Java applet on java card,
    There is an application on my card that it is not java card, it include a DF and some EF under DF, I would like to know if I want to have this application on java card ,how can I design DF and EF on java card ,I mean is there any relation between DF,EF with applet and file? for example can I say DF is same as applet and EF is same as file?
    I'll appreciate for any help .
    yours sincerely,
    orchid

    hi
    you can write a java class for DF.
    an instance of DF class have some EF objects.
    for example,
    samples/com/sun/javacard/samples/JavaPurse/CyclicFile.java
    implements ISO 7816 CyclicFile ( EF )
    see also:
    http://forum.java.sun.com/thread.jspa?threadID=673745&messageID=3936272
    best regards,
    siavash

  • Question about the new JAVA Update J2SE 5.0 Release 3

    Here is some info about this update:
    Java 2 Platform, Standard Edition (J2SE) 5.0 Release 3 allows applications and applets developed for the J2SE 5.0 platform to run on Mac OS X v 10.4.2 and later.
    This update does NOT CHANGE the DEFAULT VERSION of Java on your Mac from Java 1.4.2 to J2SE 5.0, though Java applications that require J2SE 5.0 may specifically request it. You can change the preferred Java version for applications and applets by using the new Java Preferences utility. This utility is installed by the J2SE 5.0 update at /Applications/Utilities/Java/J2SE 5.0/.
    http://docs.info.apple.com/article.html?artnum=302412
    HERE IS MY QUESTION---
    This update makes me nervous cause I don't know much about Java. IF I change my default version to this new 5.0 will it mean that some of the older Java stuff on the web won't work? Should I just download this and ignore it? What should I do about this update?
    Thanks for the help!
    Renée

    I too seem to be suffering issues with loading web pages after the 10.4.3/Java 5.0 update. I have reinstalled both updates, changed the java settings, emptied all the caches, and tried various combinations thereof, and I still have problems with web pages loaded. most of the problems appear to be related to rendering frames and images - In fact a couple of web sites I navigate to (upon looking at the source for the page" state "It appears your browser does not support frames." I think this is something broken in the latest release. Unfortunately, I cannot reinstall the latest copy of Safari, because the installer states "This version of Safari cannot be installed. It requires version 10.4.2." I guess I am in a pickle until Apple comes out with another update. BTW I have some pages that Safari will not render but IE running on the same box will. I also noticed that the problem propagated to other applications that use Java....For instance the Dashboard widget from google (Google Maps) no longer renders the tiled (framed?) map pieces...instead you get the ubiquitous "?" icon.

  • Question about privacy in Java

    hi, i have a question about privacy practices in Java. I always thought it was bad form to program with too many global variable. However, when I program in Java i find that most of the time I am making my variables global. Is the fact that they are in a class supposed to make up for that fact? With subclasses you can also have 3rd parties working on your data. It seems a bit suspicious to me, like the data should be maintained more strictly, or is it my job to do that? I am just curious, but it seems java promotes global variables, which I find to be bad programming practice since anything can operate on them. I appreciate any input...

    However, when I program in Java
    i find that most of the time I am making my variables
    global. (meaning public)Sounds like you are writing bad code. Public variables should be extrememly rare except static final 'constants'.
    Is the fact that they are in a class supposed
    to make up for that fact? Absolutely not.
    With subclasses you can also
    have 3rd parties working on your data. It seems a bit
    suspicious to me, like the data should be maintained
    more strictly, or is it my job to do that? Yes, it's your job.
    I am just
    curious, but it seems java promotes global variables,
    which I find to be bad programming practice since
    anything can operate on them. I appreciate any
    input...Java does not promote public variables. You have to explicitly make them public.

  • Question about VB6 (no Java)

    Maybe someone can help me...if I wante to compile and run Java programs, I download JDK...but what do I do if I want to download a VB6 compiler? Is it free? How can I download it? Please don't say do a google, cos I did and was confused with all the information given back...all this stuff about runtime and controls and have you what...
    someone please answer me if you know the answer to this...

    My brother is a phycisist. He has no use for Java.I don't see why a physicist would look down his nose at Java. They write code, too.
    He's just got into VB recently cos he's been using a bit of Excel lately.If your brother is that smart, he doesn't need your help to figure out how to get ahold of and learn VB.
    He is a very nice guy. He is very unargumentative. So do not speak ill of him.Your brother sounds like a better person than you. Can you shove off and send him over to the forum?
    Honestly, I don't understand how you could think this behavior would ingratiate you with forum regulars.
    Why don't you follow annie's example? She offers good technical bits when she can and fine craic the rest of the time. She's obviously got some brains and manners. Why are you so lacking in both?
    %

  • Question on example from "Java concurrency in practice"

    "Java concurrency in practice" 14.9 listing ( [Orig here|http://www.javaconcurrencyinpractice.com/listings/ThreadGate.java] ):
    +...The condition predicate used by await is more complicated than simply testing isOpen. This is needed because if N threads are waiting at the gate at the time it is opened, they should all be allowed to proceed. But, if the gate is opened and closed in rapid succession, all threads might not be released if await examines only isOpen: by the time all the threads receive the notification, reacquire the lock, and emerge from wait, the gate may have closed again. So ThreadGate uses a somewhat more complicated condition predicate: every time the gate is closed, a "generation" counter is incremented, and a thread may pass await if the gate is open now or if the gate has opened since this thread arrived at the gate...+
    public class ThreadGate {
        private boolean isOpen;
        private int generation;
        public synchronized void close() {
            isOpen = false;
        public synchronized void open() {
            ++generation;
            isOpen = true;
            notifyAll();
        public synchronized void await() throws InterruptedException {
            int arrivalGeneration = generation;
            while (!isOpen && arrivalGeneration == generation) {
                wait();
    Question:
    Guys, could anyone explain me
    1) the work of code in term of "thread T1 waits, thread T2 closes..." the part arrivalGeneration == generation is unclear?
    2) Why both english and french editions say "every time the gate is closed, a generation counter is incremented"? How this is possible?
    3) Give an example how "the gate may have closed again" ? How this is possible?
    I posted this in other forums, but never had any explanations. Thanks.
    Edited by: maxim_2004 on Jul 14, 2010 9:19 AM

    Generation is a counter of how many times the gate has opened. We use it to determine if the gate has opened since a waiting thread arrived. The criteria for a waiting thread to proceed is not, "Is the gate open now?" but rather "Has the gate opened at least once since this thread started waiting?"
    Say you have N waiting threads and one controller thread. When the controller thread calls open(), we want all N waiting threads to be able to proceed. But the controller thread may call close() at any time, and depending on when he calls close(), how many waiting threads there are (that is, how large N is) and how the scheduler on that JVM/OS is operating, the controller thread may call close() before all of the waiting threads have completed the await() method.
    So a waiting thread may be stuck in the while loop call wait(), and by the time he has been notified, gets CPU cycles, acquires the lock, and goes back to test isOpen, the gate may have opened and closed. But we want him to be able to go, just because the gate did open. We don't care if he didn't get through before it closed again--he's supposed to be able to go anyway.
    Therefore, we don't just wait if the gate is closed. We wait if the number of times it has opened is the same as when we arrived. In other words we wait only, if it hasn't opened since this waiting thread arrived.
    Gate opens 1st time. (generation = 1)
    Gate closes.
    Gate opens 2nd time. (gen = 2)
    T2 arrives. (arrivalGen = 2)
    T2 calls wait()
    Gate opens 3rd time. (gen = 3)
    Gate closes.
    T2 gets CPU time and lock. Executes while test. Gate is closed. BUT gen=3 and arrivalGen=2, so even though the gate is closed now, it has opened since T2 arrived, so T2 is allowed to proceed (arrivalGen != gen)
    Edited by: jverd on Jul 14, 2010 10:05 AM
    Edited by: jverd on Jul 14, 2010 10:08 AM

  • Question about method calling (Java 1.5.0_05)

    Imagine for example the javax.swing.border.Border hierarchy.
    I'm writing a BorderEditor for some gui builder, so I need a function that takes a Border instance and returns the Java code. Here is my first try:
    1 protected String getJavaInitializationString() {
    2     Border border = (Border)getValue();
    3     if (border == null)
    4         return "null";
    5
    6     return getCode(border);
    7 }
    8
    9 private String getCode(BevelBorder border) {...}
    10 private String getCode(EmptyBorder border) {...}
    11 private String getCode(EtchedBorder border) {...}
    12 private String getCode(LineBorder border) {...}
    13
    14 private String getCode(Border border) {
    15     throw new IllegalArgumentException("Unknown border class " + border.getClass());
    16 }This piece of code fails. Because no matter of what class is border in line 6, this call always ends in String getCode(Border border).
    So I replaced line 6 with:
    6     return getCode(border.getClass().cast(border));But with the same result. So, I try with the asSubClass() method:
    6     return getCode(Border.class.asSubClass(border.getClass()).cast(border));And the same result again! Then i try putting a concrete instance of some border, say BevelBorder:
    6     return getCode(BevelBorder.class.cast(border));Guess what! It worked! But this is like:
    6     return getCode((BevelBorder)border);And I don't want that! I want dynamic cast and correct method calling.
    After all tests, I give up and put the old trusty and nasty if..else if... else chain.
    Too bad! I'm doing some thing wrong?
    Thank in advance
    Quique.-
    PS: Sorry about my english! it's not very good! Escribo mejor en espa�ol!

    Hi, your spanish is quite good!
    getCode(...) returns the Java code for the given border.
    So getCode(BevelBorder border) returns a Java string that is something like this "new BevelBorder()".
    I want Java to resolve the method to call.
    For example: A1, A2 and A3, extends A.
    public void m(A1 a) {...}
    public void m(A2 a) {...}
    public void m(A3 a) {...}
    public void m(A a) {...}
    public void p() {
        A a = (A)getValue();
        // At this point 'a' could be instance of A1, A2 or A3.
        m(a); // I want this method call, to call the right method.
    }This did not work. So, i've used instead of m(a):
        m(a.getClass().cast(a));Didn't work either. Then:
        m(A.class.asSubClass(a.getClass()).cast(a));No luck! But:
        m(A1.class.cast(a)); // idem m((A1)a);Woks for A1!
    I don't know why m(A1.class.cast(a)) works and m(a.getClass().cast(a)) doesn't!
    thanks for replying!
    Quique

  • Questions About Printing in Java

    Alright, I've been looking at the Java printing API. I like it, it's nice. I've got a drag-and-drop workspace that the user wants to print, so I just use m_workspace.paint(Graphics) on the print Graphics object to paint the workspace onto the page. Very nice.
    Here's the issue. I want to fit as many workspaces on a page as is possible. Now, with a Graphics2D object, I can call a couple of methods to get its height and width. I need to be able to determine the height and width of the Graphics object that the printer hands me. Here are the questions as best as I can describe them:
    * Is it possible to find the height and width of a Graphics object? How else can you determine a Graphics object's coordinate range?
    * When the Printable interface is given a Graphics object on which to print, does the Graphcis object represent the whole page or just the printable area of the page?
    * The PageFormat class provides methods for determining the height and width as well as the printable height and width of a page in 72nds of an inch. How does one determine the intended printing resolution (dpi) of the print job? If this cannot be done, how is it possible to determine the size of the page in pixels?
    I'd really appreciate help with this as fast as it can be mustered. This program needs to be completed by Friday morning and I'm clueless as to the Java printing interface.
    Thanks for any time you've spent reading this and the time you may spend answering it. :) Best wishes!

    After perusing the many books of one of my coworkers, I think I have good reason to believe the following:
    * Printing with the Printable interface is always at a resolution of 72dpi (1 pixel per point).
    * The Graphics object passed to print(...) represents a pixel space equal to the number of points of each dimension of the imageable area of the page.
    Can anyone with experience with Java printing confirm these conclusions?

  • Questions about example "Dynamic JDBC Credentials for Model 1 and Model 2"

    Hello,
    i am trying to set up dynamic JDBC authentication in my ADF BC application - i want that it'll work like in Forms - a dababase user with the proper priveleges can log into my ADF BC application using his database login and password, and work with application.
    I've read the paper "How To Support Dynamic JDBC Credentials" at
    http://www.oracle.com/technology/products/jdev/howtos/10g/dynamicjdbchowto.html
    and test the very useful example, created by Steve Muench, which i've got from
    http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#14
    The example works, but when i'm transfer its realisation in my application - it doesnt work the right way. The problems is the following:
    1. I can connect and work successfully only under the owner of the schema - the username and password of which i've wrote in the "jbo.server.internal_connection" string of the AM configuration.
    2. When i'm connecting under other users, which have all the rights to work with the db objects, used by application, i got the main page with the "Access Denied" message - as i have no priveleges to the tables.
    3. The big surprise is that if i am entering the fake username and password - the random letter combination - then i am getting the same behavior as in p.2 - the main page with the "Access Denied" message!
    And the last question is:
    4. Is it possible to set up the dynamic jdbc authentication using the build-in JDeveloper functions - i mean not to use that additional code, not override the ADF Binding Filter, and so on, but set up the similar behaviour (users log in using their db names and passwords) in several minutes following the standart documentation?
    Thanks in advance!

    One more question:
    I have 2 independent Application Modules in my application - to make the 2 transactions independent one form another, when working with different parts of project - and while using dinamic JDBC authentification, the user connects only in the first AM under the username he's entered, but the 2nd AM works under the predefined earlier (during development) connection for that AM.
    How can i make the 2nd AM to be connected under the logging in user (same as the 1rst AM)?

  • Question about SSO (for Java Dialog instance) for Portal EP 6.0 SP 20

    Hi All
    I have following question.
    We are running Portal 6.0 SP 20. We have JAVA (Portal) CI+DB running on single host SAPQP1 and Two JAVA Dialog Instances (J2EE Application servers) running on separate host namely SAPAP35 and SAPAP36.
    I was able to configure SSO between SAPQP1 (CI+DB) and ECC R/3 system (QC1). SSO is working fine. Users can access all ESS/MSS data in portal when they use Portal URL running on SAPQP1 (http://sapqp1.xxxxx.com:50000/irj).
    But when users try to access ESS/MSS data via portal (URL) running on SAPQP35 (http://sapap35.xxxxx.com:50000/irj) and SAPAP36 ((http://sapap36.xxxxx.com:50000/irj) SSO does not work, i.e it system asks user id and password.
    So , how I can configure SSO between SAPAP35 and SAPAP36 JAVA Dialog instances and ECC R/3?

    Hi Sandip,
    obviously you already configured QC1 to accept Tickets issued by the Java Engine on SAPQP1. Did you imported the public (java) certificates from SAPAP35 and SAPAP36 into your ECC System? The certicficates need to be added in client 000 to your System PSE and in your production client to your ACL.
    Regards,
    Enno

  • Question about Dates in java.

    Hello ,
    I have a JTextfield in a swing app. that is supposed to hold date and saves its values to a database column of Date type .
    All I want is when i get the text from the TextField to use it in the prepared statement is to be of Date type not string , and also I want the user not to be able to insert anything but date in that field , I tried this but didnt work :
    Date date = new Date(0000-00-00);
    pstmt.setDate(5, date.valueOf(itemPurchaseDate.getText()));
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException
            at java.sql.Date.valueOf(Date.java:103)
            at omsapplication.AssetsMainPanel$1.actionPerformed(AssetsMainPanel.java:104)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6216)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5981)
            at java.awt.Container.processEvent(Container.java:2041)
            at java.awt.Component.dispatchEventImpl(Component.java:4583)
            at java.awt.Container.dispatchEventImpl(Container.java:2099)
            at java.awt.Component.dispatchEvent(Component.java:4413)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
            at java.awt.Container.dispatchEventImpl(Container.java:2085)
            at java.awt.Window.dispatchEventImpl(Window.java:2475)
            at java.awt.Component.dispatchEvent(Component.java:4413)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)Also how can I force the user to enter only dates ?
    Thanks.

    Im trying to get the the String in the TextField in order to use it in the setDate method of the Prepared Statement but there is something wrong with it :
    String DATE_FORMAT = "MM/dd/yyyy";
    sdf = new SimpleDateFormat(DATE_FORMAT);
    Date sdate = new Date();
    try{
    sdate = sdf.parse(itemPurchaseDate.getText());
    pstmt.setDate(5, sdate); //.............>>  The compiler says here : Cannot find symbol ?
    catch(ParseException pe)
    {pe.printStackTrace(); }

  • Question about Technologies in JAVA

    Hi all,
    I'm starting my final project for Computer Science in University and I pretend to develop an integrated e-learning environment for my faculty. I want to develop this by using JAVA WEB START within a JNLP, as a stand-alone application (not within a web-server as in JSP or so).
    I would like to connect this application to a database server (oracle or posgres) to retrieve some data, might use also some connections to a NFS server and may use som cryptographic utilities to ensure some security on the application.
    Would anyone recommend me some IDE to develop such application? I would also ask for some ideas about the techonologies to use, since there are so many that I cannot find myself on this mess ;-)
    Thanks in advance to everyone,
    Fernando Mart�n
    [email protected]

    However, when I program in Java
    i find that most of the time I am making my variables
    global. (meaning public)Sounds like you are writing bad code. Public variables should be extrememly rare except static final 'constants'.
    Is the fact that they are in a class supposed
    to make up for that fact? Absolutely not.
    With subclasses you can also
    have 3rd parties working on your data. It seems a bit
    suspicious to me, like the data should be maintained
    more strictly, or is it my job to do that? Yes, it's your job.
    I am just
    curious, but it seems java promotes global variables,
    which I find to be bad programming practice since
    anything can operate on them. I appreciate any
    input...Java does not promote public variables. You have to explicitly make them public.

  • Question about Flash and Java in OS X 10.6.6...

    I am about to get a MacBook Pro this weekend (after having numerous problems with Windows and getting it to work with my hardware - that led to me thinking of buying a Mac. Nothing to do with viruses actually ;))
    Anyhow - does Snow Leopard 10.6.6 ship with Adobe Flash, or do I need to install Flash myself? I'm not too concerned with doing that (I prefer to as I know I'm installing the latest version - just like Windows!)
    Secondly - does Apple provide updates for Java as well? Do I need to install Java myself, or does Snow Leopard ship with Java pre-installed too?
    Lastly - this is just your opinions, but which out of Safari, Chrome, Opera and FireFox do you consider to be the safest (and securest) browser for Mac?
    Thanks,
    Xavier12.

    It is best to follow Adobe's instructions for updating its software, which varies by the product & versions involved. This usually works well but Adobe is one of those companies big enough to play by its own rules, sometimes ignoring Apple's developer guidelines or inventing its own API's instead of using the Apple provided ones that do the same thing, so there is a small chance things won't go as expected even when you follow the instructions to the letter.
    If this happens it is best to seek advice on a product by product, version by version basis.

  • Question about mapping a JAVA Interface with Flex

    I am using Granite Data Services (Java backend) with my Flex
    client.
    The Java server has an Interface called
    public interface IService {String getServiceName();}
    The flex client makes a remote service call on the server
    POJO which returns any implementation of the specified interface.
    On the flex side I have an interface
    [Bindable]
    [RemoteClass(alias="com.*****.proxy.pojo.IService")]
    public interface IService{function getServiceName():String;}
    As shown i am binding it to the server interface.
    From the client I make a call to the server and handle the
    result as shown below
    var serviceInstance:IService =
    (remoteO.testInterface.lastResult as IService);
    Alert.show("Service Name :
    "+serviceInstance.getServiceName());
    The call reaches the server and the remote method is being
    called however the Alert is not working.
    Please Help !!

    //Start other thread closeT
    System.exit(0)
    //code for thread closeT
    //wait 10 s
    Runtime.getRuntime().halt()
    Gil

  • Question about SAP BI Java SDK

    Hello @ all,
    I´m new to this topic and I want to ask, if its possible to draw charts with BI Java SDK?
    Please help, its urgent!
    Thank you!

    Hi Mehmet,
             Have a look at this thread reporting on the same issue.
    Re: Charts  using BI SDK
             Hope it helps u in solving ur problem.
             Assign points if this link is helpful
    Cheers,
    Aravindhan

Maybe you are looking for

  • How to get BOM compoents at the lowest level using BOM tables?

    I am doing a report based on CK13N wherein i hav material and plant as the selection parameters and based on that i get the product costing of the entire BOM. I pass material to MAST.get the BOM num and usage Pass it to STAS and get STLKN (ITEM NODE

  • QT Pro - cropping

    Does QT Pro have cropping capabilities for the video portion of a .MOV file, that is, just keeping the wanted area of the video and removing the rest whle retaining 100% of the audio? Compaq   Windows 98  

  • SWF scaling problems in a Portfolio

    How do I get a SWF to scale properly in my Acrobat 9.x portfolio home page? Objects don't seem to keep their relative proportions/composition when the window is resized.

  • Problem with Multiple Series - CFCHART

    Using CF9, trying to create a simple chart with two series.  Problem is that when there are no values, CFCHART draws a line but with values of "0". The first series is a set of monthly values (12 values) one for each month in 2011. The second series

  • Indigo ibook sleep mystery

    Hi gang, i know this has been discussed here before, but i couldn't find a solution that worked. i have an insomniac indigo iBook (FireWire). It has the latest firmware installed. It is loaded with OS 9.1 and OSX 10.4.6 (via Xpostfacto). When running