Welcome to Dream.In.Code
Become a Java Expert!

Join 150,157 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,380 people online right now. Registration is fast and FREE... Join Now!




Error: cannot find symbol

 
Reply to this topicStart new topic

Error: cannot find symbol, Plz Help Me

miloosuam
3 Aug, 2008 - 08:24 PM
Post #1

New D.I.C Head
*

Joined: 3 Aug, 2008
Posts: 1

CODE

class tgrid
{

public static void main(String [] args)
{

JFrame f = new JFrame("peme");

GridLayoutPlus glp = new GridLayoutPlus(0, 3, 10, 10);
    glp.setColWeight(1, 2);
    glp.setColWeight(2, 1);
    glp.setRowWeight(2, 1);
    f.setLayout(glp);
    for (int r = 0; r < 6; r++) {
        for (int c = 0; c < 3; c++) {
            f.add(new JButton(r+","+c));
        }
    }

  }
}

the error that occur when compile the program tgrid.java..what i should do...

$ javac tgrid.java
tgrid.java:7: cannot find symbol
symbol : class JFrame
location: class tgrid
JFrame f = new JFrame("peme");
^
tgrid.java:7: cannot find symbol
symbol : class JFrame
location: class tgrid
JFrame f = new JFrame("peme");
^
tgrid.java:9: cannot find symbol
symbol : class GridLayoutPlus
location: class tgrid
GridLayoutPlus glp = new GridLayoutPlus(0, 3, 10, 10);
^
tgrid.java:9: cannot find symbol
symbol : class GridLayoutPlus
location: class tgrid
GridLayoutPlus glp = new GridLayoutPlus(0, 3, 10, 10);
^
tgrid.java:16: cannot find symbol
symbol : class JButton
location: class tgrid
f.add(new JButton(r+","+c));
^
5 errors
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Error: Cannot Find Symbol
3 Aug, 2008 - 11:53 PM
Post #2

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,304



Thanked: 101 times
Dream Kudos: 1275
My Contributions
This isn't javascript. Moderator please move to the appropriate forum.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Error: Cannot Find Symbol
4 Aug, 2008 - 12:41 AM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to Java smile.gif
User is offlineProfile CardPM
+Quote Post

lordms12
RE: Error: Cannot Find Symbol
4 Aug, 2008 - 01:25 AM
Post #4

D.I.C Regular
Group Icon

Joined: 16 Feb, 2008
Posts: 322



Thanked: 17 times
Dream Kudos: 225
My Contributions
Download GridLayoutPlus then add its import
java
import javax.swing.JButton;
import javax.swing.JFrame;

class tgrid{

public static void main(String [] args){
JFrame f = new JFrame("peme");

GridLayoutPlus glp = new GridLayoutPlus(0, 3, 10, 10);
glp.setColWeight(1, 2);
glp.setColWeight(2, 1);
glp.setRowWeight(2, 1);
f.setLayout(glp);
for (int r = 0; r < 6; r++) {
for (int c = 0; c < 3; c++) {
f.add(new JButton(r+","+c));
}
}
}
}


Try Eclipse IDE

This post has been edited by lordms12: 4 Aug, 2008 - 10:31 PM
User is offlineProfile CardPM
+Quote Post

pbl
RE: Error: Cannot Find Symbol
4 Aug, 2008 - 03:22 AM
Post #5

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
you need a

import javax.swing.*;

at the beginning of your code to import JFrame definition

you need

import java.awt.*;

at the beginning of your code to import GridLayout definition

I know GridLayout but never heard of GridLayutPlus
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Error: Cannot Find Symbol
4 Aug, 2008 - 10:41 AM
Post #6

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Topic renamed to be more descriptive of the problem.
User is offlineProfile CardPM
+Quote Post

pbl
RE: Error: Cannot Find Symbol
4 Aug, 2008 - 08:18 PM
Post #7

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(lordms12 @ 4 Aug, 2008 - 02:25 AM) *

Download GridLayoutPlus then add its import

Try Eclipse IDE


LordMs12 in all your wisdom can you tell me what is GridLayoutPlus ? It is the Layout I use the more often.

This post has been edited by pbl: 4 Aug, 2008 - 08:29 PM
User is offlineProfile CardPM
+Quote Post

lordms12
RE: Error: Cannot Find Symbol
4 Aug, 2008 - 10:33 PM
Post #8

D.I.C Regular
Group Icon

Joined: 16 Feb, 2008
Posts: 322



Thanked: 17 times
Dream Kudos: 225
My Contributions
QUOTE(pbl @ 4 Aug, 2008 - 09:18 PM) *

QUOTE(lordms12 @ 4 Aug, 2008 - 02:25 AM) *

Download GridLayoutPlus then add its import

Try Eclipse IDE


LordMs12 in all your wisdom can you tell me what is GridLayoutPlus ? It is the Layout I use the more often.

Link was pointing to wrong URL, I edit it above to point to the right URL
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:40AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month