Results 1 to 4 of 4
  1. #1
    ntagrafix's Avatar
    ntagrafix is offline Member
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    29
    Rep Power
    0

    Default How can I display on Button click?

    Hi guys,

    I am working with NetBeans IDE6.7.1. am developing guitar programme. Now i want the user to be able to mute some string by clicking a button on top of the string.

    How can I hide label (Mute) and display it when the user clicks on the button?


    Thanks for your help ... :confused:

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default

    Hide the label or hide the button? Hiding the label can be done by just setting the label to a blank string "" and then set it back to "Mute" whenever some listener is called.

    To hide the button I believe there's a setVisible() method attached to buttons you can use. You need a listener to call this function attached to your button and you're going to need to refresh the screen afterwards.
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  3. #3
    ntagrafix's Avatar
    ntagrafix is offline Member
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    29
    Rep Power
    0

    Default

    Thanks xcallmejudasx for your prompt response,

    I've done that and it worked perfectly, splendid.

    But i now realize that i am using JToggleButton to show and hide the "Mute".

    What i actually want is

    If the JToggleButton is clicked (down), it shows Mute & if clicked (up) again, it hide the Mute text.

    Plz how can i achieve that.

    once again lotta tnx

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. deselecting a button after the click.
    By ramsrocker in forum New To Java
    Replies: 10
    Last Post: 02-15-2009, 06:52 AM
  2. Replies: 8
    Last Post: 12-29-2008, 07:12 AM
  3. Double click radio button
    By mandragora in forum AWT / Swing
    Replies: 11
    Last Post: 11-10-2008, 11:06 AM
  4. AWT - catching click button event
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-11-2008, 11:02 PM
  5. How to perform some event to button click
    By eva in forum AWT / Swing
    Replies: 2
    Last Post: 01-16-2008, 12:27 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •