On a canvas can not appear

I Tried to draw a simulation on my canvas canvas,but it could not appear only a blank screen. I only change "public class grafik extends java.applet.Applet" in to "class grafik extends java.awt.Canvas"
whats wrong with my code?

this is the code:
import java.awt.*;
class grafik extends java.awt.Canvas implements Runnable {
int wx,wy,yoff,xpts[],ypts[],nx;
double x0,xmin,xmax,dx,ymin,ymax,dy,xscale,yscale,tmin,t,dt;
double hbar,mass,epsilon,width,vx,vwidth,energy,energyScale;
complex Psi[],EtoV[],alpha,beta;
Thread kicker = null;
public void init() {
wx = size().width;
wy = size().height;
resize(wx,wy);
setBackground(Color.white);
nx = wx / 2;
yoff = 50;
wy -= yoff;
xpts = new int[nx];
ypts = new int[nx];
Psi = new complex[nx];
EtoV = new complex[nx];
energyScale = 1;
initPhysics();
public void initPhysics() {
x0 = -2;
xmin = -3;
xmax = 3;
dx = (xmax-xmin)/(nx-1);
xscale = (wx-0.5)/(xmax-xmin);
ymin = -1.5;
ymax = 1.5;
dy = (ymax-ymin)/(wy-1);
yscale = (wy-0.5)/(ymax-ymin);
tmin = 0;
t = tmin;
hbar = 1;
mass = 100;
width = 0.50;
vwidth = 0.25;
vx = 0.25;
dt = 0.8 * mass * dx * dx / hbar;
epsilon = hbar * dt /( mass * dx * dx );
alpha = new complex(0.5 * (1.0+Math.cos(epsilon/2))
, -0.5 * Math.sin(epsilon/2));
beta = new complex((Math.sin(epsilon/4))*Math.sin(epsilon/4)
, 0.5 * Math.sin(epsilon/2));
energy = 0.5 * mass * vx * vx ;
for(int x=0;x<nx;x++){
double r,xval;
xval = xmin + dx*x;
xpts[x] = (int)(xscale*(xval - xmin));
r = Math.exp(-((xval-x0)/width)*((xval-x0)/width));
Psi[x] = new complex(r*Math.cos(mass*vx*xval/hbar),
r*Math.sin(mass*vx*xval/hbar) );
r = v(xval)*dt/hbar;
EtoV[x] = new complex( Math.cos(r), -Math.sin(r) );
double v(double x) {
return
(Math.abs(x) < vwidth) ? ( energy* energyScale ) : 0 ;
public void paint(Graphics g) {
MakeGraph(g);
public void MakeGraph(Graphics g) {
int ix,iy;
int jx,jy;
//g.setColor(Color.black);
//g.drawRect(0,yoff,wx-1,wy-1);
g.setColor(Color.red);
ix = (int)(xscale*0.5*(xmax-xmin-2*vwidth));
jx = (int)(xscale*0.5*(xmax-xmin+2*vwidth));
iy = (int)(wy-1 - yscale*(0.5*ymax*energyScale - ymin));
jy = (int)(wy-1 - yscale*(0 - ymin));
g.drawLine(ix,yoff+iy,ix,yoff+jy);
g.drawLine(jx,yoff+iy,jx,yoff+jy);
g.drawLine(ix,yoff+iy,jx,yoff+iy);
g.setColor(Color.blue);
for(int x=0;x<nx;x++)
ypts[x] = yoff + (int)( wy-1 -
yscale* (Psi[x].re-ymin ) );
for (int x = 0 ; x < nx-1 ; x++ )
g.drawLine(xpts[x], ypts[x], xpts[x + 1], ypts[x+1]);
g.setColor(Color.black);
for(int x=0;x<nx;x++)
ypts[x] = yoff + (int)( wy-1 -
yscale* (Psi[x].re*Psi[x].re+Psi[x].im*Psi[x].im-ymin ) );
for (int x = 0 ; x < nx-1 ; x++ )
g.drawLine(xpts[x], ypts[x], xpts[x + 1], ypts[x+1]);
public void run() {
while ( kicker != null ){
step();step();step();
t += dt;
repaint();
try {
Thread.sleep(60);
} catch (InterruptedException e) {
break;
* Start the applet by forking an animation thread.
public void start() {
if (kicker == null) {
kicker = new Thread(this);
kicker.start();
* Stop the applet. The thread will exit because kicker is set to null.
public void stop() {
if (kicker != null) {
kicker.stop();
kicker = null;
public boolean mouseDown(java.awt.Event evt, int x, int y) {
requestFocus();
if( null != kicker ) stop();
else start();
return true;
public void step(){
complex x = new complex(0,0);
complex y = new complex(0,0);
complex w = new complex(0,0);
complex z = new complex(0,0);
for(int i=0;i<nx-1;i+=2){
x.set(Psi);
y.set(Psi[i+1]);
w.mult(alpha,x);
z.mult(beta,y);
Psi[i+0].add(w,z);
w.mult(alpha,y);
z.mult(beta,x);
Psi[i+1].add(w,z);
for(int i=1;i<nx-1;i+=2){
x.set(Psi[i]);
y.set(Psi[i+1]);
w.mult(alpha,x);
z.mult(beta,y);
Psi[i+0].add(w,z);
w.mult(alpha,y);
z.mult(beta,x);
Psi[i+1].add(w,z);
x.set(Psi[nx-1]);
y.set(Psi[0]);
w.mult(alpha,x);
z.mult(beta,y);
Psi[nx-1].add(w,z);
w.mult(alpha,y);
z.mult(beta,x);
Psi[0 ].add(w,z);
for(int i=0;i<nx;i++){
x.set(Psi[i]);
Psi[i].mult(x,EtoV[i]);
x.set(Psi[nx-1]);
y.set(Psi[0]);
w.mult(alpha,x);
z.mult(beta,y);
Psi[nx-1].add(w,z);
w.mult(alpha,y);
z.mult(beta,x);
Psi[0 ].add(w,z);
for(int i=1;i<nx-1;i+=2){
x.set(Psi[i]);
y.set(Psi[i+1]);
w.mult(alpha,x);
z.mult(beta,y);
Psi[i+0].add(w,z);
w.mult(alpha,y);
z.mult(beta,x);
Psi[i+1].add(w,z);
for(int i=0;i<nx-1;i+=2){
x.set(Psi[i]);
y.set(Psi[i+1]);
w.mult(alpha,x);
z.mult(beta,y);
Psi[i+0].add(w,z);
w.mult(alpha,y);
z.mult(beta,x);
Psi[i+1].add(w,z);
public double Norm() {
double sum = 0.0;
for(int x=0;x<nx;x++)
sum += Psi[x].re*Psi[x].re + Psi[x].im*Psi[x].im;
return sum;
class complex {
double re,im;
complex(double x,double y){
re = x;
im = y;
public void add(complex a,complex b){
re = a.re + b.re;
im = a.im + b.im;
public void mult(complex a,complex b){
re = a.re * b.re - a.im * b.im;
im = a.re * b.im + a.im * b.re;
public void set(complex a){
re = a.re;
im = a.im;

Similar Messages

  • I can not open timeline and the canvas can not display because out of memory.

    I can not open timeline and the canvas can not diplay. I get a pop up saying "error out of memory" what does it mean and what can I do?

    Usually this is because you've got graphics that are cmyk or grayscale not RGB, or that are larger than 4000 by 4000 pixels.   Move them on your hard disk so fcp can't find them and make them rgb and resize to an acceptable pixel dimension. 

  • TS1363 iPhone is visible as camera but can not appear in itune, when run dioganstic it shows that iPhone is not attached to the itune

    My iPhone 4 does not appear in source list of itune

    Hey jd1410,
    Thanks for the question. I understand you are having issues with your iPhone 4 not recognized in iTunes. The following article may help to resolve your issue:
    iOS: Device not recognized in iTunes for Windows
    http://support.apple.com/kb/TS1538
    Thanks,
    Matt M.

  • Add buddy does not appear on the list

    I have a grandson in Iraq. On occasion we get to iChat with him. Why doesn't his name come up on iChat AIM Buddy list when I "Add Buddy" shouldn't the added buddy appear on the list dimmed if offline? This is the only one I have had trouble with. He does appear on my Mac mini computer downstairs, but I for some reason cannot add him to the list on my iMac.

    Hi,
    I am not entirely sure I completely followed all of that.
    You can set two computers to have the same Screen Name and allow them to Log in to the AIM servers at the same time.
    The Bonjour Buddy List takes the name from the Address Book so you can not login in to both computers as Gregory Lazarchik as the Mac User on Both (If that is how your Name is in the Address Book).
    Going back to the AIM (Apple valid as well) Name. Once both computers are logged in with the Same Screen Name you can not appear in each others Buddy List (iChat does not allow you to Add yourself to the Buddy List)
    This used to be possible in iChat 2 and you could text chat to "yourself"
    AS I said before the other Issues are about the settings in iChat > Preferences > Accounts > Security about Allow and Block lists (At BOTH ends) that make people appear Off-line over AIM - Well that and Spelling of the Screen Name or adding them as @mac.com when they should be @me.com or an AIM name
    Using my name for example
    ralphjounsr
    [email protected] and
    [email protected] are three different Buddies
    As only one of those is correct you would see the others as Off-Line because the AIM Servers don't tell you if the name is a valid (in use) name.
    I am glad that you are sorted on this.
    12:37 PM Sunday; February 1, 2009

  • Hi, I've just downloaded the latest release 10.1.1 and now I do not see any more correctly my clips either in the canvas and in the timeline. Playing clips, they now appears with garbled images, completely unstables: I can not editing in these conditions!

    Hi, I've just downloaded the latest release 10.1.1 and now I do not see any more correctly my clips either in the canvas and in the timeline. Playing clips, they now appears with garbled images, completely unstables: I can not editing in these conditions!
    Anyone can help me?
    Thank you, Claudio

    Hi Russ, Thank you for your reply!
    System Spec:
    2x2.26 Ghz QUAD-CORE
    12 GB RAM 1066 MHz DDR3
    I've stored the library in HARD DISK which is installed inside my computer (1 TB capacity) and different from my hard disk in which I've installed all my applications (600 GB capacity).
    I've installed FCP since 2001, bought FCP X in 2012: never had a problem. Yesterday I was editing my video of my last vacations (in California!) and I have updated FCP X, downloading FCP X 10.1.1: then the problem!
    Strange is the fact that I've just tried to export a short project, I can see the final product quite well.
    What is impossible is playing the clips within Final Cut: they are jumpimg, moving, presenting some frame in green or red ...
    Everything all right in iMovie.
    I've just checked the RAM: 9GB out of 12 GB is busy, could this be the problem?
    Motion is very slow: for 20 sec of project, it takes minutes to play. And once again, if you finalize the projet and export it in Quicktime, you can see it correctly.
    I do hope you may suggest something, I'm getting crazy!
    Thank you in adavance
    Claudio

  • When I plug in my Ipod touch to my computer a warning appears "The program cant start because MSVCR80.dll is missing."  I can not access my Itunes library.  Also, an "error 7 Windows error 126" appears as well.  Any ideas?

    When I plug in my Ipod Touch to my computer I can not access my Itunes library.  The following message appears "The program cant start because MSVCR80.dll is missing."  Also, another message appears as well - "Error 7  Windows error 126" as well as APSDaemon.exe.
    I have NO IDEA what the heck to do.
    Any ideas?
    Thanks!

    Issues installing iTunes or QuickTime for Windows
    solving MSVCR80
    iTunes 11.1.4 for Windows: Unable to install or open
    Troubleshooting issues with iTunes for Windows updates

  • TS4002 I bought iPad and I can not access, A message appears asking me account and password when i return to the person who I purchased it from him, he told me that he forgot the account and password I want a solution to the problem, because in this way I

    I bought iPad and I can not access, A message appears asking me account and password when i return to the person who I purchased it from him, he told me that he forgot the account and password
    I want a solution to the problem, because in this way I will not benefit from the iPad

    There is no solution.  You have to provide the ID and password.  There is no way around it.  If the person you bought it from can't provide it, return it and get your money back.

  • Hi all, I upgraded my MBP to Lion , but on the screen where i need to type my password, click  on my photo and it does not appear the place for me to type my password and it stay stuck there. Can anyone solve this problem for me?

    Hi all, I upgraded my MBP to Lion , but on the screen where i need to type my password, click  on my photo and it does not appear the place for me to type my password and it stay stuck there. Can anyone solve this problem for me?

    Reboot the machine holding Command and r keys down, you'll boot into Lion Recovery Partition
    In there will be Disk Utility, use that to select your Lion OS X Partition and Repair Permissions.
    After that is done reboot the machine and see if you can log in.
    If not repeat the above steps to get into Lion Recovery, get online and reinstall Lion again, it will overwrite the installed version and hopefully after that it wil work.
    Reboot and try again.
    If not follow my steps to create a Snow Leopard Data Recovery drive, then option boot from it and grab a copy of your files off the machine.
    Then reinstall all your programs onto the external drive like setting up a new machine, then use Disk Utility to erase the entire internal boot drive (select the drive media on the far left, not the partiton slightly indented) format Option: GUID , 1 partition OS X Extended and then use Carbon Copy Cloner to clone the external to the newly formatted internal drive. Once that is finished reboot and disconnect the external drive.
    Once you go that, boot into Snow Leopard and update to 10.6.8, use the AppStore and option click on Purchases and download Lion again and install.
    Lots of work, but there is no Lion disks.
    https://discussions.apple.com/message/16276201#16276201

  • In new iPad 4g, when sim card is not inserted, I can not find the enable 4g tap in the setting-cellular data tap, can some one please tell me if this is normal and if so, then when it appears, thanks

    In new iPad 4g, when sim card is not inserted, I can not find the enable 4g tap in the setting-cellular data tap, can some one please tell me if this is normal and if so, then when it appears, thanks

    If the SIM is out of your phone, find my phone needs a data connection, so could use wifi - IF in range of a wifi and one that it can join (ie. a known network or one that is wholly open so no login required).  Your phone could also simple be turned off, so not findable, or it may have been restored (plugged into iTunes and restored as new) again, making it permanently unfindable.  Honestly, for someone stealing an iPhone, this is likely the first thing they do - restore as new and it is theirs forever.
    Find my iPhone is tied to the users iCloud account - the find function is part of the iCloud account's services and it communicates with the iCloud servers over a data connection - either wifi or 3G.
    Have you set up your iCloud account on your replacement phone, and is it working properly on that phone?

  • Can not view pictures, yet still appear to all be in my I pad?

    Can not see pictures yet they still all appear to be on the I pad?

    If you are using the PHOTO app for viewing, try double-tapping the home button and killing the Photo app by holding the icon until the minus sign appears, then touch the minus sign.
    Then, hold the home and power buttons for 10 seconds, until the Apple appears, then allow a restart.
    Now retest the Photo app for your photos to be displayed.

  • When I plug in iPhone (5.1.1) to computer, playlists show up on the iPhone (when plugged in), that do not appear when it is not plugged in. And I can't erase them. I have iTunes match, and deleted all my music on the iPhone, but that had no effect.

    When I plug in iPhone (5.1.1) to computer, playlists show up on the iPhone (when plugged in), that do not appear when it is not plugged in. And I can't erase them. I have iTunes match, and deleted all my music on the iPhone, but that had no effect on the phantom playlist that shows up on the PC when I plug in the iPhone to the PC. I cannot manually move songs or playlists from the PC to the iPhone
    Help greatly appreciated.

    Unplug your Iphone out of your computer and replug it back in. It took me several times before I could do this

  • I have an iPhone 3gs and it used to show up on my computer, but now it shows up on my screen that it is charging however, does not appear in iTunes or My Computer so i can't sync it. Can anybody help? Thanks

    I have an iPhone 3gs and it used to show up on my computer, but now it shows up on my screen that it is charging however, does not appear in iTunes or My Computer so i can't sync it. Can anybody help? Thanks.

    Did you already make sure that Apple Mobile Device Service is installed and active on your computer?
    http://support.apple.com/kb/TS1567
    More troubleshooting about your device not recognized in Windows can be found here: http://support.apple.com/kb/TS1495

  • Iomega UltraMax 4Q PLUS the following message appears: The operation can not be completed because the item "FILE NAME" is in use. "

    Help, I need to solve. No speculation please bomas or attempts to restart, confirm that the HD is formatted for MAC and etc. .....
    Whenever I try to copy my files from my HDD Western Digital 2T for my new Iomega UltraMax 4Q PLUS the following message appears: The operation can not be completed because the item "FILE NAME" is in use. "
    I can not stand it anymore ...
    I need to work and not temnho more space on my machine.
    Scenario - iMac11, 10.6.8 + WD + 2 + 2T 4T Iomega UltraMax Plus, formatted for both Mac and connected via Firewire 800
    Trying to copy the message aborts the copy - "The operation can not be completed because the item" FILE NAME "is in use."

    Hello,
    As I said earlier, properly formatted for Mac.
    Mac OS Extended (Journaled)
    This HD is formatted for MAC factory, but I even did a few times in my attempts I can say that this is entirely correct formattingwith it - Mac OS Extended (Journaled)

  • I have a problem with my apple tv, I can watch my music of my mac in the TV but I cant transmit  music or video from my mac to my apple tv because not appear the logo Apple Tv in my itunes.  Somebody help me?

    I have a problem with my apple tv, I can watch my music of my mac in the TV but I cant
    transmit  music or video from my mac to my apple tv because not appear the logo
    Apple Tv in my itunes.  Somebody help me?

    Welcome to the Apple Community.
    The Apple TV 2 doesn't show up under devices like the Apple TV 1, to send video and music to the Apple TV you need to use the Airplay Option which appears in the lower right corner of iTunes.

  • I can not sync my iPhone to the computer. I keep getting up an error message that synchronization does not want to start. I have uninstalled iTunes and then reinstall it. But the same warning box will appear. How can I get my phone in sync again?

    Can someone please help me get my iPhone to sync to your computer?
    I can not sync my iPhone to the computer. I keep getting up an error message that synchronization does not want to start. I have uninstalled iTunes and then reinstall it. But the same warning box will appear. How can I get my phone in sync again?

    Hello lenmin,
    Thanks for using Apple Support Communities.
    To help resolve this issue where you're repeatedly prompted to authorize with your Apple ID in iTunes when syncing, please follow the directions in the article below.
    iTunes: Missing folder or incorrect permissions may prevent authorization - Apple Support
    Have a great weekend,
    Alex H.

Maybe you are looking for

  • I upgraded to 3.2, but now spreadsheets that I create in 3.2 will not reopen. I need a newer version???

    I have faithfully updated my Numbers program. 3.2 is the latest version and it is loaded on my mac. However, when I create a spreadsheet in 3.2 and save it, when I go to reopen the spreadsheet Mac tells me I need a newer version of Numbers? What give

  • Field Profit Center is not populated while posting through T-Code F-02

    Dear Sir / Madam, While posting through T-code F-02 the field Profit center is in hidden mode as a result I am getting the given below error. "GLT2201 - Balancing field profit center in line item 001 not filled" Please guide me as to how do I change

  • Custom theme

    I created an custom theme using TinyLaF 1.2 tool, when I save that theme it is saved with .theme extension. Can any one help me how can I use this theme in my java application.

  • Questions from a new Aperture user

    Two questions: When I imported my old photos, I gave them the version name "Old Photos". Now any project I create, the photos I add to it also are automatically given the version name "Old Photos". While I can change this on a photo by photo basis (w

  • Is there a way to remove a image?

    hi is there a way to remove a image that is created and append to the form in J2me.? thanks