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 7565955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:17:22+00:00 2026-05-30T14:17:22+00:00

Overusing Inheritance ? Java Swing and Java2D rely a lot on inheritance. Most people

  • 0

Overusing Inheritance ?

Java Swing and Java2D rely a lot on inheritance. Most people have told me I should avoid inheritance as much as possible and only use it when necessary. So is the extensive use of Inheritance in Java2D and Java Swing justified?

Adapter Pattern

I have heard a lot of praise for the adapter pattern, and I’ve heard a lot of criticism. What I gathered from all that, though, is that the adapter pattern is only considered good design if used at the right place. Irrelevant use of the adapter pattern causes people reading your code to scowl. Is the adapter pattern correctly and relevantly used in the two Java APIs?

Singletons

Both APIs also tend to use a considerable number of Singletons. Is this good?

The Question

So, Is The Java2D Api and Java Swing a good example of an Object Oriented Programming Interface? Should I use their techniques in my code?

  • 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-30T14:17:24+00:00Added an answer on May 30, 2026 at 2:17 pm

    I have no certainty on this, but I can offer some thought:

    • inheritance: suppose you preffered to use interfaces and composition instead of reuse-by-inheritance in Swing, then you would need to do an awful lot of forwarding (Component and JComponent have dozens of methods)

    • adapter pattern: see above

    • singletons: they are appropriate to model parts of a system which are genuinely unique (I would agree that java.awt.Desktop could be implemented as a singleton — even though it uses a factory method)

    • overall design: you might opt to judge things by results — Swing is robust, extensible, and widely used.

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

Sidebar

Related Questions

I am wondering whether I am overusing java reflection. I have a class which
I have experience developing java web applications with Spring, but not so much with
Have you ever had to justify the choice over using .NET instead of Java
Using pure functional languages can have a lot of benefits over using impure imperatives,
Is it possible to have a partially transparent background/image (png logo with shadow) positioned
I have been a Java programmer for the last 6 years, and since the
I have created a pkg for my regular simple commands. They are non-static, to
After reading the MSDN reference, I still have questions about when to use the
In Java, an Enum can do the great things that Enums do, but can
I have a read-only text-box with text in it. How to make it editable

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.