Cannot find correct syntax for paint()

Hi everyone,
I am supposed to create an applet that has a textfield component and a button comp. the user is prompted to type in a drawing command press the "go" button and the program executes. here is an exampls of what the text should read like..FD 50, turn SW, BK 50, colour red.
The FD is forward draw and the BK is backward. my problem is I am not using the correct syntax conventions when creating xnew and ynew coordinates. this might not be the best algorithm either, but with limited examples and resources it was the best I could come up with, any other suggestions would be much appreciated.
Here is the problem code.
public void init()
               extraPanel.setBackground (Color.blue);
               extraPanel.setLayout(new FlowLayout());//resizable panel
               extraPanel.setBackground(Color.red);
               extraPanel.add(button); button.addActionListener(this);
               extraPanel.add(Mylabel);
               Mylabel.setBackground(Color.white);
               extraPanel.add(tf);
               tf.setBackground(Color.green);
               add(extraPanel);
                //create a method to use the cursor to draw
                public void paint(Graphics page)
                   //declare the coordinates and variables
                   int x;
                   int y;
                   int xcurrent;
                   int ycurrent;
                   int xnew;
                   int ynew;
                   String turn;
                   boolean FD;
                   String sData = new String();
                   //create an array object of commands
                   //create a bufferedReader to read in data
                   BufferedReader stdin = new BufferedReader(new
                                          InputStreamReader(System.in));
                   //create an object of commands[]and set its size
                   comm = new Commands[20];                      
                   //create a String Tokenizer to read the data in from the tf
                   StringTokenizer tok = new StringTokenizer(sData, ",");
                   //read the data in
                   for(int i = 0; i < comm.length; i++)
                      sData = stdin.readLine();
                      comm[i] = new Commands(tok.nextToken(),Integer.parseInt(tok.nextToken()),
                                tok.nextToken(),Integer.parseInt(tok.nextToken()));
                      //use x and y coordinates to draw the image
                      xnew =  new (Commands(turn.x)* FD * dist + xcurrent + colour);
                      ynew =  new (Commands(turn.y)* FD * dist + ycurrent + colour);
                      repaint(xnew + ynew);
                      //set the focus on the new lines
                      xcurrent = xnew;
                      ycurrent = ynew;
}//end of logo class                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe I'm being dense but I don't see a question in here anywhere. Unless it the xnew ynew thing. You can't use new to create an int, an Integer object yes, but not int so get rid of the "new"s. Next look at the methods in http://java.sun.com/products/jdk/1.2/docs/api/java/awt/Graphics.html
And get rid of all of that BufferedReader stuff.
you applet should have something like:
TextField commands = new TextField("",20);
Button btn = new Button("Draw It");
String cmds = null;
// add the button and text field to the applet
// add an action listener for the button
// in the ActionPerformed method do somthing like
cmds = commands.getText();
repaint();
// in the paint method parse the cmds string and do the drawing via the Graphics class's methods
That you give a good idea of where to go now.

Similar Messages

  • Satellite L500-1XD - cannot find an update for PC health monitor

    This TBS advises updates to PC health monitor and HDD/SDD alert.
    HDD/SDD alert has a published update in the relevant downloads section but I cannot find an update for PC health monitor.
    Any one got any bright ideas ?
    Otherwise this seems quite a balanced system.

    Hi Paolo30,
    Thanks for your contribution. I agree with your model designation
    I would like to download ver 1.5.6.0 but it does not seem to be listed on the download list (Two and a quarter pages long) for the L500-1XD on the Toshiba-Europe website. I am using I.E.8
    Where are you seeing this listed ? Could you give me a URL please ?
    It is an important update as it resolves a conflict between video streaming from HD and SMART HD messages as described in the TSB.
    The only upgrade that is tagged as 1.5.6.0 is the Bullitin Board and this does not sound like the correct type of application. There was obviously a major update on 21/6/2010 there are 30 odd updates with that date.
    Kindest Regards

  • Cannot find terminfo entry for 'rxvt-256color'.

    I'm sshing into my ubuntu server from my arch workstation. I can't run screen because i get this error:
    Cannot find terminfo entry for 'rxvt-256color'.
    Anyone know whats going on?
    It works if i run "export TERM=xterm" or "export TERM=rxvt" but:
    1. that seems like a hack
    2. i have to type that everytime i ssh and run screen
    any help would be great!

    Mr.Elendig wrote:And when it comes to screen, use TERM=screen-256color  (you can make screen set that automaticly by poking at your screenrc)
    Yep, you can put 'term screen-256color' in screenrc. Not that this is set inside screen, in the outside you use the default TERM (rxvt-256color) so dont set then in bashrc or zshrc (or set with a check for TERM==screen). So you have two terminfo description one of the underlining terminal (rxvt) its used by screen to construct the needed interaction, and the screen terminfo used by all program running inside screen to know what caps the terminal have and correct interact with it.
    EDIT probably you want to use screen-256color-bce because rxvt-256color support bce so screen can use it, but well, I dont know for what bce can be useful....
    Last edited by kazuo (2010-06-14 14:03:46)

  • [SOLVED] internal error Cannot find suitable emulator for x86_64

    Hi,
    After a reboot due to unrelated issues, virt-manager is not showing any of the VMs I had configured via qemu:
    I checked connection properties, and everything else is showing up correctly, like the networks and storage. I tried to create new VMs out of existing storage and got this message:
    Googling it suggested this happens when KVM module is not loaded. I modprobed kvm, kvm_intel and still got same result.
    Systemd gave me the following:
    % systemctl status libvirtd
    libvirtd.service - Virtualization daemon
    Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled)
    Active: active (running) since Sat 2013-06-08 08:55:19 IST; 29min ago
    Main PID: 1499 (libvirtd)
    CGroup: name=systemd:/system/libvirtd.service
    ├─ 834 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf
    ├─ 863 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/nat_static.conf
    ├─ 881 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/closed_dhcp.conf
    └─1499 /usr/bin/libvirtd -p /var/run/libvirtd.pid
    Jun 08 09:07:48 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:07:48 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:07:48 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:07:48 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:07:48 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:07:48 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:08:20 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:08:20 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:08:35 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Jun 08 09:08:35 core libvirtd[1499]: internal error Cannot find suitable emulator for x86_64
    Googling that seems to indicate that this happens when virtualization is disabled by BIOS. But cpuinfo tells me that vm is supported:
    % grep vmx /proc/cpuinfo | uniq -c
    8 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid
    Can anyone help me? Has anyone else faced a similar problem?
    Here are some version info:
    local/libvirt 1.0.6-1
    API for controlling virtualization engines (openvz,kvm,qemu,virtualbox,xen,etc)
    local/qemu 1.4.2-1
    A generic and open source processor emulator which achieves a good emulation speed by using dynamic translation.
    Of which, qemu got updated just today. I will try rolling back to older version and post and update.
    Ninja edit: Looks to be qemu. Just running qemu gives me this error:
    % qemu-system-x86_64
    qemu-system-x86_64: error while loading shared libraries: libiscsi.so.1: cannot open shared object file: No such file or directory
    EDIT: The resolution was
    pacman -S libiscsi libaio
    systemctl restart libvirtd
    EDIT2: Made subject line better searchable
    Last edited by railmaniac (2013-06-08 04:19:24)

    HI,
    First of all thanks a lot for this post. I am facing the same issue since yest.
    After reboot, my VMs gone missing and even virt-manager was not working (as shown in the screenshots which you have pasted in your post).
    Now after trying out the workout which you had mentioned, I am able to get the virt-manager working.
    But I am not sure if I can get back my missing VMs .
    I am new to linux. Kindly guide me on how I can get back those VMs.
    [root@skoduri lib64]# ls /etc/libvirt/qemu/
    networks  rhel6-vm2.xml  rhel6.xml
    [root@skoduri lib64]#
    [root@skoduri lib64]# ls /etc/libvirt/storage/
    autostart  default.xml  storage_1.xml
    [root@skoduri lib64]#
    [root@skoduri lib64]#
    Thanks,
    Soumya

  • Cannot find real path for '/var/install/Client/DATA_UNITS/HDB_CLIENT_LINUX_X86_64/../install/sdbrun': No such file or directory

    Hi Experts,
    I got the error "cannot find real path for '/var/install/Client/DATA_UNITS/HDB_CLIENT_LINUX_X86_64/../install/sdbrun': No such file or directory" and "Error during execution of HdbCmdClazz section!" during SAP NW 740 HANA installation. I specified the right path for HDB client (see in attachment).
    Any ideas, please?
    Thanks & best regards,
    Sreenu

    The service file is in $srcdir, not $_svnmod/builders/cmake.
    You're using an outdated PKGBUILD template too. The svn source should be included in the source array and not checked out manually during the build process.
    EDIT: since this repository requires authentication, perhaps the correct format won't work.
    Last edited by WorMzy (2015-02-08 23:07:59)

  • Concurrent Manager cannot find error description for CONC-System Node

    Hi friends,
    I m facing a problem while doing clustering for oracle EBS.i m using hpux11i with veritas cluster server for oracle DataBase cluster.i am doing 2 node cluster.i have installed oracle 11i apps with 9i DB.thru veritas i am able to do a db cluster failover.now i want to run oracle apps 11i too from both nodes(active/passive).so i configured a virtual IP address with a Virtual Hostname which will move along with the cluster failover.when i configure ora apps tier thru giving it virtual hostname concurrent manager dies with error--Concurrent Manager cannot find error description for CONC-System Node. i tried many things but unable to come up with a solution. pls help.
    regs
    Satish

    Please post the contents of your hosts file here.
    Is FND_NODES table populated correctly? Please run AutoConfig and make sure it completes successfully.
    Why are the Concurrent Managers Failing with 'CONC-System Node Name not Registered" Error After Applying Patch 6461517? [ID 1108452.1]
    OPP and SFM Managers do not Start [ID 1425409.1]
    Thanks,
    Hussein

  • Safari and firefox 'cannot find the server' for every other page that i navigate to, unless I turn Wifi off and on. How do I fix this?

    Safari and firefox 'cannot find the server' for every other page that i navigate to, unless I turn Wifi off and on. Once i reconnect to the network, the page loads, but after loading a few more pages, the same thing happens all over again.
    This happens each and every time, on different Wifi networks, in different locations.  On the other hand, I don't ever encounter this problem when I tether my laptop to my mobile phone's 3g/2g network using Personal Hotspot. How do I fix this?

    Try this DNS server ...
    Open System Preferences > Network > Advanced > DNS
    Click + and type:
    208.67.222.222
    Click + again and do the same.
    208.67.220.220
    Click OK.
    Quit and relaunch both your browsers to test.
    If that doesn't help, try here >  iOS: Troubleshooting Wi-Fi networks and connections
    And here >  Wi-Fi: How to troubleshoot Wi-Fi connectivity

  • I cannot find the icon for office:mac 08 word on my doc, where did it go?

    I cannot find the icon for Office: mac 08 word on my doc. I downloaded the whole Office: mac 2008 Home & Student Edition about a year ago and just recently the word icon disappeared. The other Office icons are still visible and i am able to use them but i cannot find the word application anywhere.

    Have you used spotlight search? Typed "word" and the application doesn't appear? If it doesn't then it probably isn't around anymore.... so hit command + space ... and type "word"... what happens?

  • Cannot find PDL type for output device LOCL in J1INCRT

    Dear all
    I am getting error in PRD system. When I am running J1INCRT (Customizing for Certificate Printing)  the error
    cannot find PDL type for output device LOCL
    we are using ECC6 ,oracle 10g  and windows 2003
    Kernel release    701
    Please suggest how to solve 
    Regards,
    Kumar

    Hello
    It looks like that you had not installed the ADS(Adobe Document server) for the PDF type reports. Please check with your basis team if you want to configure ADS.
    If you need the output as a sapscript then please do the sollowing steps:
    (1) Execute transaction SM30
    (2) Enter 'Table/View' as V_T5F99OCFT
    (3) Select 'Maintain' option.
    (4) Select 'New Entries' option from the Application Too
    (5) Enter following entries:
         Logical Form Name    = HR_IN_EPF12A_99M
         Form Variant         = (Leave this field blank)
         End Date             = 31.12.9999
         Start Date           = 01.01.1990
         Form Type            = SAP Script (SSC)
         Def. Type            = (This field should be checke
         PDF Form Name        = HR_IN_EPF12A_99M
         SAP Script Form Name = HR_IN_EPF12A_99M
         Smart Form Name      = (Leave this field blank)
    (6) Save the entries
    The above example I have given you is only for the form 12A.
    You have to make entries for all the reports sapscript in this table.
    Please goto SE71 -> F4 -> Payroll -> Payroll India here you will find
    all the sapscripts you require.
    Regards
    Ramana

  • I cannot find my receipt for my ipod how can i prove it isnt a year old

    I cannot find my receipt for my ipod and its under a year old how can i prove this

    Hi cantfindanything,
    I am gathering you are trying to get an iPod repaired by Apple.
    In the US for iPod Touch Generation 5:
    Every iPod comes with a one-year limited warranty and 90 days of complimentary telephone technical support.
    If you are trying to get a replacement or repair job, Apple will just need your Serial Number, found on either the back of your iPod Touch or in: Settings, General, About, Serial Number.
    When Apple receives this number, their database will be able to show up your information including device purchase and activation.
    To get a repair job/replacement, it is best to talk to Apple on the phone or go to your nearest Apple store to find out possible resolutions.
    To contact Apple call:
    1-800-MY-APPLE
    You can also take the iPod into your closest Apple Store and give them your serial number and they will be able to help you: http://www.apple.com/retail/storelist/
    Many Thanks for your question and Happy New Year!
    iBenjamin Crowley

  • Cannot find a report for SQL Server monitoring

    We installed a SCOM 2012 environment recently and imported the SQL Server Management packs successfully. SQL Servers are being monitored. 
    However, in the reporting section, i cannot find a group for SQL Server Reporting. All other show up ( Active Directory, Appication Monitoring, Web monitoring, etc) Just none for the SQL Reporting.
    Please help

    Hi,
    I assume that you miss some SQL management packs, would you please re-download the management pack here and import it:
    https://www.microsoft.com/en-hk/download/details.aspx?id=10631
    After successful importing, you should see it under reporting workspace:
    If you still cannot see it, please check operation manager event logs for more information to help to troubleshoot this issue.
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Cannot find PDL type for output device '(Printer name)'

    Hi,
    After seeing the statutory reports (PF, ESI etc) in standard format, we try to print form. We get the below error:
    Cannot find PDL type for output device '(Printer name)'
    Message no. FPRUNX113
    Diagnosis
    No PDL type has been found for the specified output device.
    System Response
    Error message
    Procedure
    Contact your system administrator.
    Procedure for System Administration
    For more information, see SAP Note 685571.
    Any input will be off great help...
    Regards
    Pooja

    Hello
    It looks like that you had not installed the ADS(Adobe Document server) for the PDF type reports. Please check with your basis team if you want to configure ADS.
    If you need the output as a sapscript then please do the sollowing steps:
    (1) Execute transaction SM30
    (2) Enter 'Table/View' as V_T5F99OCFT
    (3) Select 'Maintain' option.
    (4) Select 'New Entries' option from the Application Too
    (5) Enter following entries:
         Logical Form Name    = HR_IN_EPF12A_99M
         Form Variant         = (Leave this field blank)
         End Date             = 31.12.9999
         Start Date           = 01.01.1990
         Form Type            = SAP Script (SSC)
         Def. Type            = (This field should be checke
         PDF Form Name        = HR_IN_EPF12A_99M
         SAP Script Form Name = HR_IN_EPF12A_99M
         Smart Form Name      = (Leave this field blank)
    (6) Save the entries
    The above example I have given you is only for the form 12A.
    You have to make entries for all the reports sapscript in this table.
    Please goto SE71 -> F4 -> Payroll -> Payroll India here you will find
    all the sapscripts you require.
    Regards
    Ramana

  • Cannot find the classfile for javax.mail.internet.AddressException

    Hi,
    Scenario is SAPCRM 7.0/ECC.
    We are trying to extend the EmailAction class.
    The error bieng faced is
    Cannot find the classfile for javax.mail.internet.AddressException.
    We have added crm/isa/lwc to the used Dcs but still this error is there.
    Mail.jar is also present in the system.
    We are not able to make out what exactly the issue is.
    Please help.
    Thanks,
    Rohit

    Hi Rohit,
    Did you ever find the solution to this problem?  We're encountering the same error message.
    Thanks!
    Joe

  • Q30: Cannot find sales order for a committed stock item

    I have a few item numbers which show committed stock in item master data/stock but I cannot find an open sales order or even with an open line on a closed sales order. I have tried various query reports without success.
    Does anyone have a key to unlock this problem?
    Thanks,
    Robin

    Hi,
    Sorry but I am pretty new to SAP and on a learning curve so no idea what note 999124 is or even where/how I would use it.
    Can you explain further please?
    Robin
    Lakshmipathi     
    Posts: 17,513
    Registered: 8/9/07
    Forum Points: 34,462 
    Solved problem (10)
    Very helpful answer (6)
    Helpful answer (2)
       Re: Q30: Cannot find sales order for a committed stock item  
    Posted: Jan 12, 2011 3:18 PM    in response to: Robin Bellion           Reply 
    Check Note 999124 - Incorrect committed\On order quantity when changing orders
    thanks
    G. Lakshmipathi

  • I have to unistall my adobe cs5 [s/n removed by moderator], and a trial for Photoshop cc and I cannot find the download for those. Can you help me?

    I have to unistall my adobe cs5 serial number [], and a trial for Photoshop cc and I cannot find the download for those. Can you help me?

    CS5 product downloads are available thru the following page:
    CS5 - http://helpx.adobe.com/creative-suite/kb/cs5-product-downloads.html
    Photoshop CC trial download is available thru its product page:
    Download Photoshop CC by joining Creative Cloud today | Adobe Photoshop CC

Maybe you are looking for