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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:49:30+00:00 2026-06-18T08:49:30+00:00

Hello and thanks for reading this in advance, here is my problem: final JButton

  • 0

Hello and thanks for reading this in advance, here is my problem:

final JButton button = new JButton();

        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent actionevent)
            {
                button.setVisible(false);
                button.validate();
                button.invalidate();
                button.revalidate();
                button.repaint();
            }
        });

I have tried all those to just make that button go away, I have disabled it aswell, but I need it to just go away, not fade out or something. the background is variabel so I can’t make it so it has the same color as it and pretend it’s not there. Does anyone have any clue at all how to make it go away?

EDIT: I’ve tried all answers uptill now and would really like to thank you, but the button’s still there 🙁

EDIT2: I think I’ve made quite a big mistake constantly adding buttons because of my timer, thanks for all the help, this still was very usefull!

EDIT3: Thank you all very much, I have fixed the problem with your guys’ 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-06-18T08:49:32+00:00Added an answer on June 18, 2026 at 8:49 am

    If you want to remove the button:

    Container parent = button.getParent();
    parent.remove(button);
    ((JComponent) parent).revalidate();
    parent.repaint();
    

    if you want to remove action listener from the button:

    public void actionPerformed(ActionEvent actionevent)
    {
      button.removeActionListener(this);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello folks and thanks in advance for reading this. I currently use a slider
Hello everyone and thanks in advance for reading this.. I have the following html
Hello all and thanks for your time reading this. I need to verify certificates
Hello everybody and thanks for reading. I have this html; <i class=icon-plus icon-white> Test
Hello and thank you for reading this. I am coding in java/LWJGL. My problem
Hello and thanks to everyone for reading my question. I've been working on a
Hello (and thanks in advance) I'm in a bit of a quandry, I cant
I have this kinda template text : Hello {#Name#}, Thanks for coming blah on
Hello everyone and thanks for reading... I'm a Mono / Web developer and was
Hello and thanks for reading. I am trying to take an OOP approach to

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.