Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

got these error msg..

Posted on 2003-11-30
10
Medium Priority
?
305 Views
Last Modified: 2010-03-31
//********************************
//File Name: InsertHRCommand.java
//********************************
package net.sourceforge.jhtml.gui.editor.actions.edit.commands;
import net.sourceforge.jhtml.gui.editor.actions.Command;
import net.sourceforge.jhtml.gui.editor.window.EditorWindow;

public class InsertHRCommand implements Command
{
public void execute()
     {
           Action a;
           a = getTextComponent().getActionMap().get("InsertHR");
     }
}
//******************************************

==========================================
ERROR MSG:
1)"InsertHRCommand.java": cannot resolve symbol: class Action in class net.sourceforge.jhtml.gui.editor.actions.edit.commands.InsertHRCommand at line 62, column 9
2)"InsertHRCommand.java": cannot resolve symbol: method getTextComponent ()in class net.sourceforge.jhtml.gui.editor.actions.edit.commands.InsertHRCommand at line 63, column 13
=========================================

I got the error msg for the code above, what should I add in to solve the problem? TQ!

0
Comment
Question by:p931226
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
10 Comments
 
LVL 2

Expert Comment

by:leeprovoost
ID: 9844860
Hmmm you are defining here an instance of class Action called "a".
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
0
 
LVL 2

Expert Comment

by:leeprovoost
ID: 9844870
besides when you want to use something like this:
  a = getTextComponent().getActionMap().get("InsertHR");

then you have to be sure that  "getTextComponent().getActionMap().get("InsertHR")" is an Action, otherwise you have to cast it (when possible of course) to an Action
--> a = (Action)(getTextComponent().getActionMap().get("InsertHR"));

anywayz perhaps you should read a little about object oriented programming basics
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9844929
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.actions.Action;

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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:p931226
ID: 9845123
jimmack

Can you show me what are the things that I should have included in the file Action.java (import.net.sourceforge.jhtml.gui.editor.actions.Action;)?

Thank you.
0
 
LVL 15

Accepted Solution

by:
jimmack earned 320 total points
ID: 9845137
I assume you're using the code from the JHTML project from sourceforge.

Which version are you using?  (The latest is 1.0pre6)
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9845165
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/).



0
 
LVL 92

Expert Comment

by:objects
ID: 9846550
>  a = getTextComponent().getActionMap().get("InsertHR");

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.
0
 
LVL 92

Expert Comment

by:objects
ID: 9846555
jimmack's suggestion to post to their email list is a good one. They'll be far more familiar with the package.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question