Swing error messages

I have written the follwing code and to the best on my understanding it's correct but for some reason the JButton object fails to show up on the JPanel(i'm not even 100% sure the panel is attached the JFrame). The error message i get is as follows:
Exception in thread "main" java.lang.Error: Do not use Mouse.add() use Mouse.get
ContentPane().add() instead
at javax.swing.JFrame.createRootPaneException(JFrame.java:465)
at javax.swing.JFrame.addImpl(JFrame.java:491)
at java.awt.Container.add(Container.java:307)
at Mouse.main(Mouse.java:31)
and here is the code.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Mouse extends JFrame
     public static void main(String[] args)
          JFrame jf = new Mouse();
          jf.setSize(300, 300);
          jf.setVisible(true);
          JPanel jp = new JPanel(new FlowLayout());
          JButton jb = new JButton("GO!");
          jb.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent e)
                    System.out.println("hello");
          jp.add(jb);
          jf.add(jp);
     // constructor
     public Mouse()
          super("MouseListener");
can anyone see anything wrong with it?

Hello,
Exception in thread "main" java.lang.Error: Do not use Mouse.add()
use Mouse.getContentPane().add() insteadAs clearly stated by the exception message, you should add the JPanel this way:
jf.getContentPane().setLayout(new BorderLayout());
jf.getContentPane().add(jp, BorderLayout.NORTH);I hope it helps.

Similar Messages

  • What's a good way to prompt a user with an error message etc. in swing?

    i want to be able to prompt the user within a given a function that i've created .. with some kind of warning message or error message .. or anything for that matter ..
    is there even a timer of some sort that i could use for the prompt .. say if im connecting and i want to prompt the user with a 'connecting ... ' message .. then close it when ive secured the connection? ...
    simple aesthetics i guess .. but a want indeed.

    For your first question, just use the static JOptionPane.showXXX methods.
    If you are making a connection in another thread, use the SwingUtilities.invokeLater (or in this case even invokeAndWait) method to close the dialog from the other thread.

  • How can I put all output error message into a String Variable ??

    Dear Sir:
    I have following code, When I run it and I press overflow radio button, It outputs following message:
    Caught RuntimeException: java.lang.NullPointerException
    java.lang.NullPointerException
         at ExceptionHandling.ExceptTest.actionPerformed(ExceptTest.java:72)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6038)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)Caught RuntimeException: java.lang.NullPointerException
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)I hope to catch all these error message into a String Variable such as StrErrorMsg, then I can use System.out.println(StrErrorMsg) to print it out or store somewhere, not only display at runtime,
    How can I do this??
    Thanks a lot,
    See code below.
    import java.awt.Frame;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.FileInputStream;
    import javax.swing.ButtonGroup;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    public class ExceptTest extends JFrame implements ActionListener {
        private double[] a;
      private JRadioButton divideByZeroButton;
      private JRadioButton badCastButton;
      private JRadioButton arrayBoundsButton;
      private JRadioButton nullPointerButton;
      private JRadioButton negSqrtButton;
      private JRadioButton overflowButton;
      private JRadioButton noSuchFileButton;
      private JRadioButton throwUnknownButton;
      public ExceptTest() {
        JPanel p = new JPanel();
        ButtonGroup g = new ButtonGroup();
        p.setLayout(new GridLayout(8, 1));
        divideByZeroButton = addRadioButton("Divide by zero", g, p);
        badCastButton = addRadioButton("Bad cast", g, p);
        arrayBoundsButton = addRadioButton("Array bounds", g, p);
        nullPointerButton = addRadioButton("Null pointer", g, p);
        negSqrtButton = addRadioButton("sqrt(-1)", g, p);
        overflowButton = addRadioButton("Overflow", g, p);
        noSuchFileButton = addRadioButton("No such file", g, p);
        throwUnknownButton = addRadioButton("Throw unknown", g, p);
        getContentPane().add(p);
      private JRadioButton addRadioButton(String s, ButtonGroup g, JPanel p) {
        JRadioButton button = new JRadioButton(s, false);
        button.addActionListener(this);
        g.add(button);
        p.add(button);
        return button;
      public void actionPerformed(ActionEvent evt) {
        try {
          Object source = evt.getSource();
          if (source == divideByZeroButton) {
            a[1] = a[1] / a[1] - a[1];
          } else if (source == badCastButton) {
            Frame f = (Frame) evt.getSource();
          } else if (source == arrayBoundsButton) {
            a[1] = a[10];
          } else if (source == nullPointerButton) {
            Frame f = null;
            f.setSize(200, 200);
          } else if (source == negSqrtButton) {
            a[1] = Math.sqrt(-1);
          } else if (source == overflowButton) {
            a[1] = 1000 * 1000 * 1000 * 1000;
            int n = (int) a[1];
          } else if (source == noSuchFileButton) {
            FileInputStream is = new FileInputStream("Java Source and Support");
          } else if (source == throwUnknownButton) {
            throw new UnknownError();
        } catch (RuntimeException e) {
          System.out.println("Caught RuntimeException: " + e);
          e.printStackTrace();
          System.out.println("Caught RuntimeException: " + e);
        } catch (Exception e) {
          System.out.println("Caught Exception: " + e);
      public static void main(String[] args) {
        JFrame frame = new ExceptTest();
        frame.setSize(150, 200);
        frame.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
        frame.show();
    }

    yes, I update as follows,
    but not looks good.
    import java.io.*;
    public class UncaughtLogger implements Thread.UncaughtExceptionHandler {
        private File file;
        private static String errorMessage;
        public UncaughtLogger(File file) {
            this.file = file;
            //Thread.setDefaultUncaughtExceptionHandler(this);
        public UncaughtLogger(String str) {
            this.errorMessage = str;
            Thread.setDefaultUncaughtExceptionHandler(this);
        //@Override()
        public void uncaughtException(Thread t, Throwable e){
            try {
                log(e);
            } catch (Throwable throwable) {
                System.err.println("error in logging:");
                throwable.printStackTrace();
        private void log(Throwable e) throws IOException {
            PrintWriter out = new PrintWriter(new FileWriter(file, true));
            try {
                e.printStackTrace(out);
            } finally {
                out.close();
        private static UncaughtLogger logger = new UncaughtLogger(new File("C:/temp/log.txt"));
        private static UncaughtLogger logger2 = new UncaughtLogger(errorMessage);
        public static void main(String[] args) {
                String s1 = "Hello World!";
                s1 = null;
                String s2 = s1.getClass().getName();
                System.out.println(s1);
                System.out.println(s2);
                System.out.println("errorMessage =" + errorMessage);
    }

  • "Class Circle not found in TryBouncingBalls" error message. Help !

    Dear People,
    I have an error message :
    "TryBouncingBalls.java": Error : class Circle not found in class stan_bluej_ch5_p135.TryBouncingBalls at line 67, "
    Circle circle = new Circle(xPos + 130, 30);
    below are the classes TryBouncingBalls, BouncingBall, BallDemo, Canvas
    Thank you in advance
    Stan
    package stan_bluej_ch5_p135;
    import java.awt.*;
    import java.awt.geom.*;
    public class TryBouncingBalls
    public static void main(String[] args)
    Canvas myCanvas = new Canvas("Creativity at its best");
    myCanvas.setVisible(true);
    BouncingBall ball = new BouncingBall(50,50,16, Color.red, 500, myCanvas);
    BouncingBall ball2 = new BouncingBall(70,80,20, Color.green, 500, myCanvas);
    BouncingBall ball3 = new BouncingBall(90,100,16, Color.red, 500, myCanvas);
    BouncingBall ball4 = new BouncingBall(30,30,20, Color.green, 500, myCanvas);
    ball.draw();
    ball2.draw();
    ball.draw();
    ball2.draw();
    // make them bounce
    boolean finished = false;
    while(!finished) {
    myCanvas.wait(50); // small delay
    ball.move();
    ball2.move();
    ball3.move();
    ball4.move();
    // stop once ball has travelled a certain distance on x axis
    if(ball.getXPosition() >= 550 && ball2.getXPosition() >= 550)
    finished = true;
    myCanvas.setFont(new Font("helvetica", Font.BOLD, 14));
    myCanvas.setForegroundColor(Color.red);
    myCanvas.drawString("We are having fun, ...\n\n", 20, 30);
    myCanvas.wait(1000);
    myCanvas.setForegroundColor(Color.black);
    myCanvas.drawString("...drawing lines...", 60, 60);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.gray);
    myCanvas.drawLine(200, 20, 300, 50);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.blue);
    myCanvas.drawLine(220, 100, 370, 40);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.green);
    myCanvas.drawLine(290, 10, 320, 120);
    myCanvas.wait(1000);
    myCanvas.setForegroundColor(Color.gray);
    myCanvas.drawString("...and shapes!", 110, 90);
    myCanvas.setForegroundColor(Color.red);
    myCanvas.drawString("to bring to focus creative ideas !", 310, 290);
    // the shape to draw and move
    int xPos = 10;
    Rectangle rect = new Rectangle(xPos + 40, 150, 30, 20);
    Rectangle rect2 = new Rectangle(xPos + 80, 120, 50, 25);
    Rectangle rect3 = new Rectangle(xPos+ 1200, 180, 30, 30);
    Rectangle rect4 = new Rectangle(xPos + 150, 220, 40, 15);
    myCanvas.fill(rect);
    myCanvas.fill(rect2);
    myCanvas.fill(rect3);
    myCanvas.fill(rect4);
    Circle circle = new Circle(xPos + 130, 30);
    // Circle circle2 = new Circle(xPos + 150, 50);
    // Circle circle3 = new Circle(xPos + 170, 30);
    // Circle circle4 = new Circle(xPos + 200, 40);
    // myCanvas.fill(circle);
    // myCanvas.fill(circle2);
    // myCanvas.fill(circle3);
    // myCanvas.fill(circle4);
    // move the rectangle and circles across the screen
    for(int i = 0; i < 200; i ++) {
    myCanvas.fill(rect);
    myCanvas.fill(rect2);
    myCanvas.fill(rect3);
    myCanvas.fill(rect4);
    myCanvas.wait(10);
    myCanvas.erase(rect);
    myCanvas.erase(rect2);
    myCanvas.erase(rect3);
    myCanvas.erase(rect4);
    xPos++;
    rect.setLocation(xPos, 150);
    rect2.setLocation(xPos, 120);
    rect3.setLocation(xPos, 180);
    rect4.setLocation(xPos, 220);
    // at the end of the move, draw once more so that it remains visible
    myCanvas.fill(rect);
    myCanvas.fill(rect2);
    myCanvas.fill(rect3);
    myCanvas.fill(rect4);
    package stan_bluej_ch5_p135;
    import java.awt.*;
    import java.awt.geom.*;
    * Class BouncingBall - a graphical ball that observes the effect of gravity. The ball
    * has the ability to move. Details of movement are determined by the ball itself. It
    * will fall downwards, accelerating with time due to the effect of gravity, and bounce
    * upward again when hitting the ground.
    * This movement can be initiated by repeated calls to the "move" method.
    * @author Bruce Quig
    * @author Michael Kolling (mik)
    * @author David J. Barnes
    * @version 1.1 (23-Jan-2002)
    public class BouncingBall
    private static final int gravity = 3; // effect of gravity
    private int ballDegradation = 2;
    private Ellipse2D.Double circle;
    private Color color;
    private int diameter;
    private int xPosition;
    private int yPosition;
    private final int groundPosition; // y position of ground
    private Canvas canvas;
    private int ySpeed = 1; // initial downward speed
    * Constructor for objects of class BouncingBall
    * @param xPos the horizontal coordinate of the ball
    * @param yPos the vertical coordinate of the ball
    * @param ballDiameter the diameter (in pixels) of the ball
    * @param ballColor the color of the ball
    * @param groundPos the position of the ground (where the wall will bounce)
    * @param drawingCanvas the canvas to draw this ball on
    public BouncingBall(int xPos, int yPos, int ballDiameter, Color ballColor,
    int groundPos, Canvas drawingCanvas)
    xPosition = xPos;
    yPosition = yPos;
    color = ballColor;
    diameter = ballDiameter;
    groundPosition = groundPos;
    canvas = drawingCanvas;
    * Draw this ball at its current position onto the canvas.
    public void draw()
    canvas.setForegroundColor(color);
    canvas.fillCircle(xPosition, yPosition, diameter);
    * Erase this ball at its current position.
    public void erase()
    canvas.eraseCircle(xPosition, yPosition, diameter);
    * Move this ball according to its position and speed and redraw.
    public void move()
    // remove from canvas at the current position
    erase();
    // compute new position
    ySpeed += gravity;
    yPosition += ySpeed;
    xPosition +=2;
    // check if it has hit the ground
    if(yPosition >= (groundPosition - diameter) && ySpeed > 0) {
    yPosition = (int)(groundPosition - diameter);
    ySpeed = -ySpeed + ballDegradation;
    // draw again at new position
    draw();
    * return the horizontal position of this ball
    public int getXPosition()
    return xPosition;
    * return the vertical position of this ball
    public int getYPosition()
    return yPosition;
    package stan_bluej_ch5_p135;
    import java.awt.*;
    import java.awt.geom.*;
    * Class BallDemo - provides two short demonstrations showing how to use the
    * Canvas class.
    * @author Michael Kolling and David J. Barnes
    * @version 1.0 (23-Jan-2002)
    public class BallDemo
    private Canvas myCanvas;
    * Create a BallDemo object. Creates a fresh canvas and makes it visible.
    public BallDemo()
    myCanvas = new Canvas("Ball Demo", 600, 500);
    myCanvas.setVisible(true);
    * This method demonstrates some of the drawing operations that are
    * available on a Canvas object.
    public void drawDemo()
    myCanvas.setFont(new Font("helvetica", Font.BOLD, 14));
    myCanvas.setForegroundColor(Color.red);
    myCanvas.drawString("We can draw text, ...", 20, 30);
    myCanvas.wait(1000);
    myCanvas.setForegroundColor(Color.black);
    myCanvas.drawString("...draw lines...", 60, 60);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.gray);
    myCanvas.drawLine(200, 20, 300, 50);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.blue);
    myCanvas.drawLine(220, 100, 370, 40);
    myCanvas.wait(500);
    myCanvas.setForegroundColor(Color.green);
    myCanvas.drawLine(290, 10, 320, 120);
    myCanvas.wait(1000);
    myCanvas.setForegroundColor(Color.gray);
    myCanvas.drawString("...and shapes!", 110, 90);
    myCanvas.setForegroundColor(Color.red);
    // the shape to draw and move
    int xPos = 10;
    Rectangle rect = new Rectangle(xPos, 150, 30, 20);
    // move the rectangle across the screen
    for(int i = 0; i < 200; i ++) {
    myCanvas.fill(rect);
    myCanvas.wait(10);
    myCanvas.erase(rect);
    xPos++;
    rect.setLocation(xPos, 150);
    // at the end of the move, draw once more so that it remains visible
    myCanvas.fill(rect);
    * Simulates two bouncing balls
    public void bounce()
    int ground = 400; // position of the ground line
    myCanvas.setVisible(true);
    // draw the ground
    myCanvas.drawLine(50, ground, 550, ground);
    // crate and show the balls
    BouncingBall ball = new BouncingBall(50, 50, 16, Color.blue, ground, myCanvas);
    ball.draw();
    BouncingBall ball2 = new BouncingBall(70, 80, 20, Color.red, ground, myCanvas);
    ball2.draw();
    // make them bounce
    boolean finished = false;
    while(!finished) {
    myCanvas.wait(50); // small delay
    ball.move();
    ball2.move();
    // stop once ball has travelled a certain distance on x axis
    if(ball.getXPosition() >= 550 && ball2.getXPosition() >= 550)
    finished = true;
    ball.erase();
    ball2.erase();
    package stan_bluej_ch5_p135;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.geom.*;
    * Class Canvas - a class to allow for simple graphical
    * drawing on a canvas.
    * @author Michael Kolling (mik)
    * @author Bruce Quig
    * @version 1.8 (23.01.2002)
    public class Canvas
    private JFrame frame;
    private CanvasPane canvas;
    private Graphics2D graphic;
    private Color backgroundColor;
    private Image canvasImage;
    * Create a Canvas with default height, width and background color
    * (300, 300, white).
    * @param title title to appear in Canvas Frame
    public Canvas(String title)
    this(title, 600, 600, Color.white);
    * Create a Canvas with default background color (white).
    * @param title title to appear in Canvas Frame
    * @param width the desired width for the canvas
    * @param height the desired height for the canvas
    public Canvas(String title, int width, int height)
    this(title, width, height, Color.white);
    * Create a Canvas.
    * @param title title to appear in Canvas Frame
    * @param width the desired width for the canvas
    * @param height the desired height for the canvas
    * @param bgClour the desired background color of the canvas
    public Canvas(String title, int width, int height, Color bgColor)
    frame = new JFrame();
    canvas = new CanvasPane();
    frame.setContentPane(canvas);
    frame.setTitle(title);
    canvas.setPreferredSize(new Dimension(width, height));
    backgroundColor = bgColor;
    frame.pack();
    * Set the canvas visibility and brings canvas to the front of screen
    * when made visible. This method can also be used to bring an already
    * visible canvas to the front of other windows.
    * @param visible boolean value representing the desired visibility of
    * the canvas (true or false)
    public void setVisible(boolean visible)
    if(graphic == null) {
    // first time: instantiate the offscreen image and fill it with
    // the background color
    Dimension size = canvas.getSize();
    canvasImage = canvas.createImage(size.width, size.height);
    graphic = (Graphics2D)canvasImage.getGraphics();
    graphic.setColor(backgroundColor);
    graphic.fillRect(0, 0, size.width, size.height);
    graphic.setColor(Color.black);
    frame.show();
    * Provide information on visibility of the Canvas.
    * @return true if canvas is visible, false otherwise
    public boolean isVisible()
    return frame.isVisible();
    * Draw the outline of a given shape onto the canvas.
    * @param shape the shape object to be drawn on the canvas
    public void draw(Shape shape)
    graphic.draw(shape);
    canvas.repaint();
    * Fill the internal dimensions of a given shape with the current
    * foreground color of the canvas.
    * @param shape the shape object to be filled
    public void fill(Shape shape)
    graphic.fill(shape);
    canvas.repaint();
    * Fill the internal dimensions of the given circle with the current
    * foreground color of the canvas.
    public void fillCircle(int xPos, int yPos, int diameter)
    Ellipse2D.Double circle = new Ellipse2D.Double(xPos, yPos, diameter, diameter);
    fill(circle);
    * Fill the internal dimensions of the given rectangle with the current
    * foreground color of the canvas. This is a convenience method. A similar
    * effect can be achieved with the "fill" method.
    public void fillRectangle(int xPos, int yPos, int width, int height)
    fill(new Rectangle(xPos, yPos, width, height));
    * Erase the whole canvas.
    public void erase()
    Color original = graphic.getColor();
    graphic.setColor(backgroundColor);
    Dimension size = canvas.getSize();
    graphic.fill(new Rectangle(0, 0, size.width, size.height));
    graphic.setColor(original);
    canvas.repaint();
    * Erase the internal dimensions of the given circle. This is a
    * convenience method. A similar effect can be achieved with
    * the "erase" method.
    public void eraseCircle(int xPos, int yPos, int diameter)
    Ellipse2D.Double circle = new Ellipse2D.Double(xPos, yPos, diameter, diameter);
    erase(circle);
    * Erase the internal dimensions of the given rectangle. This is a
    * convenience method. A similar effect can be achieved with
    * the "erase" method.
    public void eraseRectangle(int xPos, int yPos, int width, int height)
    erase(new Rectangle(xPos, yPos, width, height));
    * Erase a given shape's interior on the screen.
    * @param shape the shape object to be erased
    public void erase(Shape shape)
    Color original = graphic.getColor();
    graphic.setColor(backgroundColor);
    graphic.fill(shape); // erase by filling background color
    graphic.setColor(original);
    canvas.repaint();
    * Erases a given shape's outline on the screen.
    * @param shape the shape object to be erased
    public void eraseOutline(Shape shape)
    Color original = graphic.getColor();
    graphic.setColor(backgroundColor);
    graphic.draw(shape); // erase by drawing background color
    graphic.setColor(original);
    canvas.repaint();
    * Draws an image onto the canvas.
    * @param image the Image object to be displayed
    * @param x x co-ordinate for Image placement
    * @param y y co-ordinate for Image placement
    * @return returns boolean value representing whether the image was
    * completely loaded
    public boolean drawImage(Image image, int x, int y)
    boolean result = graphic.drawImage(image, x, y, null);
    canvas.repaint();
    return result;
    * Draws a String on the Canvas.
    * @param text the String to be displayed
    * @param x x co-ordinate for text placement
    * @param y y co-ordinate for text placement
    public void drawString(String text, int x, int y)
    graphic.drawString(text, x, y);
    canvas.repaint();
    * Erases a String on the Canvas.
    * @param text the String to be displayed
    * @param x x co-ordinate for text placement
    * @param y y co-ordinate for text placement
    public void eraseString(String text, int x, int y)
    Color original = graphic.getColor();
    graphic.setColor(backgroundColor);
    graphic.drawString(text, x, y);
    graphic.setColor(original);
    canvas.repaint();
    * Draws a line on the Canvas.
    * @param x1 x co-ordinate of start of line
    * @param y1 y co-ordinate of start of line
    * @param x2 x co-ordinate of end of line
    * @param y2 y co-ordinate of end of line
    public void drawLine(int x1, int y1, int x2, int y2)
    graphic.drawLine(x1, y1, x2, y2);
    canvas.repaint();
    * Sets the foreground color of the Canvas.
    * @param newColor the new color for the foreground of the Canvas
    public void setForegroundColor(Color blue)
    graphic.setColor(Color.blue);
    * Returns the current color of the foreground.
    * @return the color of the foreground of the Canvas
    public Color getForegroundColor()
    return graphic.getColor();
    * Sets the background color of the Canvas.
    * @param newColor the new color for the background of the Canvas
    public void setBackgroundColor(Color newColor)
    backgroundColor = newColor;
    graphic.setBackground(newColor);
    * Returns the current color of the background
    * @return the color of the background of the Canvas
    public Color getBackgroundColor()
    return backgroundColor;
    * changes the current Font used on the Canvas
    * @param newFont new font to be used for String output
    public void setFont(Font newFont)
    graphic.setFont(newFont);
    * Returns the current font of the canvas.
    * @return the font currently in use
    public Font getFont()
    return graphic.getFont();
    * Sets the size of the canvas.
    * @param width new width
    * @param height new height
    public void setSize(int width, int height)
    canvas.setPreferredSize(new Dimension(width, height));
    Image oldImage = canvasImage;
    canvasImage = canvas.createImage(width, height);
    graphic = (Graphics2D)canvasImage.getGraphics();
    graphic.drawImage(oldImage, 0, 0, null);
    frame.pack();
    * Returns the size of the canvas.
    * @return The current dimension of the canvas
    public Dimension getSize()
    return canvas.getSize();
    * Waits for a specified number of milliseconds before finishing.
    * This provides an easy way to specify a small delay which can be
    * used when producing animations.
    * @param milliseconds the number
    public void wait(int milliseconds)
    try
    Thread.sleep(milliseconds);
    catch (InterruptedException e)
    // ignoring exception at the moment
    * Nested class CanvasPane - the actual canvas component contained in the
    * Canvas frame. This is essentially a JPanel with added capability to
    * refresh the image drawn on it.
    private class CanvasPane extends JPanel
    public void paint(Graphics g)
    g.drawImage(canvasImage, 0, 0, null);

    Dear Miciuli,
    I found the definition for the circle in the canvas class and used it to creates circles ! Thank you for jaring my brain into thinking !
    Stan
    Ellipse2D.Double circle = new Ellipse2D.Double(xPos, 70, 30 , 30);

  • Why do I get an error message that says "Incompatible Types"?

    I am a newbie to Java programming. I have experience with VB.
    I am using Net Beans 6.1. I was following a sample program that shows me how to use the JDBC ODBC bridge to connect to an MS-Access file.
    I get an error message at this line:
    statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    statement was declared earlier with:
    private Connection connection;
    private Statement statement;
    private ResultSet resultSet;
    Here are my imports:
    import accessingmsdb.Page1;
    import java.beans.Statement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.text.html.Option;
    import java.lang.String;
    I am also getting erros on the following 2 lines (these follow the first statement above):
    statement.execute(query);
    resultSet = statement.getResultSet();
    The site that has the sample does not have a forum. Any assistance you can provide would be appreciated.
    Edited by: Matt_in_MI on Aug 20, 2008 1:36 PM
    Edited by: Matt_in_MI on Aug 20, 2008 1:39 PM

    statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);Probably because that driver doesn't allow you to use the mix of the two parameters that you passed.

  • Error message when inserting table into JSP

    I am using JDEV 10.1.3.3 and am getting the following error message when I try to create a table in a form on a jsp:
    "Could not complete get pdusage from application because it would result in an invalid document".
    Here is the stack trace:
    oracle.bali.xml.model.XmlReadOnlyException: read-only on commit
         at oracle.bali.xml.model.XmlModel.__precommitTransaction(XmlModel.java:2676)
         at oracle.bali.xml.model.XmlContext.__precommitTransaction(XmlContext.java:1519)
         at oracle.bali.xml.model.XmlContext.__commitTransaction(XmlContext.java:1549)
         at oracle.bali.xml.model.XmlModel.__requestCommitTransaction(XmlModel.java:2717)
         at oracle.bali.xml.model.XmlModel.commitTransaction(XmlModel.java:575)
         at oracle.bali.xml.model.XmlModel.commitTransaction(XmlModel.java:555)
         at oracle.bali.xml.model.task.StandardTransactionTask.__commitWrapperTransaction(StandardTransactionTask.java:413)
         at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:203)
         at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
         at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
         at oracle.adfdt.view.common.binding.provider.ADFBaseProvider.<init>(ADFBaseProvider.java:34)
         at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.<init>(ADFIteratorModelProvider.java:46)
         at oracle.adfdtinternal.view.faces.binding.provider.ADFCustomTableModelProviderFactory.createModelProvider(ADFCustomTableModelProviderFactory.java:64)
         at oracle.adfdtinternal.view.common.binding.datatransfer.ADFBindingsProviderInfo.getData(ADFBindingsProviderInfo.java:40)
         at oracle.adfdtinternal.view.common.binding.datatransfer.BaseADFDataInfo.getData(BaseADFDataInfo.java:35)
         at oracle.adfdt.view.common.binding.utils.ADFBindingUtils.getTransferData(ADFBindingUtils.java:1087)
         at oracle.adfdt.view.common.binding.utils.ADFBindingUtils.getTransferModelProvider(ADFBindingUtils.java:1111)
         at oracle.adfdtinternal.view.common.binding.datatransfer.ADFDocumentFragmentCreatorInfo.createDocumentFragment(ADFDocumentFragmentCreatorInfo.java:63)
         at oracle.adfdtinternal.view.common.binding.operation.CreateOperation.apply(CreateOperation.java:96)
         at oracle.bali.xml.model.datatransfer.operation.PerformOperationAction.actionPerformed(PerformOperationAction.java:39)
         at oracle.bali.xml.share.ActionProxy.actionPerformed(ActionProxy.java:47)
         at oracle.bali.xml.gui.swing.dnd.DropMenuInvoker$CleanupProxy.actionPerformed(DropMenuInvoker.java:235)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

    Hi,
    obviously you try to drag and drop a component to a place where it breaks the document. Make sure the table is added to the JSP body. Have a look at the page sources for existing syntax problems - e.g. missing close elemenents or misplaced elements
    Frank

  • "Class can't be instantiated " error message. Help !

    Dear Java People,
    In trying to do a program that outputs a sound with every button click
    I have no compilation errors but a runtime error that says:
    "class can't be instantiated"
    below is the program and below that the error message
    thank you in advance
    Norman
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    public abstract class MyMusicApplet_1 extends JApplet implements ActionListener, AppletContext
         //AppletContext myAppletContext =   new AppletContext();
         //Iterator i =   myAppletContext.getStreamKeys();
         JButton myJButton;
         AudioClip acSound_1;
         AudioClip acSound_2;
         AudioClip acSound_3;
         AudioClip acSound_4;
         AudioClip acSound_5;
         AudioClip acSound_6;
         AudioClip acSound_7;
         AudioClip acSound_8;
         AudioClip acSound_9;
         JButton myJButtonSound1;
         JButton myJButtonSound2;
         JButton myJButtonSound3;
         JButton myJButtonSound4;
         JButton myJButtonSound5;
         JButton myJButtonSound6;
         JButton myJButtonSound7;
         JButton myJButtonSound8;
         JButton myJButtonSound9;
      public void init()
            try
             acSound_1 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_2 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_3 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_4 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_5 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_6 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_7 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_8 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_9 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             catch (MalformedURLException e)
               System.out.println("Error here " );
           Container myContentPane = getContentPane();
           myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            Dimension buttonSize = new Dimension(190,100);
           Font myFont = new Font("Arial", Font.BOLD,14);
           Border myEdge = BorderFactory.createRaisedBevelBorder();
                    //create 1st button's object
                     myJButtonSound1 = new JButton("sound #1");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound1.setBorder(myEdge);
                   myJButtonSound1.setPreferredSize(buttonSize);
                   myJButtonSound1.setFont(myFont);
                   myJButtonSound1.setBackground(Color.orange);
                   myJButtonSound1.setForeground(Color.black);
                    //create 2nd button's object
                     myJButtonSound2 = new JButton("sound #2");
                    myJButtonSound2.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound2.setBorder(myEdge);
                   myJButtonSound2.setPreferredSize(buttonSize);
                   myJButtonSound2.setFont(myFont);
                   myJButtonSound2.setBackground(Color.blue);
                   myJButtonSound2.setForeground(Color.black);
                    //create 3rd button's object
                     myJButtonSound3 = new JButton("sound #3");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound3.setBorder(myEdge);
                   myJButtonSound3.setPreferredSize(buttonSize);
                   myJButtonSound3.setFont(myFont);
                   myJButtonSound3.setBackground(Color.cyan);
                   myJButtonSound3.setForeground(Color.black);
                    //create 4th button's object
                     myJButtonSound4 = new JButton("sound #4");
                    myJButtonSound4.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound4.setBorder(myEdge);
                   myJButtonSound4.setPreferredSize(buttonSize);
                   myJButtonSound4.setFont(myFont);
                   myJButtonSound4.setBackground(Color.pink);
                   myJButtonSound4.setForeground(Color.black);
                   //create 5th button's object
                   myJButtonSound5 = new JButton("sound #5");
                  myJButtonSound5.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound5.setBorder(myEdge);
                 myJButtonSound5.setPreferredSize(buttonSize);
                 myJButtonSound5.setFont(myFont);
                 myJButtonSound5.setBackground(Color.red);
                 myJButtonSound5.setForeground(Color.black);
                  //create 6th button's object
                   myJButtonSound6 = new JButton("sound #6");
                  myJButtonSound6.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound6.setBorder(myEdge);
                 myJButtonSound6.setPreferredSize(buttonSize);
                 myJButtonSound6.setFont(myFont);
                 myJButtonSound6.setBackground(Color.pink);
                 myJButtonSound6.setForeground(Color.black);
                  //create 7th button's object
                   myJButtonSound7 = new JButton("Choice #7");
                  myJButtonSound7.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound7.setBorder(myEdge);
                 myJButtonSound7.setPreferredSize(buttonSize);
                 myJButtonSound7.setFont(myFont);
                 myJButtonSound7.setBackground(Color.cyan);
                 myJButtonSound7.setForeground(Color.black);
                  //create 8th button's object
                   myJButtonSound8 = new JButton("Choice #8");
                  myJButtonSound8.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound8.setBorder(myEdge);
                 myJButtonSound8.setPreferredSize(buttonSize);
                 myJButtonSound8.setFont(myFont);
                 myJButtonSound8.setBackground(Color.yellow);
                 myJButtonSound8.setForeground(Color.black);
                  //create 9th button's object
                   myJButtonSound9 = new JButton("Choice #9");
                  myJButtonSound9.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound9.setBorder(myEdge);
                 myJButtonSound9.setPreferredSize(buttonSize);
                 myJButtonSound9.setFont(myFont);
                 myJButtonSound9.setBackground(Color.blue);
                 myJButtonSound9.setForeground(Color.black);
                   //add the buttons to the content pane
                   myContentPane.add(myJButtonSound1);
                   myContentPane.add(myJButtonSound2);
                   myContentPane.add(myJButtonSound3);
                   myContentPane.add(myJButtonSound4);
                   myContentPane.add(myJButtonSound5);
                   myContentPane.add(myJButtonSound6);
                   myContentPane.add(myJButtonSound7);
                   myContentPane.add(myJButtonSound8);
                   myContentPane.add(myJButtonSound9);
          public void actionPerformed(ActionEvent e)
             myJButton = (JButton)e.getSource();
            if(myJButton == myJButtonSound1)
              acSound_1.play();
            if(myJButton == myJButtonSound2)
              acSound_2.play();
            if(myJButton == myJButtonSound3)
              acSound_3.play();
            if(myJButton == myJButtonSound4)
              acSound_4.play();
            if(myJButton == myJButtonSound5)
              acSound_5.play();
             if(myJButton == myJButtonSound6)
               acSound_6.play();
                       if(myJButton == myJButtonSound7)
                         acSound_7.play();
                       if(myJButton == myJButtonSound8)
                         acSound_8.play();
                        if(myJButton == myJButtonSound9)
                          acSound_9.play();
    java.lang.InstantiationException
         at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    load: stan_my_music_applet_1.MyMusicApplet_1.class can't be instantiated.
         at java.lang.Class.newInstance0(Class.java:306)
         at java.lang.Class.newInstance(Class.java:259)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
         at sun.applet.AppletPanel.run(AppletPanel.java:292)
         at java.lang.Thread.run(Thread.java:536)

    I also tried:
    try
    for(int a=0;a<8;a++)
    {acSounds[a] = getAudioClip(getCodeBase(),(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore" + (i + 1) + ".wrk")));
    and the error message still says:
    "MyMusicApplet3.java": Error #: 300 : method getAudioClip(java.net.URL, java.net.URL) not found in class stan_my_music_applet_3.MyMusicApplet3 at line 19
    Help !
    below is the revised code
    Norman
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    public class MyMusicApplet3 extends JApplet implements ActionListener
      AudioClip[] acSounds= new AudioClip[9];
      public void init()
       try
            for(int a=0;a<8;a++)
            {acSounds[a] = getAudioClip(getCodeBase(),(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore" + (a + 1) + ".wrk")));
      catch (Exception e)
        System.out.println("Error here " );
            Container myContentPane = getContentPane();
            myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            myContentPane.add(getButton("1", Color.orange));
            myContentPane.add(getButton("2", Color.blue));
            myContentPane.add(getButton("3", Color.cyan));
            myContentPane.add(getButton("4", Color.pink));
            myContentPane.add(getButton("5", Color.red));
            myContentPane.add(getButton("6", Color.pink));
            myContentPane.add(getButton("7", Color.cyan));
            myContentPane.add(getButton("8", Color.yellow));
            myContentPane.add(getButton("9", Color.blue));
        public void actionPerformed(ActionEvent e)
           String command = e.getActionCommand();
           int index = Integer.parseInt(command)-1;
           acSounds[index].play();
       public JButton getButton(String label, Color fore)
         {          JButton button = new JButton("sound "+label);
                    button.setPreferredSize(new Dimension(190,100));
                    button.setFont(new Font("Arial", Font.BOLD,14));
                    button.setBorder(BorderFactory.createRaisedBevelBorder());
                    button.setForeground(fore);
                    button.setBackground(Color.orange);
                    button.addActionListener(this);
                    button.setActionCommand(label);
                    return button;
          }//"MyMusicApplet3.java": Error #: 300 :
    //method getAudioClip(java.net.URL, java.net.URL) not found in class
    // stan_my_music_applet_3.MyMusicApplet3 at line 19, column 24

  • New to Java and need help with error message!

    I have just installed the oracle jdbc driver and am now getting the following error message when trying to use the jbdc driver instead of the jdbc:odbc wrap driver...
    See com.borland.dx.dataset.DataSetException error code: BASE+47
    com.borland.dx.dataset.DataSetException: Chain of 2 or more Exceptions occurred
         at com.borland.dx.dataset.DataSetException.a(Unknown Source)
         at com.borland.dx.dataset.DataSetException.throwExceptionChain(Unknown Source)
         at com.borland.dx.sql.dataset.q.a(Unknown Source)
         at com.borland.dx.sql.dataset.Database.openConnection(Unknown Source)
         at com.borland.dx.sql.dataset.Database.createPreparedStatement(Unknown Source)
         at com.borland.dx.sql.dataset.o.a(Unknown Source)
         at com.borland.dx.sql.dataset.o.d(Unknown Source)
         at com.borland.dx.sql.dataset.o.f(Unknown Source)
         at com.borland.dx.sql.dataset.QueryProvider.e(Unknown Source)
         at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
         at com.borland.dx.dataset.StorageDataSet.a(Unknown Source)
         at com.borland.dx.dataset.DataSet.a(Unknown Source)
         at com.borland.dx.dataset.DataSet.open(Unknown Source)
         at com.borland.dbswing.JdbTable.bindDataSet(JdbTable.java:2749)
         at com.borland.dbswing.JdbTable.setDataSet(JdbTable.java:819)
         at myframes.ClaimView.btnSQL_actionPerformed(ClaimView.java:279)
         at myframes.ClaimView_btnSQL_actionAdapter.actionPerformed(ClaimView.java:440)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    Chained exception:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at com.borland.dx.sql.dataset.q.a(Unknown Source)
         at com.borland.dx.sql.dataset.Database.openConnection(Unknown Source)
         at com.borland.dx.sql.dataset.Database.createPreparedStatement(Unknown Source)
         at com.borland.dx.sql.dataset.o.a(Unknown Source)
         at com.borland.dx.sql.dataset.o.d(Unknown Source)
         at com.borland.dx.sql.dataset.o.f(Unknown Source)
         at com.borland.dx.sql.dataset.QueryProvider.e(Unknown Source)
         at com.borland.dx.sql.dataset.JdbcProvider.provideData(Unknown Source)
         at com.borland.dx.dataset.StorageDataSet.a(Unknown Source)
         at com.borland.dx.dataset.DataSet.a(Unknown Source)
         at com.borland.dx.dataset.DataSet.open(Unknown Source)
         at com.borland.dbswing.JdbTable.bindDataSet(JdbTable.java:2749)
         at com.borland.dbswing.JdbTable.setDataSet(JdbTable.java:819)
         at myframes.ClaimView.btnSQL_actionPerformed(ClaimView.java:279)
         at myframes.ClaimView_btnSQL_actionAdapter.actionPerformed(ClaimView.java:440)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    Here is the code causeing the error;
    void btnSQL_actionPerformed(ActionEvent e)
    try
    String GET_DATASET = txtSQL.getText().trim();
    Display("Executing...");
    try
    MyDisplayTable.setDataSet(null);
    catch (DataSetException ex)
    Display("ERROR 1: " + ex.toString());
    try
    queryDataSet1.close();
    catch (DataSetException ex)
    Display("ERROR 2: " + ex.toString());
    try
    queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(
    database1, GET_DATASET, null, true, Load.ALL));
    catch (DataSetException ex)
    Display("ERROR 3: " + ex.toString());
    try
    if (!queryDataSet1.isOpen()) {
    queryDataSet1.open();
    catch (DataSetException ex) {
    Display("ERROR 5: " + ex.toString());
    try {
    queryDataSet1.refresh();
    catch (Exception ex) {
    Display("ERROR 5.5: " + ex.toString());
    try {
    Display("setDataSet");
    MyDisplayTable.setDataSet(queryDataSet1);
    Display("DONE setDataSet");
    catch (DataSetException ex) {
    Display("ERROR 6: " + ex.toString());
    Display("Query: ' " + GET_DATASET.trim() + " ' was executed successfully");
    catch (Exception ex)
    Display(ex.toString());
    Please let me know if more information is required. I am completely at a loss as to what more I need to do to get this to work using the new driver.
    Thank you all in advance,
    Malcolm Diaz
    Application Developer
    [email protected]
    PlanVista Solutions Inc.
    419 E.Main St.
    Middletown NY 10940
    845-346-2692

    this is more of a jdbc question rather than an internationalization. You might be able to get more help if you post it in java programming section.

  • Help on 2 error messages / code request please

    Why am I getting this error message about an abstract when I'm not declearing one.
    error messages I'm getting below -----------
    .\LkList.java:26: Method LinkedList getList() requires a method body. Otherwise declare it as abstract.
    public LinkedList getList();
    DCalc.java:10: class LkList is an abstract class. It can't be instantiated.
    LkList Expression =new LkList(exp);
    code below ------------------------------
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.util.*;
    class JCal extends JFrame implements KeyListener
         JLabel answer, expression;
         JButton b1, b2, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19,
              b20, b21, b22, b23, b24, b25, b26, b27;
         JMenuBar menuBar;
         JMenu menu;
         JMenuItem menuItem, menuItem1;
         LkList equation;
         String exp="";
         String ans="";
         double memory=0;
         public JCal()
         {     super("Nicks Swing Calculator");
    //------------------------- labels ---------------------------------------------
              answer = new JLabel(" 0 "); //Answer Lable
              answer.setBounds (20, 20, 220, 30);
              answer.setBorder (BorderFactory.createLoweredBevelBorder());
              answer.setBackground (Color.pink);
    answer.setHorizontalAlignment (SwingConstants.RIGHT);
              expression = new JLabel(" 0 "); // Expression Lable
              expression.setBounds (20, 55, 220, 30);
              expression.setBorder (BorderFactory.createLoweredBevelBorder());
              expression.setBackground (Color.white);
    //------------------------- menu -------------------------------------------------
              menuBar = new JMenuBar();
              setJMenuBar (menuBar);
              menu = new JMenu ("File");
              menuItem = new JMenuItem (" Help", new ImageIcon("help.gif"));
              menuItem1 = new JMenuItem (" Splash Page");
              menuItem.addActionListener(new ActionListener() // Help menu
              {     public void actionPerformed(ActionEvent e)
                   {     new JHelp();
    menuItem1.addActionListener(new ActionListener() // Splash Page
              {     public void actionPerformed(ActionEvent e)
                   {     new JSplash();
    //------------------------ buttons ------------------------------------------------
              JButton b1 = new JButton (new ImageIcon ("mc.gif")); // MR button
              b1.setBounds(20, 100, 55, 50);
              JButton b2 = new JButton (new ImageIcon ("mr.gif")); // MC button
              b2.setBounds(75, 100, 55, 50);
    JButton b3 = new JButton (new ImageIcon ("ms.gif")); // MS button
              b3.setBounds(130, 100, 55, 50);
    JButton b4 = new JButton (new ImageIcon ("mplus.gif")); // M+ button
              b4.setBounds(185, 100, 55, 50);
              JButton b5 = new JButton (new ImageIcon ("seven.gif")); // 7 button
              b5.setBounds(20, 170, 55, 50);
              JButton b6 = new JButton (new ImageIcon ("eight.gif")); // 8 button
              b6.setBounds(75, 170, 55, 50);
              JButton b7 = new JButton (new ImageIcon ("nine.gif")); // 9 button
              b7.setBounds(130, 170, 55, 50);
    JButton b8 = new JButton (new ImageIcon ("div.gif")); // divide button
              b8.setBounds(185, 170, 55, 50);
              JButton b9 = new JButton (new ImageIcon ("four.gif")); // 4 button
              b9.setBounds(20, 220, 55, 50);
              JButton b10 = new JButton (new ImageIcon ("five.gif")); // 5 button
              b10.setBounds(75, 220, 55, 50);
              JButton b11 = new JButton (new ImageIcon ("six.gif")); // 6 button
              b11.setBounds(130, 220, 55, 50);
              JButton b12 = new JButton (new ImageIcon ("times.gif")); // times button
              b12.setBounds(185, 220, 55, 50);
    JButton b13 = new JButton (new ImageIcon ("one.gif")); // 1 button
              b13.setBounds(20, 270, 55, 50);
              JButton b14 = new JButton (new ImageIcon ("two.gif")); // 2 button
              b14.setBounds(75, 270, 55, 50);
              JButton b15 = new JButton (new ImageIcon ("three.gif")); // 3 button
              b15.setBounds(130, 270, 55, 50);
              JButton b16 = new JButton (new ImageIcon ("minus.gif")); // minus button
              b16.setBounds(185, 270, 55, 50);
              JButton b17 = new JButton (new ImageIcon ("zero.gif")); // 0 button
              b17.setBounds(20, 320, 55, 50);
              JButton b18 = new JButton (new ImageIcon ("neg.gif")); // negitive button
              b18.setBounds(75, 320, 55, 50);
              JButton b19 = new JButton (new ImageIcon ("dot.gif")); // decimal button
              b19.setBounds(130, 320, 55, 50);
              JButton b20 = new JButton (new ImageIcon ("add.gif")); // addition button
              b20.setBounds(185, 320, 55, 50);
              JButton b21 = new JButton (new ImageIcon ("left.gif")); // left bracket button
              b21.setBounds(20, 375, 110, 35);
              JButton b22 = new JButton (new ImageIcon ("right.gif")); // right bracket button
              b22.setBounds(130, 375, 110, 35);
              JButton b23 = new JButton (new ImageIcon ("equals.gif")); // equals button
              b23.setBounds(20, 415, 220, 35);
    JButton b24 = new JButton (new ImageIcon ("clear.gif")); // clear button
              b24.setBounds(20, 460, 55, 50);
              JButton b25 = new JButton (new ImageIcon ("ce.gif")); // ce button
              b25.setBounds(75, 460, 55, 50);
              JButton b26 = new JButton (new ImageIcon ("sqrt.gif")); // sqrt button
              b26.setBounds(130, 460, 55, 50);
              JButton b27 = new JButton (new ImageIcon ("percent.gif")); // % button
              b27.setBounds(185, 460, 55, 50);
              //------------------- adding everything on the pane -------------------
              Container contentPane = getContentPane();
              contentPane.setLayout(null);
              // the default layout is BorderLayout
              contentPane.add(b1); // adds buttons
              contentPane.add(b2);
              contentPane.add(b3);
              contentPane.add(b4);
              contentPane.add(b5);
              contentPane.add(b6);
              contentPane.add(b7);
              contentPane.add(b8);
              contentPane.add(b9);
              contentPane.add(b10);
              contentPane.add(b11);
              contentPane.add(b12);
              contentPane.add(b13);
              contentPane.add(b14);
              contentPane.add(b15);
              contentPane.add(b16);
              contentPane.add(b17);
              contentPane.add(b18);
              contentPane.add(b19);
              contentPane.add(b20);
              contentPane.add(b21);
              contentPane.add(b22);
              contentPane.add(b23);
              contentPane.add(b24);
              contentPane.add(b25);
              contentPane.add(b26);
              contentPane.add(b27);
              contentPane.add(answer); // adds answer label
              contentPane.add(expression); // adds expression lable
              menuBar.add(menu); // adds menu
              menu.add(menuItem); // adds menu item "Help"
              menu.add(menuItem1); // adds menu item "Splash Page"
    //------------ button functions ---------------------------------------
              b1.addActionListener(new ActionListener()          // MR
              {     public void actionPerformed(ActionEvent e)
                   {     String TempMemory="";
                        answer.setText(TempMemory.valueOf(memory)); }});
              b2.addActionListener(new ActionListener()          //Mc
              {     public void actionPerformed(ActionEvent e)
                   {     memory=0; }});
              b3.addActionListener(new ActionListener()          //M-
              {     public void actionPerformed(ActionEvent e)
                   {     Double DblTemp=new Double(answer.getText());
                        double dblTemp=DblTemp.doubleValue();
                        memory=memory-dblTemp; }});
              b4.addActionListener(new ActionListener()          //M+
              {     public void actionPerformed(ActionEvent e)
                   {     Double DblTemp=new Double(answer.getText());
                        double dblTemp=DblTemp.doubleValue();
                        memory=memory+dblTemp; }});
    b5.addActionListener(new ActionListener() // Seven
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"7";
                        expression.setText(exp); }});
              b5.addKeyListener(this);
              b6.addActionListener(new ActionListener() // Eight
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"8";
                        expression.setText(exp); }});
              b6.addKeyListener(this);
              b7.addActionListener(new ActionListener() // Nine
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"9";
                        expression.setText(exp); }});
              b7.addKeyListener(this);
              b8.addActionListener(new ActionListener()          // Divide
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"/";
                        expression.setText(exp); }});
              b8.addKeyListener(this);
              b9.addActionListener(new ActionListener() // Four
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"4";
                        expression.setText(exp); }});
              b9.addKeyListener(this);
              b10.addActionListener(new ActionListener() // Five
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"5";
                        expression.setText(exp); }});
              b10.addKeyListener(this);
              b11.addActionListener(new ActionListener() // Six
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"6";
                        expression.setText(exp); }});
              b11.addKeyListener(this);
              b12.addActionListener(new ActionListener()     // Times
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"*";
                        expression.setText(exp); }});
              b12.addKeyListener(this);
              b13.addActionListener(new ActionListener() // One
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"1";
                        expression.setText(exp); }});
              b13.addKeyListener(this);
              b14.addActionListener(new ActionListener() // Two
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"2";
                        expression.setText(exp); }});
              b14.addKeyListener(this);
              b15.addActionListener(new ActionListener() // Three
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"3";
                        expression.setText(exp); }});
              b15.addKeyListener(this);
              b16.addActionListener(new ActionListener()          // Minus
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"-";
                        expression.setText(exp); }});
              b16.addKeyListener(this);
              b17.addActionListener(new ActionListener() // Zero
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"0";
                        expression.setText(exp); }});
              b17.addKeyListener(this);
              b18.addActionListener(new ActionListener() // negative
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"-";
                        expression.setText(exp); }});
              b18.addKeyListener(this);
              b19.addActionListener(new ActionListener()          // Decimal
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+".";
                        expression.setText(exp); }});
              b19.addKeyListener(this);
              b20.addActionListener(new ActionListener()          // Addition
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"+";
                        expression.setText(exp); }});
              b20.addKeyListener(this);
              b21.addActionListener(new ActionListener()     // Left Bracket
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+"(";
                        expression.setText(exp); }});
              b21.addKeyListener(this);
              b22.addActionListener(new ActionListener()          // Right Bracket
              {     public void actionPerformed(ActionEvent e)
                   {     exp=exp+")";
                        expression.setText(exp); }});
              b22.addKeyListener(this);
              b23.addActionListener(new ActionListener() // Equals
              {     public void actionPerformed(ActionEvent e)
                   {     LkList equation = new LkList();
                        equation.ProcessExpress();
                        ans=equation.getAns();
                        answer.setText(ans);
                        exp="";
                        ans="";     }});
              b23.addKeyListener(this);
              b24.addActionListener(new ActionListener()          // Clear
              {     public void actionPerformed(ActionEvent e)
                   {     exp="";
                        ans="";
                        expression.setText(exp);
                        answer.setText(ans); }});
              b25.addActionListener(new ActionListener()          // Clear Entry
              {     public void actionPerformed(ActionEvent e)
                   {     exp="";
                        ans="";
                        expression.setText(exp);
                        answer.setText(ans); }});
              addWindowListener( new WindowAdapter()
                        {     public void windowClosing(WindowEvent e)
                             {     System.exit(0);
              this.setBounds(10, 10, 270, 600);
              this.show();
         public static void main(String[] args)
         {     new JCal();
    public void keyReleased(KeyEvent evt){}
         public void keyTyped(KeyEvent evt) {}
         public void keyPressed(KeyEvent evt)
         {     char x=evt.getKeyChar();
              switch(x)
              {     case '0': exp=exp+"0";
                        expression.setText(exp);
                        break;
                   case '1': exp=exp+"1";
                        expression.setText(exp);
                        break;
                   case '2': exp=exp+"2";
                        expression.setText(exp);
                        break;
                   case '3': exp=exp+"3";
                        expression.setText(exp);
                        break;
                   case '4': exp=exp+"4";
                        expression.setText(exp);
                        break;
                   case '5': exp=exp+"5";
                        expression.setText(exp);
                        break;
                   case '6': exp=exp+"6";
                        expression.setText(exp);
                        break;
                   case '7': exp=exp+"7";
                        expression.setText(exp);
                        break;
                   case '8': exp=exp+"8";
                        expression.setText(exp);
                        break;
                   case '9': exp=exp+"9";
                        expression.setText(exp);
                        break;
                   case '+': exp=exp+"+";
                        expression.setText(exp);
                        break;
                   case '-': exp=exp+"-";
                        expression.setText(exp);
                        break;
                   case '*': exp=exp+"*";
                        expression.setText(exp);
                        break;
                   case '/': exp=exp+"/";
                        expression.setText(exp);
                        break;
                   case '.': exp=exp+".";
                        expression.setText(exp);
                        break;
                   case '(': exp=exp+"(";
                        expression.setText(exp);
                        break;
                   case ')': exp=exp+")";
                        expression.setText(exp);
                        break;
                   default: break;
    // ================================= equation =============================
    class Equation
    {     private double nbr1;
         private double nbr2;
         private char op;
         private double answer;
         private String StrNum1="";
         private String StrNum2="";
         private String StrOper="";
         private String StrAns="";
         //Constructor
         Equation(String number1, String number2, String operator)
         {     StrNum1 = number1;
              StrNum2 = number2;
              StrOper = operator;
              convert();
         public double getNum1() {return nbr1;}
         public double getNum2() {return nbr2;}
         public char getOp() {return op;}
         private void convert()
         {     Double temp=new Double(StrNum1);
              nbr1=temp.doubleValue();
              temp=new Double(StrNum2);
              nbr2=temp.doubleValue();
              op=StrOper.charAt(0);
         private void convertAnswer()
         {     StrAns=StrAns.valueOf(answer);
         public String toString()
         {     return StrAns;
         public void calculate()
         {     switch (op)
              {     case '+': answer=nbr1+nbr2;
                        break;
                   case '-': answer=nbr1-nbr2;
                        break;
                   case '*': answer=nbr1*nbr2;
                        break;
                   case '/': answer=nbr1/nbr2;
                        break;
              convertAnswer();
    // =============================== linked list ================================
    class LkList
    {  char[] operator = {'+','-','*','/','(',')'}; // operators used
    LinkedList Express = new LinkedList(); // Linked list of expression
    String StrExp = null;
    String oper = ""; // operator
    String number1 = ""; // first number used in expression
    String number2 = ""; // second number used in expression
    String answer = ""; // answer of expression
    Exp TempExp; // Temporary expression
    String Temp;
    // Constructor
    LkList (String e)
    { StrExp = e;
         formList (); // expression turn into liked list nodes
         trimList (); // remove spaces from linked list expression
    public String toString()
         { return Express.toString();
    public LinkedList getList();
         { return Express;
    public String getAns()
         { return Express.get(0).toString();
    public void ProcessExpress() // removing brackets
         {  removeBrack();
    private void formList()
    {  int j = 0;
    boolean lastOper = true;
         for (j = 0 ; j < Express.length(); j++ )
    {  if (!(belongTo(operator, StrExp.charAt (j))))
              {  Temp = Temp + StrExp.charAt (j);
         lastOperator = false;
         if (belongTo(operator, StrExp.charAt (j)))
         {   if ((StrExp.charAt (j) =='-') && (lastOperator))
              {   Temp = "-";
         lastoperator = false;
              else
              {   Express.add (Temp);
              Temp = "";
                   Temp = Temp + StrExp.charAt (j);
                   Express.add (Temp);
                   Temp = "";
                   if (StrExp.charAt (j) == ')')
                   {  lastOperator = false;
                   else
                   {   lastOperator = true;
         Express.add (Temp);
         Temp = "";
    private void trimlist ()
    {   int sp = 0;
    while ((sp !=-1))
    {  sp = Express.indexOf ("");
         if (sp !=-1)
         {  Express.remove (sp);
    private static boolean belongTo (char[] ar, char c)
    {  for (int k = 0; k < ar.length; k++)
         {  if (c == ar[k]) return true;
    return false;
    private boolean findBrack ()
    {  if (Express.contains (")"))
    {  return true;
    return false;
    private void removePoints (int pt1, int pt2 )
    {  int range = (pt2 - pt1);
    for (int j = pt2; j >= pt1; j--)
    {  Express.remove (j);
    private void processOperator (String Oper)
    {  int point =-1;
         while (Express.contains (Oper))
         {  point = Express.indexOf (Oper);
         oper = Express.get(point).toString();
              number1 = Express.get(point-1).toString();
              number2 = Express.get(point+1).toString();
              TempExp = new Exp (number1, number2, oper);
              TempExp.calculate();
              answer = Temp.toString();
              Express.add(point-1, point+1);
              removePoints (point-1, point+1);
    point =-1;
    private void removeBrack()
    {  int opBrack = 0;
    int clBrack = 1;
         int j = 0;
         String Temp = "";
         while (findBrack())
         {  clBrack = Express.indexOf (")");
         j = clBrack;
              do
              {  Temp = Express.get(j).toString();
              if (Temp.charAT(0) =='(')
              {   opBrack = j;
                   j--;
              while (opBrack < 0);
              number1 = Express.get(opBrack +1).toString();
    number2 = Express.get(clBrack -1).toString();
              oper = Express.get(opBrack+2).toString();
              TempExp = new Exp (number1, number2, oper)
              TempExp.calculate();
              answer = TempExp.toString();
              Express.add(clBrack+1, answer);
              removePoints(opBrack, clBrack);
              opBrack=-1;
              clBrack=0;
    private void removeDivide()                         
         {     processOperator("/");                    
              remMult();                         
         private void removeTimes()                         
         {     processOperator("*");                         
              remAdd();                         
         private void removeAdd()                         
         {     processOperator("+");                         
              remSub();                         
         private void removeSub()                         
         {     processOperator("-");
    // ================================= help menu ============================
    class JHelp extends JFrame
    {     JTextArea textarea;
         public JHelp()
         {     super ("Help");
              Container contentPane = getContentPane();
         /*     JPanel textPan1 = new JPanel (new BorderLayout());
              textarea = new JTextArea ("How to use Nicks Calculator");
              textarea.setWrapStyleWord(false);
              JScrollPane textAreaPane1 = new JScrollPane (textarea);
              textPan1.add (textarea, BorderLayout.CENTER);
              contentPane.add(textPan1);
              textarea.setEnabled(false); */
              JLabel lab=new JLabel(new ImageIcon("helpmenu.jpg"));
              contentPane.add(lab, BorderLayout.CENTER);
              setBounds(400,200,400,400);
              this.show();
    // ================================ Splash Page =============================
    class JSplash extends JFrame
    {     public JSplash()
    {   super ("Splash Page");
              Container contentPane=getContentPane();
              JLabel lab=new JLabel(new ImageIcon("nick.jpg"));
              contentPane.add(lab, BorderLayout.CENTER);
              setBounds(400,200,250,320);
              this.show();

    Spot the difference:
    public LinkedList getList();
    public LinkedList getList()
    Notice the semi-colon. Thats the problem

  • How to Handle the error message?

    Hi,
    Can any one help me in handling the error messages in application,
    In my application, I am having 2 buttons, one is display button, and the other is reset button. When we enter wrong inputs, it prompts an error message and again we I click on reset button the application goes back to its normal stage i.e. the error message will be disappears. These things will happen in the same page. I have tryed to know the any Id/Name of error message.
    So please help to handle error and skip that error then continue execute raming code.
    Thanks
    Buntty

    A few problems with this question that need clarification:
    You're using a GUI, but we have no way of knowing which one -- Swing? AWT? SWT? other?
    You ask how to fix your program flow and logic but don't show us the current state. Most of us can't read minds so a bit of code would be nice here.
    You mention "Page". What context is this in?
    A great resource that has helped me and will probably help you is an article entitled [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html] . It will tell you how to formulate your questions so that the folks here will be better able to answer them. Good luck.

  • "should be declared abstract" error message Help !

    Dear People,
    I have two error messages in my program
    "should be declared abstract"
    "getAudioClip() not found "
    Your advice is appreciated
    Norman
    "MyMusicApplet_1.java": Error #: 454 : class stan_my_music_applet_1.MyMusicApplet_1 should be declared abstract; it does not define method getStreamKeys() in interface java.applet.AppletContext at line 9
    "MyMusicApplet_1.java": Error #: 300 : method getAudioClip(java.lang.String) not found in class stan_my_music_applet_1.MyMusicApplet_1
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    public class MyMusicApplet_1 extends JApplet implements ActionListener, AppletContext
         //AppletContext myAppletContext =   new AppletContext();
         //Iterator i =   myAppletContext.getStreamKeys();
         JButton myJButton;
         AudioClip acSound_1 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk");
         AudioClip acSound_2 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_3 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_4 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_5 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_6 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_7 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_8 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         AudioClip acSound_9 = getAudioClip("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk   ");
         JButton myJButtonSound1;
         JButton myJButtonSound2;
         JButton myJButtonSound3;
         JButton myJButtonSound4;
         JButton myJButtonSound5;
         JButton myJButtonSound6;
         JButton myJButtonSound7;
         JButton myJButtonSound8;
         JButton myJButtonSound9;
      public void init()
           Container myContentPane = getContentPane();
           myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            Dimension buttonSize = new Dimension(190,100);
           Font myFont = new Font("Arial", Font.BOLD,14);
           Border myEdge = BorderFactory.createRaisedBevelBorder();
                    //create 1st button's object
                     myJButtonSound1 = new JButton("sound #1");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound1.setBorder(myEdge);
                   myJButtonSound1.setPreferredSize(buttonSize);
                   myJButtonSound1.setFont(myFont);
                   myJButtonSound1.setBackground(Color.orange);
                   myJButtonSound1.setForeground(Color.black);
                    //create 2nd button's object
                     myJButtonSound2 = new JButton("sound #2");
                    myJButtonSound2.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound2.setBorder(myEdge);
                   myJButtonSound2.setPreferredSize(buttonSize);
                   myJButtonSound2.setFont(myFont);
                   myJButtonSound2.setBackground(Color.blue);
                   myJButtonSound2.setForeground(Color.black);
                    //create 3rd button's object
                     myJButtonSound3 = new JButton("sound #3");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound3.setBorder(myEdge);
                   myJButtonSound3.setPreferredSize(buttonSize);
                   myJButtonSound3.setFont(myFont);
                   myJButtonSound3.setBackground(Color.cyan);
                   myJButtonSound3.setForeground(Color.black);
                    //create 4th button's object
                     myJButtonSound4 = new JButton("sound #4");
                    myJButtonSound4.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound4.setBorder(myEdge);
                   myJButtonSound4.setPreferredSize(buttonSize);
                   myJButtonSound4.setFont(myFont);
                   myJButtonSound4.setBackground(Color.pink);
                   myJButtonSound4.setForeground(Color.black);
                   //create 5th button's object
                   myJButtonSound5 = new JButton("sound #5");
                  myJButtonSound5.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound5.setBorder(myEdge);
                 myJButtonSound5.setPreferredSize(buttonSize);
                 myJButtonSound5.setFont(myFont);
                 myJButtonSound5.setBackground(Color.red);
                 myJButtonSound5.setForeground(Color.black);
                  //create 6th button's object
                   myJButtonSound6 = new JButton("sound #6");
                  myJButtonSound6.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound6.setBorder(myEdge);
                 myJButtonSound6.setPreferredSize(buttonSize);
                 myJButtonSound6.setFont(myFont);
                 myJButtonSound6.setBackground(Color.pink);
                 myJButtonSound6.setForeground(Color.black);
                  //create 7th button's object
                   myJButtonSound7 = new JButton("Choice #7");
                  myJButtonSound7.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound7.setBorder(myEdge);
                 myJButtonSound7.setPreferredSize(buttonSize);
                 myJButtonSound7.setFont(myFont);
                 myJButtonSound7.setBackground(Color.cyan);
                 myJButtonSound7.setForeground(Color.black);
                  //create 8th button's object
                   myJButtonSound8 = new JButton("Choice #8");
                  myJButtonSound8.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound8.setBorder(myEdge);
                 myJButtonSound8.setPreferredSize(buttonSize);
                 myJButtonSound8.setFont(myFont);
                 myJButtonSound8.setBackground(Color.yellow);
                 myJButtonSound8.setForeground(Color.black);
                  //create 9th button's object
                   myJButtonSound9 = new JButton("Choice #9");
                  myJButtonSound9.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound9.setBorder(myEdge);
                 myJButtonSound9.setPreferredSize(buttonSize);
                 myJButtonSound9.setFont(myFont);
                 myJButtonSound9.setBackground(Color.blue);
                 myJButtonSound9.setForeground(Color.black);
                   //add the buttons to the content pane
                   myContentPane.add(myJButtonSound1);
                   myContentPane.add(myJButtonSound2);
                   myContentPane.add(myJButtonSound3);
                   myContentPane.add(myJButtonSound4);
                   myContentPane.add(myJButtonSound5);
                   myContentPane.add(myJButtonSound6);
                   myContentPane.add(myJButtonSound7);
                   myContentPane.add(myJButtonSound8);
                   myContentPane.add(myJButtonSound9);
          public void actionPerformed(ActionEvent e)
             myJButton = (JButton)e.getSource();
            if(myJButton == myJButtonSound1)
              acSound_1.play();
            if(myJButton == myJButtonSound2)
              acSound_2.play();
            if(myJButton == myJButtonSound3)
              acSound_3.play();
            if(myJButton == myJButtonSound4)
              acSound_4.play();
            if(myJButton == myJButtonSound5)
              acSound_5.play();
             if(myJButton == myJButtonSound6)
               acSound_6.play();
                       if(myJButton == myJButtonSound7)
                         acSound_7.play();
                       if(myJButton == myJButtonSound8)
                         acSound_8.play();
                        if(myJButton == myJButtonSound9)
                          acSound_9.play();
      }

    The "should be declared abstract" error message means that you have either extended an abstract class with abstract methods that you have not implemented, or you have implemented an interface and not implemented all of its methods. Non abstract classes have to implement all methods that their base classes or interfaces declare.
    The "getAudioClip() not found" error message means that the compiler could not find the method getAudioClip(). Either your class or one of its base classes has to define this method.

  • Help - error message when trying to run a program....

    Getting this error message - been trying to load and get jforge going, but I'm sure this is a standard problem.
    I'm trying to run this on WindowsXP Pro. Could this be an issue? Do I need any sort of plud-in for XP?
    D:\software\jforge\jforge3j2>set CLASSPATH=D:\software\jforge\jforge3j2\jforge.jar;D:\software\jforge\jforge3j\public.jar;D:\software\jforge\jforge3j2\calpahtml.jar;;.
    D:\software\jforge\jforge3j2>java com.tektools.jforge.JForgeMain
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/swing/JFrameBea
    nInfo
    at com.tektools.beaninfo.proxies.JDialogProxyBeanInfo.getIcon(JDialogPro
    xyBeanInfo.java)
    at com.tektools.jforge.loadedbeans.DefaultLoadedBean.<init>(DefaultLoade
    dBean.java)
    at com.tektools.jforge.loadedbeans.DefaultLoadedBeansManager.a(DefaultLo
    adedBeansManager.java)
    at com.tektools.jforge.loadedbeans.DefaultLoadedBeansManager.readBeansFi
    le(DefaultLoadedBeansManager.java)
    at com.tektools.jforge.JForgeMain.g(JForgeMain.java)
    at com.tektools.jforge.JForgeMain.a(JForgeMain.java)
    at com.tektools.jforge.JForgeMain.main(JForgeMain.java)

    Those slashes in the first line of the error message suggest to me that maybe you referred to a class incorrectly in your source code.

  • Using 4.0.2, strange error message when trying to created a webi rep

    Hi all
    I'm getting the error message Protocol message end-group tag did not match expected tag. (WIS 00000) while trying to create a webi report using a unx (Designer Information Design tool)
    full error test below
    This unx is using a 7.1 BW cube, and from the unx toll all looks to be ok
    com.businessobjects.sdk.core.server.CommunicationException$UnexpectedServerException: Protocol message end-group tag did not match expected tag.
         at com.businessobjects.sdk.core.exception.ExceptionBuilder.make(ExceptionBuilder.java:144)
         at com.businessobjects.sdk.core.exception.ExceptionBuilder.make(ExceptionBuilder.java:101)
         at com.businessobjects.sdk.core.server.common.CommonRequestHandler.afterProcessing(CommonRequestHandler.java:127)
         at com.businessobjects.sdk.core.server.internal.AbstractServer.processIt(AbstractServer.java:178)
         at com.businessobjects.sdk.core.server.internal.AbstractServer.process(AbstractServer.java:133)
         at com.businessobjects.sdk.core.server.internal.InstanceServer.process(InstanceServer.java:94)
         at com.sap.sl.sdk.services.util.ServerRequestProcessor.processServerRequest(ServerRequestProcessor.java:49)
         at com.sap.sl.sdk.dataprovider.service.DataProviderServiceImpl.processDataProviderCommand(DataProviderServiceImpl.java:419)
         at com.sap.sl.sdk.dataprovider.service.DataProviderServiceImpl.processDataProviderCommand(DataProviderServiceImpl.java:431)
         at com.sap.sl.sdk.dataprovider.service.DataProviderServiceImpl.run(DataProviderServiceImpl.java:192)
         at com.sap.sl.sdk.workspace.service.WorkspaceServiceImpl.run(WorkspaceServiceImpl.java:346)
         at com.sap.webi.ui.tasks.workflows.RunWorkspaceTask.doIt(RunWorkspaceTask.java:74)
         at com.sap.webi.ui.tasks.workflows.RunWorkspaceTask.doIt(RunWorkspaceTask.java:11)
         at com.sap.webi.toolkit.ui.tasks.WebITask.doInBackground(WebITask.java:113)
         at javax.swing.SwingWorker$1.call(Unknown Source)
         at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
         at java.util.concurrent.FutureTask.run(Unknown Source)
         at javax.swing.SwingWorker.run(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: com.businessobjects.sdk.core.server.ServerException: Protocol message end-group tag did not match expected tag.
         at com.businessobjects.sdk.core.server.common.CommonRequestHandler.newServerException(CommonRequestHandler.java:260)
         at com.businessobjects.sdk.core.server.common.CommonRequestHandler.createAllServerExceptions(CommonRequestHandler.java:238)
         at com.businessobjects.sdk.core.server.common.CommonRequestHandler.afterProcessing(CommonRequestHandler.java:121)
         ... 18 more

    You can still create universe, just not UNX universe.
    If you have upgraded Bi4.0 to Sp01 or SP02 - in IDT it will not let you do that.
    As for docs :
    /people/ingo.hilgefort/blog/2011/03/24/sap-integration-update-9--should-you-start-with-sap-businessobjects-40-or-wait-for-41
    http://smartdirectory.sap.corp:3080/Assets/asset.epx?id=519f2955-0b47-4a0f-81d1-84e8e5303e5e
    http://www.asugnews.com/2011/02/22/sap-businessobjects-bw-integration-to-get-easier-in-bi-4-0/
    https://cw.sdn.sap.com/cw/servlet/JiveServlet/download/139619-38-87308/SDN%20-%20Best%
    /people/ingo.hilgefort/blog/2011/02/10/sap-integration-update-part-5--web-intelligence-40-connecting-to-bex-queries

  • Don't understand private access error message.

    I am calling createAndShowGui from another file and am getting an error message from the compiler that says:
    createAndShowGUI has private access in masterfilemaint.MasterFileMaint.
    I don't understand because the method is public. Here is the call.
    thanks.
        public void actionPerformed(ActionEvent e) {
            if ("Fil".equals(e.getActionCommand())) {   ///  The Call......
                   callItemMaint.createAndShowGUI();
                if ("Tab".equals(e.getActionCommand()))  {
                   callSimpleTableDemo.createAndShowGUI();   
                if ("Quit".equals(e.getActionCommand())) {
                   quit();
                /*else {
                  quit();
        }       ..............And here is the method.
           public void createAndShowGUI() {// was static
            // set decor
            JFrame.setDefaultLookAndFeelDecorated(true);
            // create/set-up window
            JFrame frame = new JFrame("Guide");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // set up content pane.
            addComponentsToPane(frame.getContentPane());
            // Display window
            frame.pack();
            frame.setVisible(true);
    }

    Is the createAndShowGUI in a public class?
    Yes here is the first few lines of the class:
    package masterfilemaint;
    import java.awt.*;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.JLabel;
    import javax.swing.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class MasterFileMaint {                //   Class is public .........
        final static boolean shouldFill = true;
        final static boolean shouldWeightX = true;
        final static boolean RIGHT_TO_LEFT = false;
        final static boolean DEBUG = false;
        public JTextField textFieldOne, textFieldTwo,
                             textFieldThree, textFieldFour, textFieldFive;
        public JLabel label;
        public JButton button;
        public String one, two, three, four, five, six;
        Is callItemMaint an instance of that class or an instance of a base class or interface?
    callitemMaint is an instance of MasterFileMaint instantiated in the calling class. Here is the first few lines of MaterFileMaint.
    package probuyermain;
    import CalculatorOne.*;
    import simpletabledemo.*;
    import masterfilemaint.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JCheckBoxMenuItem;
    import javax.swing.JRadioButtonMenuItem;
    import javax.swing.ButtonGroup;
    import javax.swing.JMenuBar;
    import javax.swing.KeyStroke;
    import javax.swing.ImageIcon;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JFrame;
    public class ProBuyerMain implements ActionListener {
        JTextArea output;
        JScrollPane scrollPane;
        MasterFileMaint callItemMaint = new MasterFileMaint();        // The instance
        CalculatorOne callCalculator = new CalculatorOne();
        SimpleTableDemo callSimpleTableDemo = new SimpleTableDemo();
        public JMenuBar createMenuBar() {
            JMenuBar menuBar;
            JMenu fileMenu, submenu;
            JMenuItem menuItemOne, menuItemTwo,
                        menuItemThree, menuItemFour, menuItemFive;
            //Create the menu bar.
            menuBar = new JMenuBar();

  • Don't understand error message from HTML parser?

    I've written a simple test program to parse a simple html file.
    Everything works fine accept for the <img src="test.gif"> tag.
    It understands the img tag and the handleSimpleTag gets called.
    I can even pick out the src attribute. But I get a very strange error message.
    When I run the test program below on the test.html file (also below) I get the following output:
    handleError(134) = req.att srcimg?
    What does "req.att srcimg?" mean?!?!?
    /John
    This is my test program:
    import javax.swing.text.html.*;
    import javax.swing.text.*;
    import javax.swing.text.html.parser.*;
    import java.io.*;
    public class htmltest extends HTMLEditorKit.ParserCallback
    public htmltest()
       super();
    public void handleError(String errorMsg, int pos)
       System.err.println("handleError("+pos+") = " + errorMsg);
    static public void main (String[] argv) throws Exception
        Reader reader = new FileReader("test.html");
        new ParserDelegator().parse(reader, new htmltest(), false);
    This is the "test.html" file
    <html>
    <head>
    </head>
    <body>
    This is a plain text.<br>
    This is <b>bold</b> and this is <i>itallic</i>!<br>
    <img src="test.gif">
    "This >is also a plain test text."<br>
    </body>
    </html>
    ----------------------------------------------------------------------

    The handleError() method is not well documented any more than whole javax.swing.text.html package and its design structure. You can ignore the behavior of the method if other result of the parser and your HTML file are proper.

Maybe you are looking for

  • Problems with html code for video

    Hello I followed this instructions to add my video: - Upload the files in Muse < Add Files for upload ( These would add the files to your assets ) - Object > Insert HTML : <video width="320" height="240" controls> <source src="assets/video.mp4"/> </v

  • Unable to open /delete a Web Template in Development

    Hi Experts, I am unable to open a web template. It says "You do not have sufficient authorization to change the template,Do you want to  create a copy". I need to delete this template and when i click on delete ,there is no impact on the template. Pl

  • I can,t use my creditcard

    my account did not accept my credit for payment

  • Terrible performance after moving VM's to new hardware

    We recently decided to purchase a new server to run our VM's on since the old one did not have redundant drives. Unfortunately our new and improved server has resulted in far worse performance now that I've moved the VM's over to it! I am not really

  • RAW Reprocessing

    I don't recall this in ver 5, but now when I import my RAW files from my nikon d70 and then try to click and drag it from iphoto 6 to the photoshop cs icon in order to open it in adobe camera raw it comes up as a jpeg. Previously, that would only hap