Results 1 to 2 of 2
- 12-02-2009, 05:25 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 2
- Rep Power
- 0
Errors caused by classes TablePanel, CellPosition , TextPaintable
I have downloaded this source code from a website. I am trying to simply run this code in NetBeans. When I try to before running the code, there are several errors message regarding the TablePanel, TextPaintable, and CellPosition classes.
As you can see, the code has several imports. However, the classes mentioned above, are still causing errors. This is the complete code for the program, so I am not understanding why I am having errors.
Do I need to import additional classes? Is there another reason why NetBeans not recognizing these classes?
I have attached the exact zip file I downloaded from the website. Please let me know if you can help. Maybe I am missing something.
Here I am encountering problems with the TablePanel class
Java Code:import edu.neu.ccs.*; import edu.neu.ccs.gui.*; import edu.neu.ccs.codec.*; import edu.neu.ccs.console.*; import edu.neu.ccs.filter.*; import edu.neu.ccs.jpf.*; import edu.neu.ccs.parser.*; import edu.neu.ccs.pedagogy.*; import edu.neu.ccs.quick.*; import edu.neu.ccs.util.*; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.awt.font.*; import java.awt.image.*; import javax.swing.*; import javax.swing.border.*; import java.awt.Panel.*; import javax.swing.JComponent.*; import java.io.*; import java.util.*; import java.math.*; import java.beans.*; import java.lang.reflect.*; import java.net.URL; import java.util.regex.*; import java.text.ParseException; public class SudokuBase extends TablePanel { // Static definitions // /** The color of the border around the entire GUI. */ protected static final Color edgecolor = Colors.black; /** The tiny gap. */ protected static final int gaptiny = 2; /** The small gap. */ protected static final int gapsmall = 6; /** The medium gap. */ protected static final int gapmedium = 12; /** The large gap. */ protected static final int gaplarge = 18; // Member definitions // /** The model object. */ protected SudokuModel model = new SudokuModel(this); /** The table object. */ protected SudokuTable table = model.getSudokuTable(); /** The stack consisting of lists of frozen cells. */ protected Vector frozenstack = new Vector(); /** The action to compute and display hints in the view. */ protected final SimpleAction showHints = new SimpleAction("Show Hints") { public void perform() { showHints(); } }; /** The action to clear hints in the view. */ protected final SimpleAction clearHints = new SimpleAction("Clear Hints") { public void perform() { clearHints(); } }; /** The action to reset hints in the view. */ protected final SimpleAction resetHints = new SimpleAction("Reset Hints") { public void perform() { resetHints(); } }; /** The check box to select auto show hints. */ protected BooleanView autoShowHints = new BooleanView("Show Hints Automatically?", false); /** The IO stuff. */ protected Object[] hintsStuff = { showHints, clearHints, resetHints, autoShowHints }; /** The IO panel. */ protected TablePanel hintsPanel = new TablePanel (hintsStuff, VERTICAL, gapsmall, gapsmall, CENTER); /** The action to prune one cycle. */ protected final SimpleAction pruneOneCycle = new SimpleAction("Prune Once") { public void perform() { setSignal(pruneOneCycle()); showHints(); } }; /** The action to prune completely. */ protected final SimpleAction pruneComplete = new SimpleAction("Prune Repeatedly") { public void perform() { setSignal(pruneComplete()); showHints(); } }; /** The check box for the prune triplets algorithm. */ protected BooleanView pruneTriplets = new BooleanView("Prune Triplets?", false); /** The check box for the prune triplets algorithm. */ protected BooleanView pruneHintSets = new BooleanView("Prune Hint Sets?", false); /** The check box for the prune triplets algorithm. */ protected BooleanView pruneUniqueHints = new BooleanView("Prune Unique Hints?", false); /** The Prune Choice stuff. */ protected Object[] pruneChoiceStuff = { pruneTriplets, pruneHintSets, pruneUniqueHints }; /** The Prune Choice panel. */ protected TablePanel pruneChoicePanel = new TablePanel (pruneChoiceStuff, VERTICAL, gapsmall, gapsmall, WEST); /** The paint swatch to signal pruning. */ protected PaintSwatch swatch = new PaintSwatch(Colors.white); /** The signal stuff. */ protected Object[] signalStuff = { "Has Pruned?", swatch }; /** The signal table. */ protected TablePanel signalPanel = new TablePanel (signalStuff, HORIZONTAL, gapsmall, gapsmall, CENTER); /** The check box to select auto prune hints. */ protected BooleanView autoPruneHints = new BooleanView("Prune Hints Automatically?", false); /** The Prune stuff. */ protected Object[] pruneStuff = { pruneOneCycle, pruneComplete, pruneChoicePanel, signalPanel, autoPruneHints }; /** The Prune panel. */ protected TablePanel prunePanel = new TablePanel (pruneStuff, VERTICAL, gapsmall, gapsmall, CENTER); /** The freeze action. */ protected SimpleAction freeze = new SimpleAction("Freeze") { public void perform() { freeze(); } }; /** The thaw action. */ protected SimpleAction thaw = new SimpleAction("Thaw") { public void perform() { thaw(); } }; /** The thawAll action. */ protected SimpleAction thawAll = new SimpleAction("Thaw All") { public void perform() { thawAll(); } }; /** The freeze-thaw stuff. */ protected Object[] freezeStuff = { freeze, thaw, thawAll }; /** The freeze-thaw panel. */ protected TablePanel freezePanel = new TablePanel (freezeStuff, HORIZONTAL, gapsmall, gapsmall, CENTER); /** The action to remove back to the last freeze. */ protected final SimpleAction removeBackToLastFreeze = new SimpleAction("Remove Back To Last Freeze") { public void perform() { removeBackToLastFreeze(); } }; /** The action to empty the puzzle. */ protected final SimpleAction removeEverything = new SimpleAction("Remove Everything") { public void perform() { removeEverything(); } }; /** The controls stuff. */ protected Object[] controlsStuff = { hintsPanel, prunePanel, freezePanel, removeBackToLastFreeze, removeEverything }; /** The controls table. */ protected TablePanel controlsPanel = new TablePanel (controlsStuff, VERTICAL, gaplarge, gaplarge, CENTER); // Constructor // /** The constructor. */ public SudokuBase() { super(1, 2, gapmedium, gapmedium, NORTH); initializeSudokuBase(); } // Methods // /** The constructor initialize method. */ protected void initializeSudokuBase() { addObject(controlsPanel, 0, 0); addObject(table, 0, 1); createBorder(); } /** Create the border around the entire GUI. */ protected void createBorder() { int a = gaptiny; int b = gapmedium; Border inner = BorderFactory.createEmptyBorder(b, b, b, b); Border line = BorderFactory.createLineBorder(edgecolor, a); Border comp = BorderFactory.createCompoundBorder(line, inner); Border outer = BorderFactory.createEmptyBorder(b, b, b, b); Border full = BorderFactory.createCompoundBorder(outer, comp); setBorder(full); }
Here is where I am encountering errors with the TextPaintable class
Java Code:import edu.neu.ccs.*; import edu.neu.ccs.gui.*; import edu.neu.ccs.codec.*; import edu.neu.ccs.console.*; import edu.neu.ccs.filter.*; import edu.neu.ccs.jpf.*; import edu.neu.ccs.parser.*; import edu.neu.ccs.pedagogy.*; import edu.neu.ccs.quick.*; import edu.neu.ccs.util.*; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.awt.font.*; import java.awt.image.*; import javax.swing.*; import javax.swing.border.*; import java.io.*; import java.util.*; import java.math.*; import java.beans.*; import java.lang.reflect.*; import java.net.URL; import java.util.regex.*; import java.text.ParseException; public class SudokuBlock extends BufferedPanel { // Static definitions // /** The normal background color. */ private static final Color backcolor = Colors.bisque; /** The background color when the block is frozen */ private static final Color frozencolor = Colors.lightblue; /** The border color for a selected block. */ private static final Color bordercolor = Colors.red; /** The size of the box for the digits or hints. */ private static final int boxsize = 48; /** The stroke thickness for the selection rectangle. */ private static final int gapsize = 2; /** The size of the full cell. */ private static final int cellsize = boxsize + 4 * gapsize; /** The large font size for the regular digits. */ private static final int largefontsize = boxsize; /** The large font for the regular digits. */ private static final Font largefont = new Font("serif", Font.BOLD, largefontsize); /** The 9 regular digits as paintables. */ private static TextPaintable[] digits = new TextPaintable[10]; /** Initialization of the 9 regular digits as paintables. */ static { // find the height of a typical digit in the large font TextPaintable p = new TextPaintable ("0", largefont, Colors.black, TextBounds.TIGHT, TextAnchor.CENTER_BASELINE, 0, 0); Rectangle2D textbounds = p.getBounds2D(); int digitheight = (int) textbounds.getHeight(); // find the location of the center baseline for all digits int x = cellsize / 2; int y = (cellsize + digitheight) / 2; // create digits 1-9 // omit digit 0 since it will never be used for (int i = 1; i <= 9; i++) { digits[i] = new TextPaintable (i + "", largefont, Colors.black, TextBounds.TIGHT, TextAnchor.CENTER_BASELINE, x, y); } }
- 12-03-2009, 09:21 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Those aren't base java classes. If they haven't come with the code you downloaded then I have no idea what package they belong to. It doesn't help that whoever wrote this didn't import specific files, but simply imported whole packages, so you can't even find out which package they were supposed to belong to.
Similar Threads
-
Software caused connection abort: socket write error
By kuguy in forum NetworkingReplies: 3Last Post: 04-13-2010, 03:43 PM -
getting errors
By ravikumar in forum Threads and SynchronizationReplies: 3Last Post: 08-23-2009, 02:50 PM -
crash on freebsd eclipse 3.4.2 caused by evaluating divide-by-zero
By jmak in forum EclipseReplies: 2Last Post: 08-04-2009, 12:35 AM -
What is the difference between Semantic Errors and Logical Errors?
By tlau3128 in forum New To JavaReplies: 3Last Post: 03-08-2009, 01:51 AM -
ClientAbortException: java.net.SocketException:Software caused connection abort:
By m.arif in forum Java ServletReplies: 2Last Post: 01-15-2009, 09:01 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks