There and error in this code
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class ClickMe extends Applet implements MouseListener {
private Spot spot = null;
private static final int RADIUS = 7;
public void init() {
addMouseListener(this);
public void paint(Graphics g) {
//draw a black border and a white background
g.setColor(Color.white);
g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
g.setColor(Color.black);
g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
//draw the spot
g.setColor(Color.red);
if (spot != null) {
g.fillOval(spot.x - RADIUS, spot.y - RADIUS, RADIUS * 2, RADIUS * 2);
public void mousePressed(MouseEvent event) {
if (spot == null) {
spot = new Spot(RADIUS);
spot.x = event.getX();
spot.y = event.getY();
repaint();
public void mouseClicked(MouseEvent event) {}
public void mouseReleased(MouseEvent event) {}
public void mouseEntered(MouseEvent event) {}
public void mouseExited(MouseEvent event) {}
When I compile the the code I get a "cannot resolve symbol"
private Spot spot = null;
spot = new Spot(RADIUS);
I'm new to programming and I don't know if these are errors in the code
The compiler doesn't know what "Spot" is. It isn't in any of the packages you imported (java.awt.*, etc), so I'm assuming it's another class you wrote. At compile time, the compiler must be able to find that class, so it's looking for a file named Spot.class in your CLASSPATH. I think you just have a simple classpath problem that all beginners run into. If you don't have a Spot class, then it's a different problem. Maybe you meant to declare the "spot" variable as a different thing?
Similar Messages
-
Is there a error with this code
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class ClickMe extends Applet implements MouseListener {
private Spot spot = null;
private static final int RADIUS = 7;
public void init() {
addMouseListener(this);
public void paint(Graphics g) {
//draw a black border and a white background
g.setColor(Color.white);
g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
g.setColor(Color.black);
g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
//draw the spot
g.setColor(Color.red);
if (spot != null) {
g.fillOval(spot.x - RADIUS, spot.y - RADIUS, RADIUS * 2, RADIUS * 2);
public void mousePressed(MouseEvent event) {
if (spot == null) {
spot = new Spot(RADIUS);
spot.x = event.getX();
spot.y = event.getY();
repaint();
public void mouseClicked(MouseEvent event) {}
public void mouseReleased(MouseEvent event) {}
public void mouseEntered(MouseEvent event) {}
public void mouseExited(MouseEvent event) {}
When I compile the the code I get a "cannot resolve symbol"
private Spot spot = null;
spot = new Spot(RADIUS);
I don't know if these are errors in the code'cannot resolve symbol' errors usually mean a problem with the declarations and initialisations at the start of your class. This is specifically to do with your line private Spot spot = null;
i haven`t much time to look at your code, but i would suggest getting rid of the null initialisation here, and do you ever actually change this value? after a quick look it seems that you only query it to see if the variable spot is null. if you never affect this value, then it will always be null and only one if statement will ever be executed.
but as i said i haven`t any time, so could be off here
boutye - boss is coming bak argh! -
When I try to update my apps on my MacBook Pro, Ipad, and Ipod it wont allow me. On the computer it says theres and error. (11111) But on the Ipod and Ipad it starts to update and completely stops. What should I do?
Maybe this.
Fix iPhone Apps Stuck "Waiting" During Installation
Try update the apps one at a time -
HELLO EVERY ONE ...
I AM GETTING run time error in this code.....can u send me the corrected code....
START-OF-SELECTION.
SELECT T1~MATNR
T1~MEINS
T1~ERSDA
T1~ERNAM
T1~SPART
T2~MAKTX
T3~LVORM
T3~EKGRP
T3~WERKS
T4~LABST
T4~SPEME
T4~LGORT
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM MARA AS T1
INNER JOIN MAKT AS T2
ON T1MATNR = T2MATNR
INNER JOIN MARC AS T3
ON T2MATNR = T3NFMAT
INNER JOIN MARD AS T4
ON T3MATNR = T4MATNR
WHERE T1~MATNR IN SMATNR.
Thanx & Regards,
PHANINDERok i am sending u the full code.....
REPORT Z_SB_RP_MATERIAL.
TABLES: MARA,
MARD,
MAKT,
MARC,
EINA,
EINE.
DATA: BEGIN OF ITAB OCCURS 15,
MATNR LIKE MARA-MATNR,
MEINS LIKE MARA-MEINS,
ERSDA LIKE MARA-ERSDA,
ERNAM LIKE MARA-ERNAM,
SPART LIKE MARA-SPART,
MAKTX LIKE MAKT-MAKTX,
LVORM LIKE MARC-LVORM,
EKGRP LIKE MARC-EKGRP,
WERKS LIKE MARC-WERKS,
LABST LIKE MARD-LABST,
SPEME LIKE MARD-SPEME,
LGORT LIKE MARD-SPEME,
END OF ITAB.
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-T01.
SELECT-OPTIONS: SMATNR FOR MARA-MATNR,
SERSDA FOR MARA-ERSDA,
SWERKS FOR MARC-WERKS,
SLGORT FOR MARD-LGORT.
SELECTION-SCREEN END OF BLOCK BLK.
TOP-OF-PAGE.
WRITE:/ SY-VLINE,
02 'S.NO',
06 SY-VLINE,
08 'MATNR',
20 SY-VLINE,
22 'MEINS',
32 SY-VLINE,
34 'ERSDA',
44 SY-VLINE,
46 'ERNAM',
56 SY-VLINE,
58 'SPART',
68 SY-VLINE,
70 'MAKTX',
80 SY-VLINE,
82 'LVORM',
92 SY-VLINE,
94 'EKGRP',
104 SY-VLINE,
106 'WERKS',
116 SY-VLINE,
118 'LABST',
128 SY-VLINE,
130 'SPEME',
140 SY-VLINE,
142 'LGORT',
152 SY-VLINE.
START-OF-SELECTION.
SELECT T1~MATNR
T1~MEINS
T1~ERSDA
T1~ERNAM
T1~SPART
T2~MAKTX
T3~LVORM
T3~EKGRP
T3~WERKS
T4~LABST
T4~SPEME
T4~LGORT
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM MARA AS T1
INNER JOIN MAKT AS T2
ON T1MATNR = T2MATNR
INNER JOIN MARC AS T3
ON T2MATNR = T3NFMAT
INNER JOIN MARD AS T4
ON T3MATNR = T4MATNR
WHERE T1~MATNR IN SMATNR.
END-OF-SELECTION.
DATA: COUNT(4) TYPE N.
LOOP AT ITAB.
COUNT = COUNT + 1.
WRITE:/ SY-VLINE,
02 COUNT,
06 SY-VLINE,
08 ITAB-MATNR,
20 SY-VLINE,
22 ITAB-MEINS,
32 SY-VLINE,
34 ITAB-ERSDA,
44 SY-VLINE,
46 ITAB-ERNAM,
56 SY-VLINE,
58 ITAB-SPART,
68 SY-VLINE,
70 ITAB-MAKTX,
80 SY-VLINE,
82 ITAB-LVORM,
92 SY-VLINE,
94 ITAB-EKGRP,
104 SY-VLINE,
106 ITAB-WERKS,
116 SY-VLINE,
118 ITAB-LABST,
128 SY-VLINE,
130 ITAB-SPEME,
140 SY-VLINE,
142 ITAB-LGORT,
152 SY-VLINE.
ENDLOOP.
THANX & REGARDS,
PHANINDER -
Firefox seems unable to load the halifax online banking website where as iexplore is able to do this is there and reason for this and can i do nething to make firefox do it?
Firefox seems unable to load the halifax online banking website where as iexplore is able to do this is there and reason for this and can i do nething to make firefox do it?
-
Sorry for the question but I'm a newbie
I have this code:
http://weblogs.java.net/blog/brunogh/archive/2007/09/my_first_fx_blu_1.html
Button {
text: "Inquiry"
enabled : bind model.inquiryBtnEnabled
action: operation() {
DeviceDiscoverer.getInstance().startInquiry(DiscoveryAgent.GIAC, model.inquiryListener);
model.foundDevices = null;
model.inquiryBtnEnabled = false;
model.cancelBtnEnabled = true;
}what is the error?
Thanks.
And sorry for my english, too.Hi Gigi_One,
this code was posted in 2007.. If you're using the Preview version, you must switch "operation" to "function"...
Are there an error message?
Bruno Grossi -
Could you tell me what i'm doing wrong with this code? I posted earlier for inputting char into a variable, but the post just got too long.
I've tried below with code, but I can't get it right. Can you help me..?
import java.io.*;
public class Goals {
public static void main (String args[]) {
System.out.println("Enter time and tide:");
InputStreamReader reader = new InputStreamReader (System.in);
char ch = reader.read(char); // trying to read character from keyboard
System.out.println("the character" +ch);
This is my error here:
Goals.java:13: '.class' expec
char ch = reader.read(char);
^
Goals.java:13: ')' expected
char ch = reader.read(char);
^
thank you...
yashThe read method that you want to use does not accept any argument, so the syntax you want is char ch = reader.read();
The first error is caused because the compiler is not expecting to see the reserved word "char" at that point. It knows that the only way the code would be valid is that char was followed by .class, so it suggests it. The second error seems to be a ripple effect of the first one and gets fixed when you fix the first one.
Once you fix that error you get another, warning you about loss of precision. This is because the read() method returns an int and you are trying to assign an int in a char, while it's well known that there are plenty of integer values that don't fit in a char. Why does Reader.read() return an int instead of char? Because it needs a way to signal the end of the stream. In a normal case the read method returns the character that was read, but -1 if the end of the stream has been reached.
One way to fix this would be casting the int value to char, which erroneously interpretes the end of the stream as a char too:
char ch = (char) reader.read(); -
HT1414 Everytime i restore it, it keeps on saying theres and error
Everytime i restore my iphone it keeps on saying theres an error on there i have tried download latest itunes and restarted my computer but still won't work.
Does it give you an error code number?
90% of errors are something along the lines of
"This (Device) cannot be restored because an unknown error occured (error code here)"
If you get that number search http://support.apple.com/kb/TS3694 for the error number -
hi friends,
when I run this code it is giving error as
Cause: FDPSTP failed due to ORA-01427: single-row subquery returns more than one row
ORA-06512: at "APPS.UPD_VAC", line 18
ORA-06512: at line 1
can some one suggest a solution pls
the table vac_table has a single column... and it has only 1 record right now
CREATE OR REPLACE package body APPS.upd_vac is
procedure upd_prc(p_err_buf out VARCHAR2
,p_ret_code out NUMBER)
is
l_attr varchar2(100);
l_attr1 varchar2(100);
l_attr2 varchar2(100);
l_attr3 varchar2(100);
l_attr4 varchar2(100);
begin
SELECT MAX(ATTRIBUTE18) INTO L_ATTR FROM PER_VACANCIES;
select (regexp_substr (l_attr, '.*C')) into l_attr1 from dual;
select regexp_replace(l_attr,'^.*C(.+)$','\1') into l_attr2 from dual;
select to_number(l_attr2)+1 into l_attr3 from dual;
select l_attr1||l_attr3 into l_attr4 from dual;
insert into vac_table
(select l_attr4 from dual);
UPDATE PER_VACANCIES SET ATTRIBUTE18 =(select attribute from kdd_vacancy)
where vacancy_id =(select max(vacancy_id) from per_vacancies);
commit;
end;
end;CREATE OR replace PACKAGE BODY apps.upd_vac
IS
PROCEDURE Upd_prc(p_err_buf OUT VARCHAR2,
p_ret_code OUT NUMBER)
IS
l_attr VARCHAR2(100);
l_attr1 VARCHAR2(100);
l_attr2 VARCHAR2(100);
l_attr3 VARCHAR2(100);
l_attr4 VARCHAR2(100);
BEGIN
SELECT MAX(attribute18)
INTO l_attr
FROM per_vacancies;
SELECT ( Regexp_substr (l_attr, '.*C') )
INTO l_attr1
FROM dual;
SELECT Regexp_replace(l_attr, '^.*C(.+)$', '\1')
INTO l_attr2
FROM dual;
SELECT To_number(l_attr2) + 1
INTO l_attr3
FROM dual;
SELECT l_attr1
||l_attr3
INTO l_attr4
FROM dual;
INSERT INTO vac_table
(SELECT l_attr4
FROM dual);
UPDATE per_vacancies
SET attribute18 = (SELECT attribute FROM kdd_vacancy)
WHERE vacancy_id = (SELECT MAX(vacancy_id)
FROM per_vacancies);
COMMIT;
END;
END;
(SELECT attribute FROM kdd_vacancy)must return only a single row
ATTRIBUTE18 is a scalar & can only accept one value; which is correct value FROM KDD_VACANCY? -
ABAP Syntax error in this code - Could anyone help?
Hi,
I have this code which runs fine in our non-unicode SAP system.
REPORT ECC5_OFFSETS.
DATA: W_KONV TYPE KONV.
DATA: TKOMK LIKE STANDARD TABLE OF KOMK
WITH KEY KEY_UC
INITIAL SIZE 2
WITH HEADER LINE.
DATA: TKOMK2 type STANDARD TABLE OF KOMK
WITH KEY KEY_UC
INITIAL SIZE 2.
* Get some test data
SELECT SINGLE * INTO W_KONV FROM KONV
WHERE KNUMV = '0000000061'.
MOVE-CORRESPONDING W_KONV TO TKOMK.
APPEND TKOMK.
tkomk2[] = TKOMK[].
* Original non-Unicode compliant code
DATA: LENGTH_KEY_TKOMK(3) TYPE P.
FIELD-SYMBOLS: <TKOMK_KEY> like TKOMK2.
DESCRIBE DISTANCE BETWEEN TKOMK-MANDT AND TKOMK-SUPOS
INTO LENGTH_KEY_TKOMK
* ( Original Unicode syntax fix! )
IN BYTE MODE.
* Copy all the fields between these two into TKOMK_KEY field-symbol.
* ( In Unicode this assignment fails, causing short dump at read )
ASSIGN TKOMK2(LENGTH_KEY_TKOMK) TO <TKOMK_KEY>.
* Read the current record.
READ TABLE TKOMK2 WITH KEY <TKOMK_KEY>.
But I get the following error message in our UNICODE complaint SAP system:
<b>"<TKOMK_KEY>" cannot be a table, a reference, a string, or contain any of these objects.</b>
Does anyone know how I could get around this/suggest a solution?
Thanks in advance!Hi,
Sorry if I'm being unclear.
My requirements are twofold:
1)the line of code:
ASSIGN TKOMK2(LENGTH_KEY_TKOMK) TO <TKOMK_KEY>
does not assign anything to the fields symbol <TKOMK_KEY>
2)The read statement does not like the fields symbol <TKOMK_KEY> being used as a key.
Both these bits of code worked in our 4.6b system but now in the ECC5 environemtn I get syntax errors.
Let me know if you need anything else! -
Where's the error in this code...
the following snippet of code throws a SQLException with a 'Invalid Handle' message.
What's does this 'Invalid Handle' mean? And, which line of code is causing the problem?
try {
//RETRIEVE CITYLIST FROM DB
cityList = statement.executeQuery("SELECT CityCode, CityName FROM CityList");
while (cityList.next()) {
//ADD CODES AND NAMES OF CITIES TO ARRAYLISTS
String code = cityList.getString(1);
String name = cityList.getString(2);
codes.add(code);
names.add(name);
cityList.close();
} catch (SQLException sql) {
System.out.println("2-checkForAvailability.jsp..err->" + sql);
Any help will be appreciated..
regards
UshantaYes, you don't declare the ResultSet inside that try block, so I'll assume that it's a data member of your class. I'd suggest that you make the ResultSet a local variable in that method and not try to hang onto it. Same for the statement:
Statement statement = null;
ResultSet cityList = null;
try
statement = connection.createStatement();
cityList = statement.executeQuery("SELECT CityCode, CityName FROM CityList");
while (cityList.next())
String code = cityList.getString(1);
String name = cityList.getString(2);
codes.add(code);
names.add(name);
} catch (SQLException sql)
sql.printStackTrace();
System.err.println("SQL state: " + sql.getSQLState());
System.err.println("SQL error: " + sql.getErrorCode());
finally
try
if (cityList != null)
cityList.close();
if (statement != null)
statement.close();
catch (SQLException ignoreException) -
See my error against this code jasperPrint = JasperFillManager.fillReport(s
sir i use this code for without database report
jasperPrint = JasperFillManager.fillReport(stream, new HashMap(), new JREmptyDataSource());
and comple then output window give me this error
C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportsrcwithoutdatasourceireportPage1.java:390: unreported exception net.sf.jasperreports.engine.JRException; must be caught or declared to be thrown
jasperPrint = JasperFillManager.fillReport(stream, new HashMap(), new JREmptyDataSource());
1 error
C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportnbprojectbuild-impl.xml:233: The following error occurred while executing this line:
C:Documents and SettingsAdministratorMy DocumentsCreatorProjectswithoutdatasourceireportnbprojectbuild-impl.xml:122: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 13 seconds)
see all error and
plese give me idea
thank's
aamirSee your other thread on the same topic
Re: jsp give me this error javax.servlet.ServletException: oracle.jdbc.driv -
I was gifted an app and it says this code has already been used How do i find the code.
I was giften an app and when i got to itunes it said this code has already been used. I don't even know how you find the code when you are gifted an app from someone. My question is how do you find the code to enter when you are gifted an app?
See here: iTunes 10 for Windows: Redeem an iTunes allowance, gift certificate, or Gift Card
B-rock -
What is the error in this code
hi everone
I write this code in push button
declare
x varchar2(222);
begin
x:=get_application_property(:system.mode);
message(x);
end;
to know the system mode
but the resullt was exeception ora-06502simple write
x := :system.mode;
or
message(:system.mode);
message(:system.mode);Best way to resolve the issue is always check Forms online help first -
HELP! Run-time Error with this code.
I'm having problem with the code below. But if I were to remove the writer class and instances of it (writeman), then there are no problems. Can some1 pls tell me why the writer class is giving problems. Btw, no compilation errors, only errors at run-time..........
import java.applet.*;
import java.awt.*;
import java.awt.event.MouseListener;
import java.awt.event.*;
public class HelloWorld extends Applet
public static String MyString = new String("Hello");
Graphics f;
public void init()
Changer Changer1 = new Changer();
writer writeman = new writer();
setBackground(Color.red);
setForeground(Color.green);
addMouseListener(Changer1);
writeman.paintit(f);
public void paint(Graphics g)
g.drawString(MyString,10 ,10);
public class Changer implements MouseListener
public void mouseEntered(MouseEvent e)
setBackground(Color.blue);
MyString = "HI";
paint(f);
repaint();
public void mouseExited(MouseEvent e)
setBackground(Color.red);
repaint();
public void mousePressed(MouseEvent e){};
public void mouseReleased(MouseEvent e){};
public void mouseClicked(MouseEvent e){};
public class writer
public void paintit(Graphics brush)
brush.drawString("can u see me", 20, 20);I assume the exception you are getting is a NullPointerException...
When you applet is loaded, it is initialised with a call to init... the following will then occur...
HelloWorld.init()
writeman.paintit(f)
// f has not been initialised, so is null
brush.drawString("can u see me", 20, 20)
// brush == f == null, accessing a null object causes a NullPointerException!
The simplest way to rectify this is to not maintain your own reference to the Graphics object. Move the writer.paintit(f) method to the HelloWorld.paint(g) method, and pass in the given Graphics object. Also, change the paint(f) call in Changer to repaint(), which will cause the paint method to be called with a valid Graphics object - which will then be passed correctly to writer.
Hope this helps,
-Troy
Maybe you are looking for
-
HT201269 Does anyone know how to reset your Restrictions Code?
So I set up a restrictions passcode for certain applications, one of them being iCloud. I forgot what the code is and now I can't access my cloud. I tried to restore but backing up also restores settings which means the backup contains the same restr
-
Robohelp 9 v/s Robohelp 10
What is the difference between Robohelp 9 and Robohelp 10? Which is better and why?
-
Flash Player 9.0 bug.
Hello, Broken animation broken_image_screenshot Original animation original_image_screenshot Please tell me why there is this problem? tests; Firefox 3 (Beta) - FlashPlayer 8.0 - GOOD Firefox 3 (Beta) - FlashPlayer 9.0 - BAD IE 7.0 - FlashPlayer 8.0
-
How to get rid of the gray work space ?
There is a way to change work space to white instead of charcoal,where is the option ??
-
Why can't I use Windows Media Player on my iBook G4?
I've tried to install Windows Media Player for my iBook G4, but a message comes up that I don't have the correct application. What can I do to get it working? Thanks for any help. Janie