Home>
I am working on a program to draw a circle by inputting radius and color using 3 subclasses and 1 main class in Java.
The following problems cannot be solved by any means, and I am in trouble.
Thank you.
The error that is occurring
Main.java:14: error: illegal start of expression
public void setRadius(int sr)
^
Main.java:14: error: illegal start of expression
public void setRadius(int sr)
^
Main.java:14: error:';' expected
public void setRadius(int sr)
^
Main.java:14: error:';' expected
public void setRadius(int sr)
^
Main.java:19: error: illegal start of expression
public void setRGB(int c)
^
Main.java:19: error: illegal start of expression
public void setRGB(int c)
^
Main.java:19: error:';' expected
public void setRGB(int c)
^
Main.java:19: error:';' expected
public void setRGB(int c)
^
Main.java:24: error: illegal start of expression
public void setRadiusAndRGB(int sr, int c)
^
Main.java:24: error: illegal start of expression
public void setRadiusAndRGB(int sr, int c)
^
Main.java:24: error:';' expected
public void setRadiusAndRGB(int sr, int c)
^
Main.java:24: error:<identifier>expected
public void setRadiusAndRGB(int sr, int c)
^
Main.java:24: error: not a statement
public void setRadiusAndRGB(int sr, int c)
^
Main.java:24: error:';' expected
public void setRadiusAndRGB(int sr, int c)
^
Main.java:30: error: illegal start of expression
public void paintComponent(Graphics g)
^
Main.java:30: error: illegal start of expressionpublic void paintComponent(Graphics g)
^
Main.java:30: error:';' expected
public void paintComponent(Graphics g)
^
Main.java:30: error:';' expected
public void paintComponent(Graphics g)
^
18 errors
Main.java:14: error: illegal start of expression
public void setRadius(int sr)
^
Main.java:14: error: illegal start of expression
public void setRadius(int sr)
^
Main.java:14: error:';' expected
public void setRadius(int sr)
^
Main.java:14: error:';' expected
public void setRadius(int sr)
^
Main.java:19: error: illegal start of expression
public void serRGB(int c)
^
Main.java:19: error: illegal start of expression
public void serRGB(int c)
^
Main.java:19: error:';' expected
public void serRGB(int c)
^
Main.java:19: error:';' expected
public void serRGB(int c)
^
Main.java:24: error: illegal start of expression
public void serRadiusAndRGB(int sr, int c)
^
Main.java:24: error: illegal start of expression
public void serRadiusAndRGB(int sr, int c)
^
Main.java:24: error:';' expected
public void serRadiusAndRGB(int sr, int c)
^
Main.java:24: error:<identifier>expected
public void serRadiusAndRGB(int sr, int c)
^
Main.java:24: error: not a statement
public void serRadiusAndRGB(int sr, int c)
^
Main.java:24: error:';' expected
public void serRadiusAndRGB(int sr, int c)^
Main.java:30: error: illegal start of expression
public void paintComponent(Graphics g)
^
Main.java:30: error: illegal start of expression
public void paintComponent(Graphics g)
^
Main.java:30: error:';' expected
public void paintComponent(Graphics g)
^
Main.java:30: error:';' expected
public void paintComponent(Graphics g)
^
18 errors
Applicable source code
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
public class PanelCircle extends JPanel
{// class
private int radius;
private int rgb;
public PanelCircle()
{
public void setRadius(int sr)
{
radius = sr;
}
public void serRGB(int c)
{
rgb = c;
}
public void serRadiusAndRGB(int sr, int c)
{
radius = sr;
rgb = c;
}
public void paintComponent(Graphics g)
{
g.setColor(rgb);
g.fillOval(10,10,radius*2,radius*2);
}
}
} // end class
What I tried
I'm using it after copying it from the code I wrote before, but I get an error.
I've copied it many times and reviewed the previous code, but I'm not sure.
Please provide more detailed information here.
-
Answer # 1
Related articles
- [python] i don't understand the meaning of the error
- i'm getting a java compile error "no class, interface or enum", but i think the parentheses are supported
- [ruby] i don't understand the meaning of the error statement
- i don't understand the cause of the java nosuchelementexception error
- java - i can't understand the transition relationship of html files in spring boot
- i don't understand the java problem
- java - | = please tell me the meaning of
- java - i don't understand the method call inside the class type method
- [java] i can't understand the combination of for statement and if statement and how to use arrays
- java - the meaning of the argument view view
- java - web-app shows error in webxml
- java bigdecimal acceleration error when dividing by 0
- java - an error occurred when running with junit assertequals
- java - i want to eliminate the springboot error
- javascript - i don't understand the meaning of the question in the coding test
- java - i want to display the corresponding argument in the error message when the command argument is not an integer
- python i don't understand the meaning of * (asterisk) in the following cases
- java - i want to get a 404 error when entering a random url in spring boot
- java - an error occurs when executing the jar file
- c # - compile error when importing oculus integration in unity 20194
Trends
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
You cannot define a method directly inside a method.