Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6476441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:49:34+00:00 2026-05-25T06:49:34+00:00

Possible Duplicate: What does the "Multiple markers" mean? package test2; import java.awt.*; import java.awt.event.*;

  • 0

Possible Duplicate:
What does the "Multiple markers" mean?

package test2;
import java.awt.*;
import java.awt.event.*;


public class MyDrawing3Demo extends Frame{

    Panel p1,p2;
    Button red,green,blue,large,small,clear,allClear;
    MyCanvas2 can;
    public MyDrawing3Demo(){
        super("::MyDrawing3Demo::");

        p1 = new Panel();
        p1.setBackground(Color.blue);
        add(p1,"North");

        p2 = new Panel(){
            public Insets getInsets(){
                return new Insets(40,20,20,20); 
            }
        };
        p2.setBackground(Color.darkGray);
        add(p2,"Center");

        p1.add(red = new Button("Red"));
        p1.add(green = new Button("Green"));
        p1.add(blue = new Button("Blue"));
        p1.add(large = new Button("Large"));
        p1.add(small = new Button("Small"));
        p1.add(clear = new Button("Clear"));
        p1.add(allClear = new Button("All Clear"));

        MyHandler2 my = new MyHandler2(); // ERROR! Multiple Markers at this line

        red.addActionListener(my);
        green.addActionListener(my);
        blue.addActionListener(my);
        large.addActionListener(my);
        small.addActionListener(my);
        clear.addActionListener(my);
        allClear.addActionListener(my);

        can = new MyCanvas2();
        can.setSize(300,300);
        can.setBackground(Color.white);
        p2.add(can);


        can.addMouseMotionListener(my);

        addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e){
                System.exit(0);
            }
        });


        class MyHandler2 extends MouseMotionAdapter implements ActionListener
        {
            public void mouseDragged(MouseEvent e){
                can.x = e.getX();
                can.y = e.getY();
                can.repaint();
            }
            public void actionPerformed(ActionEvent e){
                Object o = e.getSource();
                if(o == red){
                    can.cr = Color.red;
                }else if(o == blue){
                    can.cr = Color.blue;
                }else if(o == green){
                    can.cr = Color.green;
                }else if(o == large){
                    if(can.w <20){
                        can.w++;
                        can.h++;
                    }
                }else if(o == small){
                    if(can.w >2){
                        can.w--;
                        can.h--;
                    }
                }else if(o == clear){
                    can.cr = can.getBackground();
                }else if(o == allClear){
                    can.flag = 1;
                    can.repaint();
                }
            }
        }

    }

    public static void main(String[] args){
        MyDrawing3Demo d = new MyDrawing3Demo();
        d.setSize(500,500);
        d.setVisible(true);
    }
}

class MyCanvas2 extends Canvas{
    /**
     * 
     */
    private static final long serialVersionUID = -2856701740289022957L;
    int x=-13,y=-13,w=7,h=7;
    Color cr = Color.black;
    int flag = 0;
    public void update(Graphics g){
        paint(g);
    }
    public void paint(Graphics g){
        if(flag == 0){
            g.setColor(cr);
            g.fillOval(x,y,w,h);
        }else if (flag == 1){
            g.clearRect(0,0,300,300);
            flag = 0;
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:49:34+00:00Added an answer on May 25, 2026 at 6:49 am

    It means there are two errors on this line. It’s because the type you used is unknown to the compiler. The declaration of your class MyHandler2 is done inside the constructor, you should move it outside. That is, move the braket before main to right before the declaration of the class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What does the tilde (~) mean in C#? class ResourceWrapper { int
Possible Duplicate: What does the Visual Studio "Any CPU" target mean? I've noticed that
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: What does map(&:name) mean in Ruby? I was watching a railscast and
Possible Duplicate: What does ||= (or equals) mean in Ruby? It's hard to search
Possible Duplicate: what does “@” means in c# What does the sign @ mean
Possible Duplicate: Does adding [Serializable] to the class have any performance implications? What is
Possible Duplicate: what does #someDiv mean? i am doing this: onmouseover=evt.target.setAttribute('opacity', '0.5'); $('#someDiv').show(); onmouseout=evt.target.setAttribute('opacity','1)');
Possible Duplicate: What does the @ symbol before a variable name mean in C#?
Possible Duplicate: What does the @ symbol before a variable name mean in C#?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.