PLEASE HELP!! Drawing Lines

Hi, I'm new to Java and i need some help with drawing an asymptotic curve.
I have tried many times experimenting with g.drawline but I have no idea how to do it !!
here is an example of what i want to draw:
http://www.iit.edu/~smart/acadyear/fredstof.gif_
Can someone please help me?
I need the code urgently!
I just need the lines, plain black with a white background
and it should also be able to be stretched to any size by dragging the corner of the window
THANK YOU VERY, VERY MUCH.

http://forum.java.sun.com/thread.jspa?threadID=5258979

Similar Messages

  • Please help Verticle line problem

    Please help I have worked on this for hours below is my code. I need to create a face and I have a problem getting my g.drawline in the right place. I need it in the middle between the two eyes and not matter what I do it won't work. Could you help, please.
    import java.awt.*;
    import javax.swing.*;
    public class Face extends JFrame {
         public Face(){
              super( "Face" );
              setSize( 300, 170 );
              setVisible ( true );
         public void paint ( Graphics g ){
              super.paint( g );
              g.setColor( Color.yellow );
              g.drawArc( 100, 45, 80, 80, 0, 360);
              g.setColor( Color.blue );
              g.drawArc( 120, 70, 10, 10, 0, 360);
              g.setColor( Color.blue );
              g.drawArc( 150, 70, 10, 10, 0, 360);
              g.setColor( Color.magenta );
    (this is the nose)     g.drawLine ( 90, 147, 90, 180 ); THIS IS THE LINE I HAVE A PROBLEM
              g.setColor( Color.red );
              g.drawArc ( 110, 55, 60, 60, 0, -180 );
         public static void main(String args[])
              SmileyFace application = new SmileyFace();
              application.setDefaultCloseOperation(
                        JFrame.EXIT_ON_CLOSE );
    I have changed the int to every possible number and it just won't work for me what am I doing wrong

    try:
    g.drawLine ( 140, 85, 140, 110 );
    When you drew your head you specified g.drawArc( 100, 45, 80, 80, 0, 360);
    What you are really saying is:
    a) position the circle inside an imaginary rectangle with the top left corner at (100, 45) and make the width of the rectangle 80 and the height 80.
    b) the center of this rectangle is
    x = 100 + 80/2 = 140
    y = 45 + 80/2 = 85
    c) therefore draw a circle using (140, 85) as the center point (which is where I started your nose)
    Add the following line to your program and you will see how the head fits into the rectangle:
    g.drawRect(100, 45, 80, 80);
    Hope my explanation helps.

  • Please help me line up my cells or tables

    I cannot ge tthe elements on my webpage to line up I have
    moved them around all to no avail the page is:
    http://www.abea.cc/aboutus.html
    notice the offset between the headers and the white body. Could
    someone please help me I am lost. I can line them up perfectly in
    my preview but always offset when I look at them online.I am using
    dreamweaver cs3.

    This image (and others like it) are what's messing you up:
    http://www.abea.cc/images/The-Bay-Shortest-Header_10.jpg
    Adjust the images to not show any of the black outside of the
    white line, then you'll have an easier time adjusting the table
    below it. Once you fix the image you'll have to adjust the table
    structure.

  • Please Help!  Line Length Outside of Window

    I'm not stating this properly. But suddenly, my Safari windows have content which is not all contained therein. I can only read part of it. Same problem with my e-mail.
    Unable to shorten length of lines in e-mail, and unable to adjust window. Have gone to Preferences/Appearance, etc.
    Please tell me how to explain this problem, if I am not being clear.
    Thanks for any help you can offer.

    I would suggest you revisit the Universal Access to double check that you did what I suggested.
    Also make sure that "Use Grayscale" is not checked in Universal Access.
    Your line length problem might be caused by your changing the resolution of your monitor. What kind of monitor are you using and do you know what its advertised resolution is? Something like 1280x1024 pixels, for example.
    I notice in an earlier post in another forum that you reported the following, which I will quote for the benefit of those joining this thead later:
    "I'm using a MacMini OS 10.2.9. Everything was great, then on start-up all was different. My Desktop picture had disappeared, everything was in purple etc. My e-mails have long line length and I am unable to shorten. Have looked at preferences etc. and nothing helps. (I put back the desktop picture, but everything else is beyond me.)
    I don't recall if I recently updated software, but suspect that is why everything is messed up.
    Sorry if this has been asked before, but I'm quite frustrated. This font is not what I thought was selected, either! "
    I'm a bit confused about your reporting OS 10.2.9. Is that a typo? I think Minis never shipped with anything lower than 10.3.x. Your signature reports 10.4.6.

  • Please help: Extra Line Space after bolded word

    I am in the process of editing a book manuscript in MS Word 2010, and there is an annoying problem that I cannot solve. I have tampered with all the line spacing options, but I'm at a loss.
    When I bold a word, it introduces an extra little line space before the proceeding line. When I unbold the word, the space goes away. Has anyone encountered a similar issue? And is there an easy fix?
    Thanks very much,
    Jon

    Are you saying that the line spacing changes when you apply bold formatting? Try a different font. Or you could specify a fixed value for line spacing (choose the "Exactly" option in the Paragraph dialog box).
    Stefan Blom, Microsoft Word MVP

  • Please help. Line in the middle of screen

    Hi, I've an iBook G4, 1.33 mhz. There is a straight line right across the screen, in the middle. How do I remove it.

    Hi, and welcome to Apple Discussions.
    Have you tried restarting the iBook? Sometimes a glitch like this will be corrected by a simple restart.

  • PLEASE HELP! Guitar line in on Audigy 2 ZS not working

    i have a sound blaster audigy 2 ZS platinum pro. In every program i try to use (FL 4, reason, krystal, ...) i can not even hear my guitar when plugged in to the sound card. I have tried the obvious, making sure i'm not in digital only mode, checking the cables. Some one please help.

    Does Line-In work w/ normal line sources?
    You propably need a pre-amp for guitar input through Line-In port but, if the port you're using is a Hi-Z port (you find this information from Audigy User's Guide) then, it should work even w/o additional pre-amp.
    jutapa

  • Here are my last 3 duke dollars.  Can someone please help me draw a line?

    I have been BEATING my head on this for well over a week now. I'm new to Java2D and I cannot find even one example of this simple little thing that I am trying to do. Not one.
    All I want to do is draw an image, zoom that image, then draw some lines on that image, and then zoom it and have those lines show up where they should.
    For example, we have an image which has been zoomed. No lines are yet drawn on it.
    A line is added.
    The image is then zoomed in or out one more time.
    How do we get the line to remap to the newly zoomed image?
    What I am doing is:
    0) Load up an image from a file.
    1) Create a zoomed image by using the Image.getScaledInstance() method.
    2) Create a BufferedImage with the width and height of the image AFTER the zoom has taken place.
    3) Create a Graphics2D object by the createGraphics from this BufferedImage.
    4) Place the image into the BufferedImage by doing a BufferedImage.drawImage
    5) Select two points to be the start and end of the line.
    6) Draw the line using Graphics2D.drawLine(start.x, start.y, end.x, end.y).
    7) Zoom the image again (using the Image.getScaledInstance() method.
    8) Create a new ImageIcon using the image from above and override its paintIcon method like this:
    ImageIcon newIcon = new ImageIcon(newImage) {                       
    public void paintIcon(Component c, Graphics g, int x, int y)
    super.paintIcon(c, g, x, y);
    zoom(); //<---- ZOOM call
    Now in the zoom routine, what do I need to do to get the lines to draw at the proper location and size?
    Remember, the points of the lines (stored in a list as home grown line objects) are in screen coordinates, not image coordinates since they are just click points
    Note that when I use these points to draw a line, all is well (the line gets drawn where it should), but I have problems when I zoom the image.
    Thanks!

    Below is the documentation and method signature of
    Graphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer);The important thing to note is that it does scaling on the fly if the size dictated by the source co-ordinates is defferent than the size dictated by the destination co-ordinates. The source image is always left un-touched.
    So basically your visual data is located in an offscreen image. You can draw a line on that. Then create a new image, get it's graphics and call drawImage(original_image, co-ordinates that cause it to scale how you like).
    Then you can draw lines on the 2nd image, create a 3rd, ...etc
         * Draws as much of the specified area of the specified image as is
         * currently available, scaling it on the fly to fit inside the
         * specified area of the destination drawable surface. Transparent pixels
         * do not affect whatever pixels are already there.
         * <p>
         * This method returns immediately in all cases, even if the
         * image area to be drawn has not yet been scaled, dithered, and converted
         * for the current output device.
         * If the current output representation is not yet complete then
         * <code>drawImage</code> returns <code>false</code>. As more of
         * the image becomes available, the process that draws the image notifies
         * the specified image observer.
         * <p>
         * This method always uses the unscaled version of the image
         * to render the scaled rectangle and performs the required
         * scaling on the fly. It does not use a cached, scaled version
         * of the image for this operation. Scaling of the image from source
         * to destination is performed such that the first coordinate
         * of the source rectangle is mapped to the first coordinate of
         * the destination rectangle, and the second source coordinate is
         * mapped to the second destination coordinate. The subimage is
         * scaled and flipped as needed to preserve those mappings.
         * @param       img the specified image to be drawn
         * @param       dx1 the <i>x</i> coordinate of the first corner of the
         *                    destination rectangle.
         * @param       dy1 the <i>y</i> coordinate of the first corner of the
         *                    destination rectangle.
         * @param       dx2 the <i>x</i> coordinate of the second corner of the
         *                    destination rectangle.
         * @param       dy2 the <i>y</i> coordinate of the second corner of the
         *                    destination rectangle.
         * @param       sx1 the <i>x</i> coordinate of the first corner of the
         *                    source rectangle.
         * @param       sy1 the <i>y</i> coordinate of the first corner of the
         *                    source rectangle.
         * @param       sx2 the <i>x</i> coordinate of the second corner of the
         *                    source rectangle.
         * @param       sy2 the <i>y</i> coordinate of the second corner of the
         *                    source rectangle.
         * @param       observer object to be notified as more of the image is
         *                    scaled and converted.
         * @return   <code>true</code> if the current output representation
         *           is complete; <code>false</code> otherwise.
         * @see         java.awt.Image
         * @see         java.awt.image.ImageObserver
         * @see         java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
         * @since       JDK1.1
        public abstract boolean drawImage(Image img,
                              int dx1, int dy1, int dx2, int dy2,
                              int sx1, int sy1, int sx2, int sy2,
                              ImageObserver observer);

  • My IPhone 5 will not turn on, I had a new screen I stalled, all working great, the next day I was flying so turn off the phone and since trying to turn back in again,,, I receive many lines of white text stating incorrect shutdown please help

    hhello, please help if you can,,,
    i had a new screen installed, everything working fine, as was using the phone, the next day I was flying so turn off the phone in the usual way...
    oon arrival turned the phone on, received a slow acting black background with the apple sign visual, but never moved from that......... So tried a reset still the same just left looking at the apple sing in the middle if the screen,makes it there for 5 mins but still never turn on completely,,,,,
    again I tried,,,,,, again I tried a reset, then started to received lines of white writing, about 4-5 lines slowly like it was being typed, which stateed INCORRECT SHUTDOWN, ????????? then took out my MacBook air, to connect to ITunes to see whaypt I could do,
    i tunes did not find the phone as would normally so opened ITunes manually, still did not find the Iphone,,,,,
    Any Ideas please, as it is useless stuck in the drawer, I am an apple user, an quite knowledgable having other Iphine 5, IPad air and Mac,,,,, I am stuck,,,,
    PLease Help,my hank you in advance

    SharmFarm wrote:
    Good ev Ning Mario49    firstly I would like to say a great thank you for your attention to trying to help me,,,,,    i have looked at the links and will try everything stated first thing…
    Hi Mario,,,,
    I tried everything in your reply,,, thank you again,, I had done that once before and all was working great,,
    I have just now tried the Reinstall via iTunes, about 20 into the download, the iTunes logo on the phone disappeared, and the Apple Logo appeared again,,, I waited until the iTunes stated that the download had finished, and the install was in progress,,,
    Nothing happened, still the Apple Logo was visual on the screen, iTunes never recognised the phone which it was on my iTunes account previously,,,
    Still just a bunch of lines, maybe 5 or 6 so small writing,, I personally can not read what it is telling me, someone said it reads, incorrect shutdown,,,????????
    Please advise,???
    I am now at a loss,,, I really became excited when I saw the iTunes icon after putting the phone into restore,,,???
    Thank you again
    D

  • Paintbrush tool reverts to color/fill none. Cannot draw/trace anything. Please help

    Hello,
    I am fairly new to Illustrator and need some help. I am trying to trace an image using the brush tool. I can get some lines in and for some reason the brush tool begins to revert to fill none effectively just making invisible lines. I have the parent image on its separate layer and the line art on another layer. Layers are unlocked. When I use the brush it will look as if it is deleting/erasing what is shown on both layers. The brush tool is effectively erasing what is there already instead of drawing.
    I tried searching for a couple days now and the best I could find is this:
    http://forums.adobe.com/message/4799313
    I tried everything mentioned in the thread and it still isn't working. In fact I think the OP in that thread never really solved his issue too. I can barely even get my line art down please help! Thanks

    Thanks rcraighead. I ended up just ctrl z-ing(is that even a work haha) back to a point were the brush worked. However I still dont know what happened. Thanks for your reply, if it ever happens again I will try it out.

  • PLEASE HELP!!!! Problem with my Huion H610n drawing tablet!!!

    I recently purchased a drawing tablet which is the Huion H610N its working perfectly however when I opened photoshop cc I tried drawing in a blank canvas and Its not showing anything. I tried using the 'basic brushes' instead of my 'custom brushes' and it lets me draw and I can see it however the sensitivity is not showing when I draw using the 'basic brushes' the lines are just plain BOLD please help! I dont know why its doing this!

    Try accessing the *System Preference* panel, named *Universal Access*;
    then, note the choices within it include Mouse (among other) and click
    on the Mouse section to check and see if _+the slider control+_ to change
    the Size of the *Cursor icon* has been moved over to make it larger.
    You can check/change several settings in Universal Access; also some
    of these have keyboard shortcuts which may be engaged by a user,
    by accident due to random use of a keyboard. Be aware of this, since
    a pattern of changes when children use a computer may repeat; as
    similar keyboard mistakes (or intentional odd results) use similar keys.
    There are symbols representing keys used to engage Universal Access;
    their icons in this control panel area of System Preferences should be-
    come familiar to you, so when/if other odd visuals occur, check here.
    Notice what the 'default' settings are, in the different U.A. panel areas.
    This will help when you find another issue arise; a repeat is likely.
    You may choose to set up a different user account in the Mac then have
    it not allow full access to more than a few basic necessities, for a child.
    +PS: Hello, and welcome to Apple Support Discussion Communities!+
    Good luck & happy computing!
    +{ edited }+

  • NEED HELP!!!How to make LINES Colorful--PLEASE HELP!!!!!!

    i want to draw a red line:
    Graphics g;
    g = b.getGraphics();
    g.drawLine(20,5,100,64);
    but the line is black, i want it red.
    the command g.setColor(color.RED) is not working....
    WHATS WRONG, please help, thanks thomas

    Here is my code....
    mport com.ms.wfc.app.*;
    import com.ms.wfc.core.*;
    import com.ms.wfc.ui.*;
    import com.ms.wfc.html.*;
    import com.ms.awt.*;
    * Diese Klasse kann eine variable Anzahl von Parameter auf der Befehlszeile
    * entgegennehmen. Die Programmausf�hrung startet mit der Methode main(). Der
    * Klassenkonstruktor wird nicht aufgerufen, bevor nicht ein Objekt vom Typ 'exel'
    * in der Methode main() erstellt wird.
    public class exel extends Form
         String datum2="";
         String userdateinput="";
         int count=0;
         int i=0;
         int day7=0;
         int m=0;
         int p=0;
         public exel()
              super();
              for (i=0;i<31;i++)
              Point[count]="305";
         Graphics g;
         int xx1=5;
         int xy1=305;
         int xx2=600;
         int xy2=305;
         int yx1=5;
         int yy1=5;
         int yx2=5;
         int yy2=305;
         int i=0;
         //Bitmap b = new Bitmap("c:\\BACKGROUND.BMP");
         Bitmap b = new Bitmap(600,600);
         b.setTransparentColor(Color.RED);
         g = b.getGraphics();
         g.drawRect(0,0,600,600);
         g.drawRect(0,0,600,600);
         g.setBackColor(Color.RED);
    g.setColor(Color.RED);//HERE IS THE ERROR!!!
         g.drawLine(5,10,5,305);
         g.drawLine(5,10,10,10);
         g.drawLine(xx1,xy1,xx2,xy2);
         for (i=0;i<5;i++)
              yx1=5;
              yy1=60+yy1;
              yx2=10;
              yy2=yy1;
              g.drawLine(yx1,yy1,yx2,yy2);
         for (i=0;i<31;i++)
              xx1=xx1+15;
              xy1=305;
              xx2=xx1;
              xy2=300;
              g.drawLine(xx1,xy1,xx2,xy2);
         int h=0;
         int counter7=0;
         yx1=-10;
         int counter8=0;
         int counter6=0;
         for (h=1;h<31;h++)
              int cpoint=com.ms.wfc.util.Value.toInt(Point[h-1]);
              int cpoint2=com.ms.wfc.util.Value.toInt(Point[h]);
              yy1=305-(cpoint*3);
              yy2 = 305-(cpoint2*3);
              yx1=yx1+15;
              yx2 = yx1+15;
              if (cpoint==0)
                   yy1 = 0;
                   yy2 = 0;
                   yx1 = 0;
                   yx2 = 0;
              if (cpoint2==0)
                   yy1 = 0;
                   yy2 = 0;
                   yx1 = 0;
                   yx2 = 0;
              g.drawLine(yx1,yy1,yx2,yy2);
              if (cpoint==0)
                   for (counter6=0;counter6<counter7;counter6++)
                        yx1=yx1+15;
                        yx2 = yx1+15;
              if (cpoint2==0)
                   for (counter8=0;counter8<counter7;counter8++)
                        yx1=yx1+15;
                        yx2 = yx1+15;
              counter7++;
         pictureBox1.setImage(b);
              // Erforderlich f�r die Unterst�tzung des Visual J++-Formulardesigners
              initForm();          
              // ZU ERLEDIGEN: F�gen Sie beliebigen Konstruktorcode hinter den Aufruf von initForm hinzu
         * exel �berl�dt dispose, damit es die Komponentenliste
         * bereinigen kann.
    public void dispose()
         super.dispose();
         components.dispose();
    String DATUM="";
    private void start_click(Object source, Event e)
         /**DATE**/
         java.util.Date Date = new java.util.Date();
         java.sql.Date sqldate = new java.sql.Date(Date.getTime());
         String dat = String.valueOf(sqldate);
         //datum.setText(DATUM);
         //Start von EXEL
         try
              String makro="C:\\Program Files\\Microsoft Office\\Office\\XLSTART\\PERSONL.xls";
              String cmd = "C:\\Temp\\"+DATUM+"FLIP.xls";
              //String cmd = "C:\\Program Files\\Microsoft Office\\Office\\EXCEL.EXE Gr8galry.gra";
              String line = null;
              Process p1 = Runtime.getRuntime().exec(cmd);
              Process p2 = Runtime.getRuntime().exec(makro);
              //p.destroy();
         catch (java.io.IOException e1)
              //exception.setText("error");
    String Point[]=new String[31];
    private void button1_click(Object source, Event e)
         close();
    }

  • Could you please give me the method to draw Line Graph in detail?

    Could you please give me the method to draw Line Graph in detail?

    Hi,
    First update your username instead of using that number.
    and also provide full information like
    Apex version
    Database version
    I am giving you one link related to charts,
    http://dgielis.blogspot.in/2011/02/apex-4-bug-series-type-bar-line-marker.html
    Hope this will helps you
    Thanks and Regards
    Jitendra

  • HT1800 How can I add a Epson Stylus SX445w to my mac Book Pro this is the second one I've tried and failing miserably...it should be so simple...spoken to the help line at Epson and they say it's down to Apple !! Somebody please help me

    How can I add a Epson Stylus SX445w to my Mac Book Pro
    This is the second one I've tried and failing miserably...it should be so simple...I've installed poken to the help line at Epson and they say it's down to Apple !! Somebody please help me

    Yes I did everything that I was instructed to do!
    Cheers
    Joyce

  • 8800, battery symbol with red line through it. Won't boot. Please help!!!

    I recently bought a 8800 and when I inserted a battery, all I got was a battery symbol with a red line through it on a dim screen.  I changed batteries, tried to charge it via USB and from a wall outlet to no avail.  I tried cleaning the contacts and tried uploading t a new  OS, but it wont recognize the phone being connected when it actually is.    I am at the end of my rope with this phone and can't figure out what else to do.  Is it just gone? Please help me 
    Solved!
    Go to Solution.

    Leave the device to charge 2-3 hours, and then, still connected to the USB cable, remove the the battery from the device a few seconds and reinsert it. If it boots--leave it to charge to 100% (check Options > Status for the percentage).
    If it doesn't boot--try using a wall outlet charger if you are not. If you are connected via USB to the PC, make certain that you have Desktop Manager (or the USB device drivers) installed, which you can download below.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for