p931226
asked on
got these error msg..
//************************ ********
//File Name: InsertHRCommand.java
//************************ ********
package net.sourceforge.jhtml.gui. editor.act ions.edit. commands;
import net.sourceforge.jhtml.gui. editor.act ions.Comma nd;
import net.sourceforge.jhtml.gui. editor.win dow.Editor Window;
public class InsertHRCommand implements Command
{
public void execute()
{
Action a;
a = getTextComponent().getActi onMap().ge t("InsertH R");
}
}
//************************ ********** ********
========================== ========== ======
ERROR MSG:
1)"InsertHRCommand.java": cannot resolve symbol: class Action in class net.sourceforge.jhtml.gui. editor.act ions.edit. commands.I nsertHRCom mand at line 62, column 9
2)"InsertHRCommand.java": cannot resolve symbol: method getTextComponent ()in class net.sourceforge.jhtml.gui. editor.act ions.edit. commands.I nsertHRCom mand at line 63, column 13
========================== ========== =====
I got the error msg for the code above, what should I add in to solve the problem? TQ!
//File Name: InsertHRCommand.java
//************************
package net.sourceforge.jhtml.gui.
import net.sourceforge.jhtml.gui.
import net.sourceforge.jhtml.gui.
public class InsertHRCommand implements Command
{
public void execute()
{
Action a;
a = getTextComponent().getActi
}
}
//************************
==========================
ERROR MSG:
1)"InsertHRCommand.java": cannot resolve symbol: class Action in class net.sourceforge.jhtml.gui.
2)"InsertHRCommand.java": cannot resolve symbol: method getTextComponent ()in class net.sourceforge.jhtml.gui.
==========================
I got the error msg for the code above, what should I add in to solve the problem? TQ!
besides when you want to use something like this:
a = getTextComponent().getActi onMap().ge t("InsertH R");
then you have to be sure that "getTextComponent().getAct ionMap().g et("Insert HR")" is an Action, otherwise you have to cast it (when possible of course) to an Action
--> a = (Action)(getTextComponent( ).getActio nMap().get ("InsertHR "));
anywayz perhaps you should read a little about object oriented programming basics
a = getTextComponent().getActi
then you have to be sure that "getTextComponent().getAct
--> a = (Action)(getTextComponent(
anywayz perhaps you should read a little about object oriented programming basics
First, unless you are extending the JHTML packages that you are using from source forge, you shouldn't be creating your own classes in that package. This will lead to all sorts of confusion.
The first of your errors is occurring because the compiler can't find the Action class. If this class is part of the same framework that you are using you might find that you are simply missing something like:
import net.sourceforge.jhtml.gui. editor.act ions.Actio n;
from the beginning of the file.
As leeprovoost has pointed out, the getTextComponent() method needs to be called on an object, *unless* the current object implements this method.
The first of your errors is occurring because the compiler can't find the Action class. If this class is part of the same framework that you are using you might find that you are simply missing something like:
import net.sourceforge.jhtml.gui.
from the beginning of the file.
As leeprovoost has pointed out, the getTextComponent() method needs to be called on an object, *unless* the current object implements this method.
ASKER
jimmack
Can you show me what are the things that I should have included in the file Action.java (import.net.sourceforge.jh tml.gui.ed itor.actio ns.Action; )?
Thank you.
Can you show me what are the things that I should have included in the file Action.java (import.net.sourceforge.jh
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I've just downloaded 1.0pre5 - since 1.0pre6 has problems with the documentation.
There are several xxxAction classes in the release, but these all inherit from AbstractAction (not Action).
You seem to be missing a lot of information. I don't think that I can help much at this stage. Are you trying to extend the application? If so, you would be better subscribing to the mailing lists for the project (see http://sourceforge.net/mail/?group_id=2588), or better yet, use the "contact me" link for the author from the project's home page (http://jhtml.sourceforge.net/).
There are several xxxAction classes in the release, but these all inherit from AbstractAction (not Action).
You seem to be missing a lot of information. I don't think that I can help much at this stage. Are you trying to extend the application? If so, you would be better subscribing to the mailing lists for the project (see http://sourceforge.net/mail/?group_id=2588), or better yet, use the "contact me" link for the author from the project's home page (http://jhtml.sourceforge.net/).
> a = getTextComponent().getActi onMap().ge t("InsertH R");
You shouldn't be doing that. The action map will call this class to perform the action.
You need to implement the capability to insert hr here. ie. you have to actually insert the text into the current text windows document model.
You shouldn't be doing that. The action map will call this class to perform the action.
You need to implement the capability to insert hr here. ie. you have to actually insert the text into the current text windows document model.
jimmack's suggestion to post to their email list is a good one. They'll be far more familiar with the package.
First of all you have to do this with:
Action a = new Action();
Second, you are using the method getTextComponent(). Methods are part of a class, so you have to use a method on an instance of that class (or derived class when you use inheritance).
For example:
String name;
Student a = new Student();
name = a.getStudentName();
--> name = getStudentName()) will not work!
I hope this helped.
grtz
Lee