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

  • SEARCH
  • Home
  • 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 7062173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:33:43+00:00 2026-05-28T04:33:43+00:00

in an application I made that uses AWT standard classes, a call to Color

  • 0

in an application I made that uses AWT standard classes, a call to Color constructor throws the following Exception message:

run:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Color parameter outside of expected range: Red
    at java.awt.Color.testColorValueRange(Color.java:310)
    at java.awt.Color.<init>(Color.java:395)
    at java.awt.Color.<init>(Color.java:369)
    at mandelbrotset.DrawingArea.translateColor(DrawingArea.java:106)
    at mandelbrotset.DrawingArea.drawMandelbrotSet(DrawingArea.java:75)
    at mandelbrotset.DrawingArea.paintComponent(DrawingArea.java:45)
    at javax.swing.JComponent.paint(JComponent.java:1054)

is there any way to change this message (including in this case the value of red component)?

I thought of defining a new class NewColor that extends Color and throws the modified exception in the constructor, but the new class constructor must start with a call to super(red, green, blu) and so the standard testColorValueRange(int r, int g, int b, int a) is called and the standard exception is thrown.

Thanks for any help.

  • 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-28T04:33:44+00:00Added an answer on May 28, 2026 at 4:33 am

    Catch the unwanted exception and throw the desired exception.
    Something like this:

    try
    {
      blah; // throws the unwanted exception.
    }
    catch (UnwantedExceptionType exception)
    {
      throw new DesiredException(exception);  // option 1.
      // or 
      throw new DesiredException(new info, exception) // option 2.
    }
    

    You can create a new exception class (DesiredException in the example above) that takes the existing exception and “changes” the values to what you want.

    It is also possible that (in the code above) UnwantedExceptionType and DesiredException are the same type, you just set the desired values in DesiredException.

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

Sidebar

Related Questions

I have made a web application that uses master page for Login & Logout
HP iPAQ 110 Classic Handheld. I made an application that uses windows mobile 6.0
I have made a MVC application that uses the built-in ASP.NET login functions. It
I have made a MDI (tabbed) application that uses PictureBoxes inside TabPages. The picturebox
I have an asp.net application that uses the file (something like hand-made DB). It
I have an application that uses call activity to call people. However, when the
I made ​​an Android application that uses that uses the SearchManager. The problem is
I have made an iframe style facebook application that uses php and javascript (jquery).
I am using basic4android and I made an application that uses httputils services. Sometimes
I made an application that uses a ListAdapter to display some items. In my

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.