Cannot resolve symbol class graphics
does anyone know what the error
cannot resolve symbol class graphics means?
with this code i can't seem to call the graphics method to draw the line....any reason why?
import javax.swing.*;
import java.*;
public class LineDraw extends JFrame {
public static void main(String[] args) {
LineDraw ld = new LineDraw();
ld.setSize(500,500);
ld.setVisible(true);
ld.enterVariables();
public void init(){
private int x1;
private int x2;
private int y1;
private int y2;
public void paint(Graphics g) {
g.GetGraphics(g);
super.paintComponent(g);
g.drawLine(x1, y1, x2, y2);
public void enterVariables() {
x1 = Integer.parseInt(JOptionPane.showInputDialog("Enter x1:"));
y1 = Integer.parseInt(JOptionPane.showInputDialog("Enter y1:"));
x2 = Integer.parseInt(JOptionPane.showInputDialog("Enter x2:"));
y2 = Integer.parseInt(JOptionPane.showInputDialog("Enter y2:"));
repaint();
}
well the exact error message is ...by the way now that i think about it
if the graphics method shoudl not be part of the JFrame class then what method would i use to draw 2D Graphics?
--------------------Configuration: <Default>--------------------
C:\Documents and Settings\c1s5\My Documents\LineDraw.java:21: cannot resolve symbol
symbol : class Graphics
location: class LineDraw
public void paint(Graphics g)
^
1 error
Process completed.
and the exact code is
import javax.swing.*;
import java.*;
public class LineDraw extends JFrame {
public static void main(String[] args) {
LineDraw ld = new LineDraw();
ld.setSize(1024,500);
ld.setVisible(true);
ld.enterVariables();
private int x1;
private int x2;
private int y1;
private int y2;
public void paint(Graphics g)
super.paintComponent(g);
g.drawLine(x1, y1, x2, y2);
public void enterVariables() {
x1 = Integer.parseInt(JOptionPane.showInputDialog("Enter x1:"));
y1 = Integer.parseInt(JOptionPane.showInputDialog("Enter y1:"));
x2 = Integer.parseInt(JOptionPane.showInputDialog("Enter x2:"));
y2 = Integer.parseInt(JOptionPane.showInputDialog("Enter y2:"));
repaint();
}
Similar Messages
-
PLEASE HELP: cannot resolve symbol class
it's showing me the error on the following lines 7 and 9
it says cannot resolve symbol class Name and cannot resolve symbol class Phone
I also have a package name addressBook and it contains two files Entry.java and Address.java
Here is the code:
import java.io.*;
import addressBook.*;
public class AddressDr
public static void main(String[] args)throws IOException
Name name;
Address address;
Phone phone;
Entry entry;
String first, last, middle, street, city, state, zip;
int areaCode, number;
BufferedReader in;
in=new BufferedReader(new InputStreamReader(System.in));
PrintWriter outFile;
outFile=new PrintWriter(new FileWriter("Entries"));
System.out.println("Quit entered fot the first name ends the " + "application.");
System.out.print("Enter first name: ");
first=in.readLine();
while (first.compareTo("Quit") !=0)
System.out.print("Enter last name: ");
last=in.readLine();
System.out.print("Enter middle name: ");
middle=in.readLine();
name=new Name(first, last, middle);
System.out.print("Enter street address: ");
street=in.readLine();
System.out.print("Enter city: ");
city=in.readLine();
System.out.print("Enter state: ");
state=in.readLine();
System.out.print("Enter ZIP code: ");
zip=in.readLine();
address=new Address(street, city, state, zip);
System.out.print("Enter areaCode: ");
areaCode = Integer.parseInt(in.readLine());
System.out.print("Enter number: ");
number=Integer.parseInt(in.readLine());
phone=new Phone(areaCode, number);
entry= new Entry(name, address, phone);
entry.writeToFile(outFile);
System.out.print("Enter first name: ");
first=in.readLine();
outFile.close();
}OK. Here is how I did it.
I have AddressDr which is Address driver.
I have two files Address and Entry which in package addressBook.
AddressDr:
import java.io.*;
import addressBook.*;
public class AddressDr
public static void main(String[] args)throws IOException
Name name;
Address address;
Phone phone;
Entry entry;
String first, last, middle, street, city, state, zip;
int areaCode, number;
BufferedReader in;
in=new BufferedReader(new InputStreamReader(System.in));
PrintWriter outFile;
outFile=new PrintWriter(new FileWriter("Entries"));
System.out.println("Quit entered fot the first name ends the " + "application.");
System.out.print("Enter first name: ");
first=in.readLine();
while (first.compareTo("Quit") !=0)
System.out.print("Enter last name: ");
last=in.readLine();
System.out.print("Enter middle name: ");
middle=in.readLine();
name=new Name(first, last, middle);
System.out.print("Enter street address: ");
street=in.readLine();
System.out.print("Enter city: ");
city=in.readLine();
System.out.print("Enter state: ");
state=in.readLine();
System.out.print("Enter ZIP code: ");
zip=in.readLine();
address=new Address(street, city, state, zip);
System.out.print("Enter areaCode: ");
areaCode = Integer.parseInt(in.readLine());
System.out.print("Enter number: ");
number=Integer.parseInt(in.readLine());
phone=new Phone(areaCode, number);
entry= new Entry(name, address, phone);
entry.writeToFile(outFile);
System.out.print("Enter first name: ");
first=in.readLine();
outFile.close();
Entry:
package addressBook;
import java.io.*;
public class Entry
Name name;
Address address;
Phone phone;
public Entry(Name newName, Address newAddress, Phone phoneNumber)
name = newName;
address = newAddress;
phone = phoneNumber;
public Name knowName()
return name;
public Address knowAddress()
return address;
public Phone knowPhone()
return phone;
public void writeToFile(PrintWriter outFile)
outFile.println(name.knowFirstName());
outFile.println(name.knowLastName());
outFile.println(name.knowMiddleName());
oufFile.println(address.knowStreet());
outFile.println(address.knowState());
outFile.println(address.knowCity());
outFile.println(address.knowZip());
outFile.println(phone.knowAreaCode());
outFile.println(phone.knowDigits());
Address:
package addressBook;
public class Address
String street;
String city;
String state;
String zipCode;
public Address(String newStreet, String newCity, String newState, String zip)
street=newStreet;
city=newCity;
state=newState;
zipCode=zip;
public String knowStreet()
return street;
public String knowCity()
return city;
public String knowState()
return state;
public String knowZip()
return zipCode;
} -
Cannot resolve symbol class Scanner (Error)
For whatever reason I get the error message "cannot resolve symbol class Scanner" when trying to run this:
import java.io.*;
import java.util.*;
public class NameReversal
public static void main(String args[])
System.out.print("Enter your name: ");
Scanner Reader = new Scanner(System.in);
String first = Reader.next();
String finl = Reader.next();
int z = first.length();
int v = finl.length();
int y = z-1;
int f = y-1;
for(int i = y; i>=0; z--)
System.out.print(first.charAt(1));
System.out.print(" ");
for(int p = f; p >= 0; p--)
System.out.println(finl.charAt(p));
}The Scanner class is in the JDK version 1.5 or later. You must be using an earlier version.
-
Cannot resolve symbol: class OracleDriver
Attempting to compile a servlet on Apache Server using same jdeveloper jdbc libraries:
classes12.jar & nls_charset12.jar
Error message:
$compilejava2.sh ProdJobs
ProdJobs.java:361: cannot resolve symbol
symbol : class OracleDriver
location: package driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Am I missing something else?
JeffreyEnter this code into your program and then put the Oracle jar file that contains the driver in your run-time classpath.
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
catch(ClassNotFoundException cnfe) {
// driver not found
}The effect of this is that the classloader will load the Oracle driver for you then call it's static initiailizer that does a bunch of magic that results in the Java runtime knowing that there's a JDBC driver out there.
It is a little weird - but that's the way it works. -
Cannot resolve symbol: class EJBObject
Using javac I get this compile error on this file Calculator.java
Calculator.java:1: cannot resolve symbol
symbol : class EJBObject
location: package ejb
import javax.ejb.EJBObject;
^
Calculator.java:5: cannot resolve symbol
symbol : class EJBObject
location: interface Calculator
public interface Calculator extends EJBObject {
Source code for Calculator.java
import javax.ejb.EJBObject;
import java.rmi.*;
public interface Calculator extends EJBObject {
public long add (int x, int y) throws RemoteException;
public long subtract (int x, int y) throws RemoteException;This code is from a book, so I will assume its a classpath problem. My
classpath looks like:
"C\QTJava.zip".;%J2EE_HOME%\lib\j2ee.jar;%J2EE_HOME%\lib\locale
Also the following enviorment varibales have been set to:
J2EE_HOME
C:\Development\Java\j2sdkee1.3.1
JAVA_HOME
C:\Development\Java\jdk1.3.1
Path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;%JAVA_HOME%\bin;%J2EE_HOME%\bin
I can run j2EE, like "j2EE -verbose" (no problems)
also run cloudscape, like "cloudscape -start" (no problems)
also can run deploytool, like "deploytool" (no problems, & deploy sample ear files from cd book)
Your help is appreicated. -
Cannot resolve symbol : class odbc ERROR
Hi Helper
I am trying to compile a the following and I am getting the error
C:\jdk\websiter>javac MainServlet.java
MainServlet.java:86: cannot resolve symbol
symbol : class odbc
location: package jdbc
Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.io.*;
import java.util.*;
* This is the servlet to send the user the names of all the sites present in the database
public class MainServlet extends HttpServlet implements ServletConstants
Connection m_con;
PreparedStatement m_pstmt;
ResultSet m_res;
Vector m_vecsiteName;
public void Init(ServletConfig config) throws ServletException {
super.init(config);
}// end of init()
public void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
m_vecsiteName = new Vector();
try {
Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
m_con = DriverManager.getConnection("jdbc:odbc:sitewd", "", "");
How can i fix it? thanks
VTReplace the Statement
Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);
as
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); -
Error:cannot resolve Symbol class"name"
when I have compiled Bean class named SlBean which has primary class named pk, I recevied following error message(I compiled pk class without error) :
cannot resolve symbol
symbol : class pk
location: class SlBean
public pk ejbCreate(Sorry , its not classpath problem. You have to simply import the pk class if its in any package. I am assuming you have packaged your pk class with ejb jar file.
for eg. if your class is
package abc.xyz
public class pk
then in your bean class import
import abc.xyz.pk;
--Ashwani -
Cannot resolve symbol - class FileInputStream
I am getting the above error when I compile this following method; I get it in the first line of code.
Anyone know why?
private String readAndProcessData(FileInputStream stream)
InputStreamReader iStrReader = new InputStreamReader(stream);
BufferedReader reader = new BufferedReader(iStrReader);
try
output.setText("");
String data=reader.readLine();
while (data!= null){
output.append(data + "\n");
data=reader.readLine();}
catch(IOException e)
messageBox("Error in file input:\n" + e.toString());
[code/]I am already doing this in another class which is linked to this one.
I have three classes and java.io is imported in the Inteface, and this method is in the model class. -
Cannot resolve symbol: class NamespaceContext
I get the following error when I compile
import javax.xml.namespace.NamespaceContext;
I have added jar files come with jwsdp-1.3It's a bit old, but for the records:
The NamespaceContext class is in the jaxp-api.jar which is located here: jwsdp-1.6\jaxp\lib
As the time of this writing, 1.6 is the current version ;) -
Cannot resolve symbol : class InputStream
I had and environment in which this code compiled. Then I installed Java Communications API. After fooling around to get that to work, I find that I get this error when compiling. What did I do to cause this? what jar file might be missing?
InputStream is in java.io.
If you deleted a jar file in your jre/bin/lib folder there
would problably be a lot more errors then this.The possible
files are jce.jar,jsse.jar,jaws.jar,rt.jar,or sunrsasign.jar.
Although i'm not certain this is correct.If one of those files
are missing that's your problem, if not,I don't know sorry. -
Cannot reslove symbol class Date
I am trying to get a clock to show the time in my program. However, when I try to compile the program a "cannot resolve symbol class Date" error appears. I can't figure out where the problem in my program is. Here is my source code. I would appreciate any help.
import javax.swing.*;
import java.io.*;
import java.lang.*;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
//import java.util.*;
import java.math.*;
public class store
public static void main(String[] args)
String dataInput;
dataInput = JOptionPane.showInputDialog(null, "Input item data: ");
JOptionPane.showMessageDialog(null, "" + dataInput);
EasyReader console = new EasyReader();
int i, j, k, inum, icom, min, nswaps; inum = 0; boolean swap = false;
double num[] = new double[100]; double dsum, T;
do
System.out.println(); System.out.println("Command Menu"); System.out.println();
System.out.println("1 = Display the data");
System.out.println("2 = Bubble Sort the numbers");
System.out.println("3 = Selection Sort the numbers");
System.out.println("4 = Insertion Sort the numbers");
System.out.println("5 = Binary Search for a number");
System.out.println("0 = Exit the program"); System.out.println();
System.out.print("Enter Command - ");
icom = console.readInt(); System.out.println();
switch (icom)
case 1: // Display the data
Display(inum, num);
break;
case 2: // Bubble sort
nswaps = 0;
for (i = 0; i < (inum-1); i++ )
for (j = (i+1); j < inum; j++)
if (num[i] > num[j])
T = num;
num[i] = num[j];
num[j] = T;
nswaps++;
System.out.println("The number of swaps was - " + nswaps);
Display(inum, num);
break;
case 3: // Selection sort
nswaps = 0;
for (i = 0; i < inum - 1; i++) {
min = i; swap = false;
for (j = i + 1; j < inum; j++)
if (num[j] < num[min]) { min = j; swap = true; }
if (swap) {T = num[min];
num[min] = num[i];
num[i] = T;
nswaps++;}
System.out.println("The number of swaps was - " + nswaps);
Display(inum, num);
break;
case 4: // Selection sort
nswaps = 0;
for (i = 1; i < inum; i++)
j = i; T = num[i];
while ((j > 0) && (T < num[j-1]))
num[j] = num[j-1]; j--; nswaps++;
num[j] = T; nswaps++;
System.out.println("The number of swaps was - " + nswaps);
Display(inum, num);
break;
case 5: // Binary Search
System.out.println("Your numbers will be sorted first");
System.out.println();
for (i = 1; i < inum; i++)
j = i; T = num[i];
while ((j > 0) && (T < num[j-1]))
num[j] = num[j-1]; j--;
num[j] = T;
System.out.print("Enter the number to locate - ");
T = console.readDouble(); nswaps = 0; System.out.println();
int left = 0, right = inum, middle; k = -1;
while (left <= right)
middle = (left + right) / 2;
if (T > num[middle]) {left = middle + 1; nswaps++;}
else if (T < num[middle]) {right = middle - 1; nswaps++;}
else { k = middle; break; }
if (k == -1) System.out.println("Your number was not located in the array");
else System.out.println("Your number " + T + " is in position " + (k+1));
System.out.println();
System.out.println(nswaps + " comparisons were needed to search for your number");
Display(inum, num);
break;
} while (icom != 0);
public static void Display(int inum, double num[])
{ int k;
System.out.println();
System.out.println("");
System.out.println();
for (k = 0; k < inum; k++)
System.out.println((k+1) + " - " + num[k]);
return;
class Clock extends Thread
//A Canvas that will display the current time on the calculator
Canvas Time;
//A Date object that will access the current time
private Date now;
//A string to hold the current time
private String currentTime;
//The constructor for Clock, accepting a Label as an argument
public Clock(Canvas _Time)
Time = Time; //Time is passed by reference, so Time
//now refers to the same Canvas
start(); //start this thread
//The overriden run method of this thread
public void run()
//while this thread exists
while (true)
try
draw_clock(); //calls the draw_clock method
sleep(1000); //puts this thread to sleep for one
//second
//catches an InterruptedException that the sleep() method might throw
catch (InterruptedException e) { suspend(); }
//catches a NullPointerException and suspends the thread if one occurs
catch (NullPointerException e) { suspend(); }
//A method to draw the current time onto the Time Canvas on the applet
public void draw_clock()
try
//Obtains the Graphics object from the Canvas Time so that it can
//be manipulated directly
Graphics g = Time.getGraphics();
g.setColor(Color.gray); //sets the color of the Graphics object
//to gray for the rectangle background
g.fillRect(0,0,165,25); //fills the Canvas area with a rectangle
//starting at 0,0 coordinates of the Canvas
//and extending to the length and width
g.setColor(Color.orange); //sets the color of the Graphics object
//to orange for the text color
get_the_time(); //calls the get_the_time() method
//calls the drawString method of the Graphics object g, which will
//draw a string to the screen
//Accepts a string and two integers to represent the coordinates
g.drawString("Current Time - " + currentTime, 0, 17);
//catches a NullPointerException and suspends the thread if one occurs
catch (NullPointerException e) { suspend(); }
//A method to obtain the current time, accurate to the second
public void get_the_time()
//creates a new Date object for "now" every time this is called
now = new Date( );
//integers to hold the hours, minutes and seconds of the current time
int a = now.getHours();
int b = now.getMinutes();
int c = now.getSeconds();
if (a == 0) a = 12; //if hours are zero, set them to twelve
if (a > 12) a = a -12; //if hours are greater than twelve, make a
//conversion to civilian time, as opposed to
//24-hour time
if ( a < 10) //if hours are less than 10
//sets the currentTime string to 0, appends a's value and a
//colon
currentTime = "0" + a + ":" ;
else
//otherwise set currentTime string to "a", append a colon
currentTime = a +":";
if (b < 10) //if minutes are less than ten
//append a zero to string currentTime, then append "b" and a colon
currentTime = currentTime + "0" + b + ":" ;
else
//otherwise append "b" and a colon to currentTime string
currentTime = currentTime + b + ":" ;
if (c < 10) //if seconds are less than ten
//append a zero to string currentTime, then append "c" and a colon
currentTime = currentTime + "0" + c ;
else
//otherwise append "c" to currentTime string
currentTime = currentTime + c;
} //end of the Clock classWow.
1) Please in future use the code tags to format code you post so that it doesn't think you have italics in your code and render it largely1 unreadable. Read this
http://forum.java.sun.com/help.jspa?sec=formatting
2) You commented out the import of java.util which is the problem you are complaining about.
3) Are you planning to stick all the code you ever write into the one source file? Why is all this stuff rammed together. Yoinks. -
I am having a problem with the following code in InheritanceDemo.java.
public void paint(Graphics g)
numShapes = shapeList.size();
for (int i = 0;i < numShapes; i++)
Shape s = (Shape)shapeList.get(i);
s.draw(g);
It is giving me errors on s.draw(g). It's pointing to the period after the s and says "cannot resolve symbol", Class Shape.
My Shape.java looks like the following:
import java.awt.*;
abstract class Shape {
abstract void paint(Graphics g);
Can anyone tell me what I've done incorrectly?Okay, I think I understand. You're importing java.awt.*, so when you say Shape it thinks you mean java.awt.Shape.
(Solution 1) Change the classname Shape to one which doesn't already exist in the Java class library.
(Solution 2) Only import the classes you need, not *.
(Solution 3) Add an explicit "import Shape;" below the rest of the import statements to override -
Cannot resolve symbol java.awt.graphics
// DrawRectangleDemo.java
import java.awt.*;
import java.lang.Object;
import java.applet.Applet;
public class DrawRectangleDemo extends Applet
public void paint (Graphics g)
// Get the height and width of the applet's drawing surface.
int width = getSize ().width;
int height = getSize ().height;
int rectWidth = (width-50)/3;
int rectHeight = (height-70)/2;
int x = 5;
int y = 5;
g.drawRect (x, y, rectWidth, rectHeight);
g.drawString ("drawRect", x, rectHeight + 30);
x += rectWidth + 20;
g.fillRect (x, y, rectWidth, rectHeight);
// Calculate a border area with each side equal tp 25% of
// the rectangle's width.
int border = (int) (rectWidth * 0.25);
// Clear 50% of the filled rectangle.
g.clearRect (x + border, y + border,
rectWidth - 2 * border, rectHeight - 2 * border);
g.drawString ("fillRect/clearRect", x, rectHeight + 30);
x += rectWidth + 20;
g.drawRoundRect (x, y, rectWidth, rectHeight, 15, 15);
g.drawString ("drawRoundRect", x, rectHeight + 30);
x=5;
y += rectHeight + 40;
g.setColor (Color.yellow);
for (int i = 0; i < 4; i++)
g.draw3DRect (x + i * 2, y + i * 2,
rectWidth - i * 4, rectHeight - i * 4, false);
g.setColor (Color.black);
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
x += rectWidth + 20;
g.setColor (Color.yellow);
g.fill3DRect (x, y, rectWidth, rectHeight, true);
g.setColor (Color.black);
g.drawString ("fill3DRect", x, y, + rectHeight + 25);
Help me with this codes. I typed correctly but there still errors.
--------------------Configuration: JDK version 1.3.1 <Default>--------------------
D:\Program Files\Xinox Software\JCreator LE\MyProjects\DrawRectangleDemo.java:56: cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
location: class java.awt.Graphics
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
^
D:\Program Files\Xinox Software\JCreator LE\MyProjects\DrawRectangleDemo.java:64: cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
location: class java.awt.Graphics
g.drawString ("fill3DRect", x, y, + rectHeight + 25);
^
2 errors
Process completed.
-------------------------------------------------------------------------------------------------------------------------------cannot resolve symbol
symbol : method drawString (java.lang.String,int,int,int)
This is telling you that you are trying to invoke the drawString() method with 4 parameters: String, int, int, int
If you look at the API the drawString() method need 3 parameters: String, int, int - so you have an extra int
location: class java.awt.Graphics
g.drawString ("draw3DRect", x, y, + rectHeight + 25);
Now is you look at your code you will find that you have 3 ',' in you method call. (I don't think you want the ',' after the y. -
3 graphic errors- Cannot resolve Symbols
I am looking for help to resolve 3 errors that I don't understand and I am hoping someone can take the time to point me in the right directions.
The errors occur while setting the forground color, trying to repaint and trying to draw a rectangle.
Here are the errors from the compiler:
Worm.java [42:1] cannot resolve symbol
symbol : method setForeground (java.awt.Color)
location: class Worm
setForeground(Color.RED);
^
Worm.java [49:1] cannot resolve symbol
symbol : method repaint ()
location: class Worm
repaint();
^
Worm.java [56:1] cannot resolve symbol
symbol : method drawRectangle (int,java.awt.Rectangle,int,int)
location: class java.awt.Graphics
g.drawRectangle(rec.x, rec[i], rec[i].height, rec[i].width );
^
3 errors
Errors compiling Worm.java.
The code follows:
Thanks for any assistance inadvance
WBR
import java.awt.*;
import java.awt.Graphics.*;
import java.awt.Color;
import java.awt.event.*;
import javax.swing.*;
import java.awt.Rectangle.*;
import java.io.*;
import java.util.*;
class WormFrame extends JFrame{
public WormFrame(){
setTitle("CenteredFrame");
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
int screenHeight = d.height;
int screenWidth = d.width;
setSize(screenWidth / 2, screenHeight / 2);
setLocation(screenWidth / 4, screenHeight / 4);
public class Worm{
Rectangle rec[];
private Worm(){
Rectangle rec[] = new Rectangle [25];
int x = 25;
int y = 25;
for(int i = 0; i < rec.length; i++ ){
rec.x = x++;
rec[i].y = y++;
rec[i].height = 1;
rec[i].width = 1;
private void wormDraw( ){
setForeground(Color.RED); // Error 1
for(int a = 1; a < 20; a++){
for(int i = 1; i < rec.length; i++ ){
rec[i].x += 1;
rec[i].y += 1;
repaint(); // Error 2
public void paint(Graphics g) {
System.out.println("paint : " + new Date( ) );
// Draw dots
for(int i = 0; i < rec.length; i++ ){
g.drawRectangle(rec[i].x, rec[i], rec[i].height, rec[i].width ); // Error 3
public static void main(String[] args){
JFrame frame = new WormFrame();
frame.show();
Worm w = new Worm();
w.wormDraw();Hello! This works...
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
public class Worm extends JFrame
Rectangle rec[];
public Worm()
setTitle("CenteredFrame");
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
int screenHeight = d.height;
int screenWidth = d.width;
setSize(screenWidth / 2, screenHeight / 2);
setLocation(screenWidth / 4, screenHeight / 4);
setVisible(true);
rec = new Rectangle [25];
int x = 25;
int y = 25;
for(int i = 0; i < rec.length; i++ )
System.out.println("Creating rec " + i);
rec[i] = new Rectangle();
rec.x = x++;
rec[i].y = y++;
rec[i].height = 1;
rec[i].width = 1;
public void wormDraw( )
setForeground(Color.RED);
for(int a = 1; a < 20; a++)
for(int i = 1; i < rec.length; i++ )
System.out.println("Drawing rec " + i);
rec[i].x += 1;
rec[i].y += 1;
System.out.println("Calling paint");
repaint();
validate();
System.out.println("Done");
public void paint(Graphics g)
System.out.println("paint : " + new Date( ) );
for(int i = 0; i < rec.length; i++ )
g.fillRect(rec[i].x, rec[i].y, rec[i].height, rec[i].width);
public static void main(String[] args)
new Worm().wormDraw();
regards,
Liam -
Visual Studio 2012 cannot resolve symbol or Errors control is not a member of class
Visual Studio 2012 Web Site Project (Note not a Web application, so there are not Designer.vb files) > Site works perfectly fine and using IIS and attaching to IIS to debug code.
However, if I try to build the site inside of Visual Studio I am getting lots of Errors ‘pnlName’ is not a member of ‘Page_Name’ In the code behind I am getting errors ‘Cannot resolve symbol ‘pnlName’
.ascx Page
<li style="margin-right:0;" id="pnlName" runat="server"><a href="/cart" title="Checkout" class="global-checkout">Checkout</a></li>
.ascx.vb page
Me.pnlName.Attributes.Remove("style")
I have cleaned, rebuild and nothing gets rid of these errors, but again the site works as designed, but I would like to launch and debug inside of Visual Studio.
Moojjoo MCP, MCTS
MCP Virtual Business Card
http://moojjoo.blogspot.comCor,
What I am stating is this is a solution using the Web Site Project instead of a
Web Application Project.
Web Site projects do not require Designer.vb files, Web Application Projects add Designer.vb files in the solution.
Background: I have been hired to support a very successful e-commerce site that was built by a 3rd party vendor (I had no input on the contract or specification, because I would have went with
MVC). The site works 100% correctly, however from my 2003 - 2015 experience with Visual Studio and Web Development being in Web Forms and MVC I have always built ASP.NET Solutions using the Web Application Project Templates, which compiles the code down
to .dlls.
A Web Site project does not compile the code, but simply uses the .vb files and they have to be migrated to the server with the .aspx files. http://msdn.microsoft.com/en-us/library/dd547590%28v=vs.110%29.aspx
Currently the only way I can debug this Solution is to attach to the w3wp.exe process running locally on my work station.
The Solution is comprised of two Web Sites, which I cannot get it to compile because of the following errors -
'webServerControlName' is not a member of '(Protected Code Behind Class Name)' I am reaching out to the MSDN community to see if anyone has experienced this issue with
Web Site Projects.
I hope that clears up the Project Type question.
Moojjoo MCP, MCTS
MCP Virtual Business Card
http://moojjoo.blogspot.com
Maybe you are looking for
-
Micrsoft Outlook somtimes prompting for username and password
hello All , I Have Exchange 2010 sp3 installed two mailbox servers & two HUB & CAS Servers and Outlook sometimes prompting for username and password . how can fix it . Thank you
-
Port Forward in Cisco series 800
Dear Support below the configuration of Cisco Series 800 Router that Has VDSL port of internet , the configuration as below : i add three command what is required in order to make port forward ip nat inside source static tcp 8000 10.10.10.10 8000
-
Whenever i try to open Dictionary, a question mark appears over the icon in the dock, and nothing happens. I had to delete my preferences, would that have made it not work? I think i may have accidentally deleted the application. Can someone tell me
-
Using parameter in if_else ???
Hi How ı use the parameter in if_else statement ? create or replace PROCEDURE SINIF_BAZINDA_BASARI_APEX(aranilan_yil in number, birimno in number, sinif number )IS CURSOR c_basari IS SELECT ------ into ------ FROM ------- WHERE da.acildigi_yil= arani
-
All of my users have primary phones at their desks that are never shared. I would like to set up spare phones at spare desks for travelers to log into with Extension Mobility. Is there a way to configure this such that every line and speed dial fro