Problem with drawing polygon

Hello

I'm drawing a polygon, but its not connecting properly:

import java.applet.Applet;

import java.awt.*. *;

Javax.swing import. *;

public class polygon extends Applet {}

{} public void paint (Graphics g)

Example (g);

}

{} public void example (Graphics g)

int [] x = new int [] {100,200,300,400};

int [] y = new int [] {400,300,300,100};

g.drawPolygon (x, y, x.length);

}

polygon.png

Some body please guide me.

Zulfi.

Hello

I am able to fix this by changing the code:

int [] x = new int [] {100,200,300,400};

int [] y = new int [] {400,300,300,100};

TO

int [] x = new int [] {100,200,300,100};

int [] y = new int [] {400,300,300,400};

Zulfi.

Tags: Java

Similar Questions

  • problem with the polygonal lasso

    I Photoshop CC . I note polygonal Lasso area . Sometimes , during the selection will fix evil point , and I want to go back , but I can not . In previous versions Photoshop J’ai clicked on le " RET » et CC version of Photoshop only does not do. How to make Cancel click on points during the selection. Please help . Greetings . Dariusz

    Hello

    That was supposed to have been fixed in the 14.2.1 update for photoshop cc.

    Have you updated to 14.2.1 using help > updates in photoshop cc?

  • Problem with draw ap

    I put my page size to 800px of 800px.

    I use the DRAW AP tool to draw a rectangle in the center of my page. I set size width 800px and 200px deep.

    It is centered perfectly in design, but in the browser it sit proud on the left. I put the same margins that I had the ID of container, but not joy.

    When I use the leaders I place a sizes in sovereign right and left according to measures positioning and its perfect in design mode and browser.

    At the point where I have to hide the rulers, he jumps on 20px to the left and the same poster in the browser.

    I don't know what to do

    rsrpgr wrote:

    Thanks for your reply. I do not understand what you said

    You are welcome.  A better approach would be to just your image be the background image for an external container for your page.  In other words, everything on your page is located in the outer container.

    Murray

  • problems with VI to draw an arbitrary shape with the mouse.

    I have attached the vi which I am really struggling with. Basically, I want to select the n points using mouse clicks and then draw a shape connecting these points using

    a Boolean value LED to move smothely by points in order and back to the first point. I noticed that when the gradient between the two is negative the LED going in the direction opposite unexpectedly.

    I don't really know how to solve this problem.

    Any help will be appreciated.

    Hello gurucode

    I made the changes in VI, once more to the best of my knowledge.

    Problems with the code (if you have a straight line parallel to the y-axis of the movement is super fast)

    I left this one for you to play with all your taste

    PS. If you have some free time, you can watch in design patterns, they are pretty cool and help better manage your code

    Links:

    http://www.NI.com/white-paper/7595/en/

    http://www.NI.com/white-paper/3023/en/

  • Error code 998 problem with Corel Draw - error Code 998 for start Corel DrawX5

    System: windows 7 64 bit

    Product problem: Corel Draw X 5 including Corel Photo pain and Corel Draw
    Launch of the AU: code error 998
    "Could not load corelpp.dll" or "cannot load CorelDrw.dll.
    However, the .dll are existing.
    Uninstallation and reinstallation complete nothing changed the software.
    Thank you for your help.
    System: windows 7 64 bit
    My problem is with Corel Draw X 5
    When I run the application Corel Photo paint or Corel Draw, the error message is:
    "Could not load corelpp.dll" or "cannot load CorelDrw.dll.
    But the .dll file really leaves in my C:
    Thank you for your help

    Probably better if you ask Corel. Because this is not the Microsoft program

  • I have a really basic problem with Adobe to draw, I made a drawing on top a photograhp, then delete the background and now when I send the image in jpg format, it is too small. Any ideas how to make images to draw out more?

    Just like the title says, I have a little problem with Adobe draw. I put a picture as a background, designed something on it, deleted the photo behind and when I send the drawing to myself as an image is too small. I have no idea how to change or enlarge the image. Help?

    HI Marco,.

    I just spoke to the engineer on this yesterday (sorry, I wanted to write). We were unable to reproduce the problem, and looking at the code, there is no reason for this. I'm sorry.

    I don't know if this will help, but if you want, I can get you on the list of our tester for you the most recent draft of the app. If you want to try this, write to me (thanks to feedback in-app; tap the icon of the draw, then give us your comments) with the email address you would like that I use for Apple TestFlight.

    Sue.

  • Since Acrobat Reader downloaded DC I can't sign my PDF documents. It does not give me the option more and yes I am connected. On the old version, I got no problem with clicking on "signature" and draw the area where I needed my signature, put passw

    Since Acrobat Reader downloaded DC I can't sign my PDF documents. It does not give me the option more and yes I am connected. On the old version, I got no problem with clicking on "signature" and draw the area where I needed my signature, put the password and "POOF" my signature would be there. With this new version, it won't do that or give me the option. The online help is useless. I need to explain to me how connect you as I used too?

    Hi nicholass35183848,

    I assumed that you had a digital signature created in your player application of old and whenever you use to fill out a pdf with a signature field signed you it. But in order to draw and then sign you must use Acrobat Pro DC no DC drive.

    Thank you

    Abhishek

  • How to solve the problem with the wacom tablet and the polygonal lasso tool. It does not work with a pen.

    How to solve the problem with the wacom tablet and the polygonal lasso tool. It does not work with a pen. I have install windows 10 and fresh, new drivers for wacom bamboo, could he makes problems or there is a problem of photoshop?

    It should do.  You use one of the buttons of pen maybe?  Just touching wheels with the pen with no buttons or modifier keys.  Press ENTER to close the selection.

    Personally I never use the lasso, Polygonal, but rather just the Lasso tool by using the ALT (Opt) to operate the Polygonal tool.  I also use the mouse instead of the Tablet for the selection of cutting edge.  It is a little too uncertain where the point will go when hovering the stylus above the image.

  • Mac OS - problems with the arrows with drawing tools

    Hi everyone, I have a problem with illustrator cs4 on mac os 10.5.

    When I use the arrow keys to change the properties of the drawing of the tools (segment, arc, spiral, etc.), they change too fast.

    example: when pressing the arrow to increase the segments of the spiral, he adds too segments (like 5 or 6), I can't increase one by one...

    can someone help me?

    Thank you

    PS: Sorry for any mistake, English is not my first language

    You use a WACOM Tablet?

    We're talking about behavior with the tablets. It sucks, but WACOM never seems to remedy. Only solution I know is to disconnect the tablet.

  • Pencil of Apple: no problem with using on a shield by Zagg screen?

    Any who are having problems with the help of an invisibilityShield of Zagg on an iPad Pro? Wondering if the plastic reduced the fineness of the drawing or writing with a pencil to Apple? The pencils pen point "dig" or feel like it drags on the shield against the finesse of the iPad glass screen? Thank you.

    I don't have a pencil, but I do not have the protections zagg and I have not known any drag on my device. Now if you really press the pencil, well he can drag as a pen can slip on a pad of paper, but you shouldn't need to support on that is hard.

    Does the company have a day 30 policy on what it be sold on their site, so if you buy it and don't like you can return refund

  • My iPhone says 5 c searching for service and I know I service someone know what is the problem with my phone?

    I need help

    If you see no Service or search on your device, or cannot connect to a cellular network or cellular data, follow these steps:

    1. Restart your iPhone or iPad.
    2. Looking for a carrier settings update.
    3. Remove the SIM card and put it again. If the SIM card is damaged, or does not fit in the drawer of the SIM card, contact your carrier.
    4. Reset your network settings. Tap Settings > general > reset > reset network settings. This also resets the Wi - Fi networks and passwords, cell parameters and VPN and APN settings you used before.
    5. If you have another device, see if you can connect your business with her network to this place.
    6. Contact your operator for:
      • Make sure your account is active and in good and due form.
      • Make sure that there are no failures in your area.
      • Verify that your device is not blocked to receive cellular services and is set up with the right data plan.
    7. Update your iPhone or iPad to the latest version of iOS.

    If you still cannot connect to a cellular network and have confirmed with your carrier is not a problem with your account, or your network, try to restore your device.

    If you cannot connect to a cellular network or cellular data - Apple Support

  • HP laptop - 15-r150nm: problem with wifi after update realtek adapter

    Hello! I've updated some drivers of HP customer service and then restarted computer. When it is on I couldn't use wifi. When I select the problems, it says: 1) "" Realtek 802.11B/G/N WIFI adapter RTL8723BE has some problems to the program control or hardware. "" (it is Croatian, so I tried to translate it for you)

    (2) "a network cable is not plugged in correctly or may be broken.

    What should I do, I have only this laptop and internet wifi, write this work? Thank you!

    Hi @frane53nja,

    Welcome to the HP Forums!

    This is a wonderful place to find answers and advice!

    You have the best experience in the HP forum, I would like to draw your attention to the Guide of the HP Forums.

    Learn how to post and more

    I understand that your laptop works OK and after updating drivers on reboot HP customer service, you have lost your wireless network. When you run the Windows troubleshooting tool, you received a message that there was a problem with the NIC due to recent hardware or software changes.

    Here is a link to HP PC - troubleshooting wireless network and Internet (Windows 8) that should help you.

    Before you perform a restore, as shown in the above troubleshooting steps, you can try this option.

    Go to the nursery of the device

    Click the network tab to expand the list.

    Right-click on the wireless network adapter and select roll back driver.

    Repeat this process for all types of adapters listed.

    While on this screen please check this definition also.

    Right click on the wireless adapter and choose Properties.

    Click the power management tab.  If "allow the computer to turn off this device to save power" is checked, please remove and click OK. Repeat this operation for all types of adapters listed.

    Please let me know the results.

    Thank you for your participation in the Forums of HP! We want to help you as well as others who may encounter a similar problem as you. Please consider tagging the post in order to solve your problem as "accept as Solution" to help other members of the community!

    To show recognition for my efforts please click the Thumbs Up below.

  • HP Pavilion G4 1310AU: problem with power supply for laptop HP Pavilion G4 1310AU

    Hi This is my first thread in the toms hardware, I have problem with my laptop power supply. my laptop cannot turn on if I remove the battery and use the charger only, but if I use my cell phone battery can turn on without problem for my laptop to use the battery to turn on and after my laptop that works and I remove the battery my still laptop running with the charger plugged, and that I charge my phone when my battery<80% capacity="" e.g="" on="" 40%="" battery="" power="" my="" laptop="" underclocked="" processor="" speed="" to="" 800="" mhz="" from="" 2.5="" ghz,="" i="" have="" changed="" power="" management="" in="" windows="" setting="" and="" amd="" catalyst="" to="" running="" full="" speed="" when="" plugged="" in="" and="" charging="" but="" my="" laptop="" still="" underclocked.="" i="" have="" updated="" my="" bios="" with="" latest="" version="" but="" still="" underclocked.="" after="" 100%="" fully="" charged="" my="" laptop="" processor="" running="" in="" full="" speed="" at="" 2,5="" ghz...="" other="" that="" no="" issue="" in="" my="" laptop,="" everything="" running="">

    I'm never use my laptop for 3D games, most of use for the office, watch video, listen to music and navigation

    My computer laptop specifications
    AMD A4 3305M 1.9 Ghz Turbo up to 2.5 Ghz (TDP 35watts) (Dual Core)
    2 GB OF DDR3 RAM
    HARD DRIVE 500 GB
    DVD RW
    Bluetooth
    14 "monitor

    What is my charger underpower for power to my laptop? my charger is genuine HP with 65 Watt (18, 5V and 3, 5)
    should I buy charger 90 watt (19V and 4.74)?
    or my default charger? so, my charger not Power not in 65 Watt as a specification written in but less than 65 watts running?

    Thank you

    Sorry for my bad English

    Hi @Dana88 ,

    Please contact our technical support at 800-474-6836. If you do not live in the United States / Canada region, please click on the link below to get a number of assistance for your region.

    World wide phone holder

    I understand that if you remove your battery, you can't boot up your laptop.  This is not unusual. some laptops are set up in this way.

    I understand that when you have the phone connected and charge the batteries of your performance is lowered.  There is more than one draw powere when it loads to the battery.

    Here is a link to the laptops HP - test and calibrate the battery (Windows 7) to ensure that there is no problem with the battery.

    Could also remove the battery once you put under tension.

    You asked questions on the use of a 90-Watt adapter.  Here is a link to HP G4 Notebook PC Maintenance and Service of Guide.  Chapter 3 page 32 lists not one that is recommended.

    Good luck!

  • Problem with pointstyle custom

    Hello, I want to create a pointstyle customized for my plots scattergraph. I want to create a rectangel with a black border.

    I have read the following of section http://zone.ni.com/devzone/cda/tut/p/id/10526 and that it really helps.

    But there is a little problem with the black border. The following diagram shows this problem, that the border is only on the 2 sides of my rectangel.

    This is my code in my tiny class.

    class BorderPointStyle of Ref: NationalInstruments::UI:PointStyle
    {
    public:

    BorderPointStyle (void)
    {}

    public: virtual void Draw (Object ^ context, PointStyleDrawArgs ^ args) override
    {
    Graphics ^ g = args-> graphics;

    Rectangle rect_b = Rectangle (0,0,7,7);
    Rectangle rect_i = Rectangle (0,0,6,6);

    System::drawing:pen ^ pen = New System::Drawing:Pen (Color::Black);
    g-> FillRectangle (gcnew SolidBrush (args-> Color), rect_i); Draw the innerarea

    g-> DrawRectangle (pen, rect_b) ;// draw the border

    }
    };

    Maybe someone has a resolution of my problem

    Hello-

    Your points are currently limited by the PointSize property.  You can change your code as follows:

  • Problems with multiple worksheets XY plotting (program generates repeated data)

    Hello

    I want to make a small program that will reduce the amount of time to go forward with the measurement data. I get data into .dat format, where all the files consist of frequency measurement with an X and a Y column. The problem is that I made 4 experiments (X column is the same for each experience) with 15 measures file each and more than 500 points of measurement in each file. I would like to make a simple manipulation and this copy that information to a file with same X column and multi-column, later I could use these data with Excel or origin (do it manually, it's frustrating and time consuming).

    At the beginning my program reads the background information with X and Y (b), and after I open the worksheet to insert the X and data of Y (n). (make a simple manipulation, like dividing Y (n) /Y (b), program show a graph of the current data and another graph multiple data, which are stored and must be exported in .txt, .dat or directly to Excel (which is more preferable)). I'm OK with the opening of several files of data, but which are not okay with copy/paste file and handle all that data manually, but that's my motivation for this program.

    The attached example can do all this (except for the entry in the file). He draws multiple charts on a XY chart using cluster and travel records. It is even possible to extract data in Excel, all that graphic, but the real problems comes with data are always added because of the loop. This gives a lot of empty and repeated data later. I'm jonesing to get rid of this. I have also attached several files of measure: 1 background and 3 measures.

    P.S. I tried to save time thanks to this program, but now, I spent more time than if I did it manually

    Your program absolutely no sense. What is the purpose of the structure of sequence? It just sits there, operating both in parallel to the while loop. Probably that you read from the local variables before other parts of the program had a chance to write valid data for them.

    In the while loop, you have a case of timeout that adds the same data over and over again, every 50ms. Why?

    Your mechanical actions "switch release" are misguided. Use actions to latch and remove structures deal as part of the event.

    Try to rethink the problem once the mode, and then solve the problem with 20% of your current code. See how far you get.

Maybe you are looking for

  • I can't receive text messages only send it please help me

    I can't receive text messages on my iPhone 6s only send it please help me

  • MacPro with new El Capitan update does not start with two monitors

    Does anyone have a fix for this? I updated last night and now it seems to start both monitors in wide screen mode. I have to unplug a monitor and do a hard reboot to see my login screen. Any help would be appreciated. new MacPro (end of 2013), Yosemi

  • How to "clone" my new hard disc on a hard drive? __

    How I 'clone' my new hard disc on a hard drive?

  • Stucks upgrade window 10 to 99%

    After trying different methods... 1. using Get windows APP 10 - no sign download 2 Wizard upgrade Windows 10 - has taken so much time and stucks at 99% 3 reboot 4 to 5 times the force fully - error on black screen Still no upgrade has been done. It i

  • HP G62 turn not

    I have a HP G62 I've had for about 2 years. It started crashing not too long and has gotten to the point where about five minutes after that be turned on he would give me the blue screen with white rental and restart the computer. Now it won't even t