answersLogoWhite

0

Is this code right for JAVA?

User Avatar

Pandavenger

Lvl 1
16y ago
Updated: 8/17/2019

import java.awt.*;
import java.Applet;
import java.awt.Event.*;

public class CircleDrawer extends Applet implements ActionListener
{
Button goButton;
Button resetButton;
TextField radiusField;
TextField xposField;
TextField yposField;

public void init()
{
goButton = new Button("Generate!");
resetButton = new Button("Reset");
radiusField = new TextField("5",3);
xposField = new TextField("0",2);
xposField = new TextField("0",2);

goButton.addActionListener(this);
resetButton.addActionListener(this);
setBackground(Color.black);
}

public void paint(Graphics g)
{
g.setColor(Color.lime);
g.drawLine(0,128,256,128);
g.drawLine(128,64,128,256);
g.drawArc(xposField.getInt()+128,yposField.getInt()+128,radiusField.getInt()*2,radiusField.getInt()*2,0,360);
g.drawString("Radius:",0,48);
add(radiusField);
g.drawString("X:");
add(xposField);
g.drawString("Y:");
add(yposField);
add(goButton);
add(resetButton);
}

public void actionPreformed(ActionEvent evt)
{
if (evt.getSource() == goButton)
{
repaint();
}
}
}

This is the code

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

How do you do this java code?

You have to specify the task that you wish me to help you with the Java code.


What does the Java compiler translate Java source code to?

The Java compiler translates Java source code to Java byte code.


Is there a no right click code that isn't java script?

Maybe with VB-script, if the browser is Internet Explorer.


What is a simple java code and explain what the code does?

int a;This simple Java statement declares an integer.


In the first step of the Java hybrid compilation process Java program code is converted into an intermediate format called .?

Java byte code.


What kind of file contain java source code?

'.java' files contain java source code. One can access these files on windows by using 'notepad'.


Difference between a java complier and the Java JIT?

A java compiler takes Java source code and turns it into Java bytecode, which can then be run by the java virtual machine.Using JIT means that the java code will be compiled and executed at the time that you run the program, which will slow down the program because it has to compile the code at the same time that it runs.


How can add java code to java server page?

Scriplet.


Java code for tax deduction in database connection?

Java code for tax deduction in database connection?


How is java byte code is different from other low level language?

Java byte-code is the code which generate after the compilation of .java file.And this code is only understand by JVM(java virtual machine ) which understand it and execute it.In other languages this type of functionality is not available.


What is Java byte-code level language?

Java byte-code is the code which generate after the compilation of .java file.And this code is only understand by JVM(java virtual machine ) which understand it and execute it.In other languages this type of functionality is not available.


How is decoupling achieved in Java programs?

Decoupling is achieved in Java programs through the parser code. To debug the decoupling achieved in Java, run the source code over the parser code first.

Trending Questions
What is the difference between sterile water and bacterial static water? Does gabapentin cause kidney stones? Is cl of 2ne1's real name park bom? What are three other flowering plants? What special considerations do I need to take when shopping for motorcycle insurance versus auto insurance? How can removable wood joints be utilized in furniture design to enhance functionality and ease of assembly? What is the penalty for scratching the cue ball in pool according to the scratch rule? What are the advantages and disadvantages of using smooth tires for a mountain bike? How many diagonals per vertex does an octagonal prism have? What is the role of support beams in ensuring the structural integrity of a building? Where can you buy a wizard 101 gift card? If a person tries out for the Navy Seals but doesn't make it are they still in the Navy? Can someone knit the hat from the Lovely Bones Movie 2009? Choose the correct answer.What causes blood to flow through the heart? Where could one get a no fax payday cash advance? Metachromatic leukodystrophy Katie is almost 5 and had this sense age 2 the other night her pluse ox drooped to 70 and heart rate to 40 is her time getting near? Who was the pragmatic philosopher and author of a major textbook for the emerging discipline of psychology? Who was the relative in the crucible related to judge hathorne? What situation represents the lowest entropy of a deck of playing cards? How do you write four and two hundred thirty-two thousandths in standard form and in expanded form?