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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:35:11+00:00 2026-05-26T03:35:11+00:00

I’ve been trying to implement a completely free bordered JButton : Free shape as

  • 0

I’ve been trying to implement a completely free bordered JButton :

  • Free shape as a border, as a solution is given in a previous thread : Rounded Swing JButton using Java
  • But the shape outside area can’t be clicked
  • And the shape outside area is not drawn, even by the parent class (JButton)

Is there a simple way to do it in “plain” Swing (without any 3d party library) ? Otherwise, is there a good free (open-source is better of course) 3d party library in order to do this ?

As an example, think about a Red Circle ball : the best interaction I can give to users is that it can’t click in the outside area, particularly if the Ball is really big.

Thank you in advance

(I’ve thought of a component written from scratch with Java2D, and using the Shape contains() method in order to see if the click is good. But I would have 2 main problems :

  • for giving the pressed apperance to the Shape, as well as the JButton does it => as someone noticed me below, that’s not the most difficult, if I use two differents drawings/images

  • for handling events (ActionListeners) as well as the JButton does it => if i inherits from a JComponent, the most difficult will be to reject (return from) the handling if we have not clicked on the good area => what is the best way to detect this eventual intersection between mouse clicking point and the area ?)

  • 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-26T03:35:11+00:00Added an answer on May 26, 2026 at 3:35 am

    you have three choises

    1) every Custom Look and Feels have implements Rounded JComponents, this is safiest way how to do that confortly and maybe correctly too, part of them brings excelent output to the Java Swing GUI and with long Bug history, I’d suggest to use Substance Look & Feel, but is very, so sensitive to EDT

    2) you can override whole (Custom Look and Feels already did that) ButtonUI, but your UI_Delegate will be Look and Feel and Native_OS sensitive, meaning example that link I post, works on Windows platform with Metal Look and Feel, if you want to create an cross Platform and cross Look & Feel non-sensitive, then you must to overrive all possible Platforms and Look and Feels

    3) create JComponent with Rounded Borders, fill area inside with for example GradientPaint, and then add MouseListener, MouseMotionListener, KeyListener or better write own KeyBindings and create own Model for avoiding the concurency betweens linstening Listeners, then will be your Custom JButton cross Platform and cross Look & Feel non-sensitive

    everything …. up to you, much luck

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.