How do you drawlines in java 1.3.1?

I want to make a applet and drawlines with a xstart, ystart, xend, yend varibles, I know how to declare instantiate and initialize the varibles, but what method from which package and class in java 1.3.1 do I use? and one last question, should I use their constructors for xstart ystart xend yend if they have one?

If you use ints for xstart.... they don't need (and don't have) constructors. Just xstart = 50;
If you are making an applet, you can override the method public void paint(Graphics g), then look at Graphics in the API for what you can paint (hint, there is a drawLine() method)
http://java.sun.com/j2se/1.4.1/docs/api/java/awt/Graphics.html
Hope this helps,
Radish21

Similar Messages

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

  • How do you test your Java Pricing UserExits in eclipse?

    How do you test your Java Pricing UserExits in eclipse?

    do you have to deploy the java class on vmc server to debug it
    Yes
    - So, the classes have to be compiled error free and uploaded to VMC.
    - VMC has to be restarted to test your classes.
    - You have to set the log levels appropriately for your classes using SM53 / SM52.
    -  You can also perform VMC debug through Eclipse.
    all of the details are available in the pricing exit manual*

  • How do you change default java logo in JOptionPane?

    I want to know how do you change the icon(the java logo in the title bar) for the JOptionPane box. I am using a swing interface. I can change the icon of the main frame but not of the JOptionPane.
    for the main frame i have used:
         Toolkit kit = Toolkit.getDefaultToolkit();
         Image img = kit.getImage("mypicture.gif");
         setIconImage(img);
    Toolkit is part of java.awt package.
    thanks

    here was a discussions about that
    http://forum.java.sun.com/thread.jsp?thread=120724&forum=57&message=316526

  • Newbie Question...  How do you make sure java can find all the imports

    Hi everyone,
    I am new to Java and so far I really like it. But I am having problems porting applets to my websites. How can you make sure that all the references can and will be found in the applet...
    for example,
    I import javax.media.ControllListener in a project I am using and it works great in the applet viewer but when I try to port this to my website I'm working on, java can't find it. I really would appreciate any help on this cause then I would have java power :) and will keep me from losing my hair :).
    Thanks for those who help me.
    - Stan

    Hey jwenting,
    Thanks for the quick response. Classpath definitely makes sense so I have been reading up on that... But do you include .classpath file in your website too? And how would you reference it if you need to reference it?
    - Stan

  • How do you run another Java file from a master Java file?

    We're making a game in Java at school, and we need to know how we can run a Java file from another one - like inside the master Java file, we need to have a command to run game.java (something like that). Thanks!

    We're making a game in Java at school, and we need to know how we can run a Java file from another one - like inside the master Java file, we need to have a command to run game.java (something like that). Thanks!One doesn't "run a Java file", and there's no conventional definition of "master Java file". If you want to call the main() method of another class, just make sure the class is in your classpath and call the method. If you want to start up a separate JVM with that class as a process, use Runtime.exec() or similar method.
    ~

  • How do you invoke custom java classes???

    Could someone post a detailed method of invoking custom java classes that works including what files go where, settings and the way it is invoked etc.
    I have tried various ways from this forum and in the documentation without success. I am using IDM 8. I found these instructions regarding how you would do it if you were writing custom resource adaptors in the deployment tools guide:
    To install a resource adapter you’ve customized:
    1. Load the NewResourceAdapter.class file in the Identity Manager installation
    directory under
    idm/WEB-INF/classes/com/waveset/adapter/sample
    (You might have to create this directory.)
    2. Copy the .gif file to idm/applet/images.
    This .gif file is the image that displays next to the resource name on the List
    Resources page, and it should contain an image for your resource that is
    18x18 pixels and 72 DPI in size.
    3. Add the class to the resource.adapter property in
    config/waveset.properties.
    4. Stop and restart the application server. (For information about working with
    application servers, see Identity Manager Installation.)
    I tried the instructions here but placed my custom class in a folder entitled custom instead of /adapter/sample. Not sure about instruction 3 or whether it is relevent. Anyway nothings working.
    Edited by: masj78 on Nov 25, 2008 3:50 AM
    Edited by: masj78 on Nov 25, 2008 4:03 AM

    Hi,
    The way to add custom class is the same as you followed , put them in the WEB-INF/classes.
    To use the custom adapter ,
    Go To Resources - > Configure Types -> Add Custom Resource .
    Type in the fully qualified class name of the custom adapter you added.and Save.
    Now the new adapter you added should showup in the list of available adapters when you try to
    configure a new adapter.
    (Make sure that the prototype XML of your custom adapter is correct so that it displays the correct name / type for the adapter in the adapter list.
    Thanks,
    Balu

  • I'm trying to develop a PKI enabled plugin for firefox using add-on builder. how do you call a java applet using add-on javascript on add-on builder ?

    i have a signed applet which encrypts and digitally signs text information. i need to call this applet from the add-on javascript on firefox's add-on builder . how do i do it ?
    i've tried using contentScript and contentScriptFile to load the html file which calls the applet vis applet tag , it doesnt work.
    this is the error which croped up:
    Java Plug-in 1.6.0_26
    Using JRE version 1.6.0_26-b03-383-11A511 Java HotSpot(TM) 64-Bit Server VM
    User home directory = /Users/sreer1990
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    java.lang.NullPointerException
    at sun.net.www.ParseUtil.toURI(ParseUtil.java:261)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:861)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)
    at sun.plugin.PluginURLJarFileCallBack.downloadJAR(PluginURLJarFileCallBack.java:81)
    at sun.plugin.PluginURLJarFileCallBack.access$000(PluginURLJarFileCallBack.java:48)
    at sun.plugin.PluginURLJarFileCallBack$2.run(PluginURLJarFileCallBack.java:150)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin.PluginURLJarFileCallBack.retrieve(PluginURLJarFileCallBack.java:127)
    at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:186)
    at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:50)
    at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:70)
    at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(CachedJarURLConnection.java:201)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(CachedJarURLConnection.java:145)
    at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(CachedJarURLConnection.java:91)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(DeployURLClassPath.java:752)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$800(DeployURLClassPath.java:631)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(DeployURLClassPath.java:698)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(DeployURLClassPath.java:690)
    at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(DeployURLClassPath.java:652)
    at com.sun.deploy.security.DeployURLClassPath$3.run(DeployURLClassPath.java:400)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.deploy.security.DeployURLClassPath.getLoader(DeployURLClassPath.java:389)
    at com.sun.deploy.security.DeployURLClassPath.getLoader(DeployURLClassPath.java:366)
    at com.sun.deploy.security.DeployURLClassPath.getResource(DeployURLClassPath.java:230)
    at sun.plugin2.applet.Plugin2ClassLoader$2.run(Plugin2ClassLoader.java:966)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Plugin2ClassLoader.java:955)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:134)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:250)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:180)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Plugin2ClassLoader.java:240)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:180)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Plugin2ClassLoader.java:161)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plugin2ClassLoader.java:675)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3046)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1498)
    at java.lang.Thread.run(Thread.java:680)
    Exception: java.lang.NullPointerException

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox. <br />
    http://forums.mozillazine.org/viewforum.php?f=25 <br />
    You'll need to register and login to be able to post in that forum.

  • How do you get the Java API onto Computer

    Hi guys,
    Well I want to practice Java at home, but instead have been staying up late at night at the University's Computer Lab.
    I have downloaded the Forte for Java, but I don't need all the Graphics classes since my programming class is centered on Programming in the UNIX environment. Not too long ago, I purchased SuSE Linux which had the Java Language and the compiler. I successfully managed to dual boot an old computer with it. It was easy because SuSe Partitioned the drive for you if it had a WIN32 filesystem.
    My parents bought me a laptop and it came with Windows XP. I have ever since wanted to Dual Boot this system with Suse Linux, but can't because 1.) SuSe Linux doesn't partition the drive because Windows XP resides on a NTFS filesystem. 2.) I can't risk doing it myself because I have a lot of critcal information.
    It would be really neat to work in Linux to program, because then I could do some serious homework as well practice. Forte for Java I am not really knowledgeable of it. I can't get the editor to work and it doesn't feel like I am in UNIX at all which defeats the purpose of taking trying to succeed in this programming class.
    Could somebody help me with my woes on how to deal with these matters. How can I get SuSe Linux on my XP computer safely and if it can be done how do I use the Forte for Java.
    Thanks for all your support,
    mileinfive-serious about programming

    The first question: http://sdb.suse.de/en/sdb/html/dstark_linux_xp.html
    F4J will be the same on both operating systems.. what actually is your question regarding it?

  • How can you get a java program working on a cell phone?

    I was thinking of making some stuff for cell phones so i was wondering how you get a normal java program to work on cells.

    its all j2me - midlet package....Huh? The jsr-118 MID profile alone has 11 packages, one of which is javax.microedition.midlet. Notj2me - midlet.
    works best on nokia phones.Sez who? You seem to be confusing Java ME with Symbian C.
    you can use net beans midlet packge add-on.Only it's called the NetBeans Mobiliity Pack.
    Its easy to use and has lots of tutorials.Ditto for the Wireless toolkit for CLDC.
    just search on google.Yes, but with which keywords?
    @OP:
    NetBeans mobility pack comes with a short tutorial and several samples, you also need to download the latest WTK as the ver. 2.2 which comes bundled with NetBeans is just too buggy to work with. Then there are the manufacturer-specific SDKs from Nokia, Motorola, Sony Ericsson and (maybe) others.
    If and when you get started in Java ME aka j2me, it will be appropriate to post any questions you might have on the mobility forums, not here.
    Google "j2me tutorial" for many good hits.
    luck, db

  • How do you open a Java Pop Up link in a new tab without looking at the properties of every link

    In the next version of Firefox, please include an option when a user right-clicks a java pop-up link, there is an option to "open link in new tab".
    90% of most links are “normal” links and not java popup links. It is actually frustrating when a link is a java link because I right click it and it and I get denied. I then have to "left click it". One too many clicks. The menu options when you right-click a java pop up link aren't too extenisive anyway, so adding this option shouldn't take up much real estate.
    I understand the user can look down at the link properties when hovering over a link, but that would suck to glance down before every link click.
    Please let me know if I am simply surfing the innefficient way.
    Thanks,
    Dan

    andtrobs wrote:
    Something I have noticed with the iPad that it is possible for webpages to run as if they are in their own app.
    No, what you're seeing is the actual webpage
    For example, the BBC iplayer (www.bbc.co.uk/iplayer). Open this site in safari, add an icon for it to your home screen, then when you use this icon to open the iplayer it opens as if it is an app, it doesn't have the address bar or back and forward buttons etc.
    Actually, it does. Or should do, ay least. It does for me
    Also when you double click the home button the iplayer icon shows up with the rest of the apps (usually you just get safari there) and if you open safari and look at the pages you have open it doesn't show there. It really does look as though it is an app, although what I'm guessing is happening is that it is open in a new instance of safari.
    That's correct
    My question is, does anyone know how to get a site to do this? I'm assuming there are some meta tags in the HTML but I can't find any references to this being possible let alone how to do it.
    The site doesn't do it. Safari does it. All you have on your Home screen is the iPad equivalent of a webloc, a small text snippet containing the URL for whatever page you saved.
    Message was edited by: Michael Morgan1

  • How do you make a .java run on a desktop

    I'm fairly new to java, only 2 semesters worth, and I did a final project this past semester that tied into our tutoring lab at school. Although I completed it for the class, it needs more for the lab.
    I need to know what I need to do so that the lab can just run the program from the desktop and not have to run the compiler each time. I'll be dealing with non-computer people. I'm still developing the GUI and need to add time stamps and a couple of other things that I'm relaying on books for, but I'm looking now for this answer in case I have to redue a lot of stuff.
    Like I said, I'm new to java and have been told that I can't just make the program a .exe. I also understand that all java needs to run is the language installed on the machine. So anyone know how I can do this?
    Thanks

    hi,
    Can NetBeans package into a jar file for
    me? If not what do I use? I dont know for sure, but IDE's normally provide this feature.
    I know it will be running on a Win, at least 2k, machine, but I would rather do
    the first method you suggested
    grins good decision, especially since urs is an academic project.....BUT, if u ever (in the future), go for a java-based project that u wud want to distribute, then remember that the "users" of ur project wud hv to have JRE installed for this, something which ppl dont always like.
    is the JRE available for download on the Sun website? Do I just install
    it like I did to set up NetBeans on my machine and
    the program will call it when run?Since u already have JDK installed, there is no need for additionally installing JRE. but if u want to run this application on some other system where JDK is not installed (and neither required ;), then u have to download and install JRE from Sun's download site.
    it is pretty straightforward to install the JRE. make sure that u hv the correct version of JRE, for example, if u developed ur project using JDK1.5, then download JRE1.5
    ======
    Kiran

  • URGENT: How do you distribute a Java program??

    I've made a small program using Java and it turned out to work perfectly fine, but now I am wondering how to package it so that anyone can just double-click something and have it run. I tried packaging it into a Jar file, but nothing seems to work (i.e. I get some manifest error) I've looked at tutorials online and I've also used the Jar packager tool that is a part of the JCreator IDE.
    I was also thinking about writing a dos batch file to have the program run from the command line; would that work as well??
    What is the easiest /nicest way to have a Java program packaged?(Sun should really add a java/.class to *.exe converter in a future JDK...)

    So many research-challenged people, and so little time.
    Google for "Java EXE"
    And no, Sun should NOT provide EXE output. EXEcutables are for a specific platform. Bytecode (.class files) are for platform independence, so that you CAN distribute the bytecode to run on any platform (any platform with a Java runtime, that is).

  • How do you start a java program with more RAM alloaction

    Hi
    can anyone please tell me how to start a java program to start with lots of RAM (RAM size is sent as a parameter), I have seen it somewhere and now I cant remember it. I have a server application to run this way.
    thanks and rgds
    sunil

    see the tooldocs of java: http://java.sun.com/j2se/1.4/docs/tooldocs/tools.html

  • How do you change a java program to a single file executable file?

    Hey guys I'm back with another new to java question :)
    i would like to have my java program that i made into an executable single file,
    i currently have my project compressed into a JAR file,
    and its working fine when i go click on it in the file that its in, it works fine but it has to be in that file to work... :(, i was wondering is there a way that i can have that file on its own to work, so that i can send it to someone and they just have to have that one file.
    thanks for the help

    If you want a jar file to behave the same way no matter what directory it is in (or is run from) then you have to make sure that all resources it uses are included in the jar. Such resources could include images and sounds that the application uses. Or files that it references.
    For instance thisFile foo = new File("foo.txt");is going to name a file that it is in the current directory (the directory the jarred or unjarred application was run from). If you move the jar, but don't move foo.txt then it won't be able to find the file.
    Any of your code that directly or indirectly uses files will have to change to use resources within the jar archive instead.
    If you get stuck, post some code. Something brief, compilable, runnable which shows what you mean by saying that it doesn't work.

Maybe you are looking for

  • How do I transfer my itunes library to a new computer?

    How do I transfer my itunes library from my old computer to my new computer?  My current computer is crashing and I need to buy a new one.  I have all of the libraries backed up on each of my devices, but I don't think I can simply sync the devices t

  • TWO WAY Sync is grayed out. Cannot two way synchronize BB.

    Outlook. BB.   When attempting to Configure Synchronization Settings for ASC II importer/exporter, the only options given are ONE WAY Synchronization either to or from the device. The one I want to pick: TWO WAY Sync is grayed out. How can I ungray t

  • .: Extremly wierd sound settings

    ? I'm runing Vista Ultimate x86 and a Soundblaster Audigy. ?Ok, i never had a problem untill now, with the sound card, or drivers, i had custom drivers, original disc drivers and updated drivers and i didn't have any issues... Untill now ?I don't kno

  • How can I use the three new Logic drummers in Garage Band?

    I have the latest version of GarageBand and the latest version of MainStage, but I have not upgraded to the latest version of Logic. However, the three new drummers available with the latest update to Logic are now visible in Drummer for GarageBand.

  • Plugging in my iPhone to my MBP via standard cable and I get this:

    I recently purchased and am using a Mophie Juice Pack Air. Is it possible this has anything to do with it??? The problem started after I began using the Juice Pack Air....