Removing the JButton press effect

Hi,
How can I remove the button press effect of JButton. I tried removing the borders and making the contentAreafilled property false; but nothing worked. Can anyone help me out.? I want to render this button in JTable
Regards
Clefies D S'ouza

If you're talking about disabling a button's ability to respond to mouse clicks:
The safest way to prevent a button from working would be to disable it like so:
    myButton.setEnabled(false);There are other ways to make a button not respond to the mouse but yet not change the appearance. One way (and I'm not sure how "safe" this is) would be to override the button's processMouseEvent method, for example:
        JButton myButton = new JButton("My Button")
            @Override
            protected void processMouseEvent(MouseEvent e)
                if (allowMouseClick)  // a boolean variable in the program that turns button on and off
                    super.processMouseEvent(e);
        };Again, I'm not sure if the latter is kosher, but when I've tried it, it works. Also, this does not prevent the button from getting focus, nor does it disable the space bar from "pressing" the button.
Message was edited by:
petes1234

Similar Messages

  • I want to remove the roll over effect from my promoted link.

    Hi,
    I want to remove the hover effect of tiles. I don't want the tittle to slide up when I mouse over the tiles. What will be the way to achieve this?

    Hi,
    There are two events fired, one is mouseenter and another one is mouseleave on the tiles. 
    You can achieve this by removing the mouse enter event with the following script. 
    $(".ms-tileview-tile-content").off('mouseenter');
    Please mark it answered, if your problem resolved.

  • How do I remove the "whoosh" sound effect?

    I recently downloaded OS X Mountain Lion and I like the added features but I'm getting annoyed by what seems to be random "whoosh" noises. How can I disable this sound effect? Thanks a bunch! kmart69

    Try this System Preferences>Sounds>Sound Effects tab and deselect 'Play user interface sound effects'.
    If it's in Mail go to Mail>Preferences>General tab and you can control sounds there (independently of the above suggestion).
    I expect other applications may also have there own Sound Preferences that can be modified on an app to app basis.

  • In CC214 PS Why has adobe removed the "print Size Button"  And why have they made the Brush preview window so small you can't see the effects to accurately adjust them?

    In CC214 PS Why has adobe removed the "print Size Button"  And why have they made the Brush preview window so small you can't see the effects to accurately adjust them?
    These two things need to be remedied in their upgrades because It's become such a bother I've had to revert to older versions of PS.

    Yea, and it's a pain to get to.  What was the rational for removing the print size button?   With the magnifying glass tool selected in older versions of Photoshop you would get a button that says "print size" right next to Actual pixels, Fit Screen, Fill Screen. Now I have to go out of my way and dig for it if I want to see the print size.  Of all the buttons you could have taken away, why not fill screen?  I never use that.
    Besides the point I just downloaded the Oct Upgrade for PS and surprise! Nothing has changed and these are two big black eyes on newer versions of Photoshop.   The Brush preview window is  unchanged in CC but in CC2014 it's basically worthless.  If you apply a texture to a brush you can't properly see the scale of the texture, the spacing, scatter, etc...

  • Remove the ink cartridge & reinstall it then press ok - Doesn't Work. Please Help !

    HP Envy 5660 Wireless All-In-One
    My black & color ink ran out and I changed them both. The color ink cartridge is fine but when I changed the black cartridge I get a message telling me to remove it and reinstall the black ink cartridge then press ok. I tried this several times. When it did not work after 4 tries, I decided to try another black cartridge. Again I got this message. I tried with 3 brand new black cartridges with no luck.
    I then decided to turn off the power to the printer and unplug the printer. Wait a few minutes then plug it in again and power up. Like a re-boot.  This did not help. I then tried cleaning the area where the cartridge goes in but this did not help either. I did not bother trying to clean the cartridges (3) themselves as they were all brand new, just out of the box.
    The only way I can use this printer right now was to remove the black cartridge all together and only use the color ink.
    I have only had this computer for 3 months so if anyone has any ideas it would be greatly appreciated. Thank you in advance.

    Hi @TracieDawn,
    I see that despite your best efforts so far, you can currently only use the printer when you remove the black cartridge and printer with the color ink. I suggest using the following document to troubleshooting the issue, and calling us if the issue persists; HP ENVY 5640, 5660, 7640 and Officejet 5740, 8040 e-All-in-One Printer Series - A 'Cartridges Missin....
    If you are in Canada or US call 800 474 6836, or you can Contact HP Worldwide.
    HP printers generally have a 1 year warranty from their purchase date, you can verify the warranty using the following link if you would like; warranty check. 
    I hope this helps.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • How to remove the "Image Mask" labels under the effects tab in the Inspector window

    I'm still trying to find my way round Final Cut Pro X after using Final Cut Express for many years. I don't know how I have manage to finish up with two Image Masks being set under the effects tab in the Inspector window. The Image Mask effects are not active (the box adjacent to the label is not blue) How can I remove the Image Mask label from the Effects tab in the Inspector window?
    Thanks JohnH

    JohnHutchinson wrote:
    … How can I remove the Image Mask label from the Effects tab in the Inspector window?
    just click onto the grey bar and…
    … and hit 'delete'/back-space key.-

  • Quick question - JButton containing an Image - removing the Images border?

    Hi, I have a JButton with an image inside it.
    I would like the JButton to have a border, but not the image when it is clicked.
    It currently looks like this - here
    As you can see, there are two borders (this is once the button has been clicked).
    The one around the JButton is the one I wish to keep, the one around the ImageIcon is the one I would like removed.
    I am sure there is a simple way to do this - I'm sure I have managed it before.
    part of the code used to create:
    JButton money = new JButton();
    money.setBackground(buttonColor);
    money.setIcon(new ImageIcon ("money.gif");

    That thin blue box is indicating the button has focus. It appears even if the button just shows text and has no icon. Here is an example where I get rid of it on btn1 but not btn2.
    And in the future, please post Swing questions to the Swing forum.
    import java.awt.*;
    import javax.swing.*;
    public class ButtonExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    new ButtonExample().launch();
        void launch() {
            JPanel cp = new JPanel();
            JButton btn1 = new JButton("button 1");
            btn1.setFocusPainted(false);
            JButton btn2 = new JButton("button 2");
            cp.add(btn1);
            cp.add(btn2);
            JFrame frame = new JFrame("ButtonExample");
            frame.setContentPane(cp);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
    }

  • TS1702 Please I can not remove the viber icon from my iPhone 4s as it is a gray icon and have the word "waiting" under it and if I press long to have the (x) to delete it the (x) will not appear

    Please I can not remove the viber icon from my iPhone 4s as it is a gray icon and have the word "waiting" under it and if I press long to have the (x) to delete it the (x) will not appear

    Will it let you delete it on the phone now? If it still shows waiting, just tap it once on the app itself and it should download the rest  of the way. Do it while your on wifi tho.

  • How do I remove the spotlight effect on the bottom of my screen? I am running OS 7 on a Macbook. I have already tried the Shift Control Eject.

    How do I remove the spotlight effect on the bottom of my screen? I have already tried the Shift+Control+Eject.

    Could you please post a screen shot - not sure what you mean by spotlight effect.

  • I want to change the color, of the jbutton, when pressing on.

    Hey,
    There was a mistake in my last topic what I meant was that I want to change the color, of the jbutton, when pressing on, after pressed.he has to get his old colour. Now I already can change between the colours, but not, when i press on it, and i keep it pressed. It stays the standard-colour: gray.
    Best regards
    Stefan Parijs

    use this method to setr color
    JButton1.setBackground(java.awt.Color.pink);
    for event use the mousePressed or mouseDragged as the case you desire, there are other events too like mouseClicked,mouseMoved, mouseReleased,mousewEntered,m mouseExited
    check any method that suit your requirement
    best of luck

  • Does anyone know how to remove the fisheye effect from a gopro camera, remove it with premiere pro c

    Does anyone know how to remove the fisheye effect from a gopro camera, remove it with premiere pro cc.

    Use the Lens Distortion effect, set curvature to your liking.

  • I can't access my dial pad to make calls.   The last few days when I go to the phone a pop up appears that says "unfortunatly contacts has stopped working" after pressing ok to remove the pop up, it goes back to the home screen.  This also happens when I

    The last several days I have not been able to access the dial pad.  When I go to phone a pop up appears that says "unfortunatly contacts has stopped working."  To remove the pop up you have to hit 'ok', the it goes back to the home screen.  This also happens when I go to contacts. 

    You migh give resetting your NVRAM a try:
    http://support.apple.com/kb/ht1379

  • How do I removed the downloaded music from my ipad in the Music app with effecting icloud music?

    My music was taking up too much space so I joined itunes match, but the 6 gigs of my music is still on my ipad. How do I removed the downloaded music from my ipad in the Music app without affecting icloud music? I clicked to replace all music with icloud music. They both appear in Music and I don't see anywhere to remove all downloaded music. If I delete all music, I fear it will delete all music in iCloud. I assumed by joining iTunes Match that I would get the 6 gigs back for other items since my music should be on iCloud now. If that is not the case then I need to get my $ back for Match.

    Removing music from an iOS device does not remove it from the cloud.
    Go to Settings > General > Usage and tap Music (you may need to scroll down in the list). Swipe across "all music" and tap DELETE.

  • I plug in my printer and I get a message that says, "the disk you inserted is not readable." It didn't do this before but after I installed a segate hardrive software. I have removed the segate hardrive software but the message still appears.

    I plug in my printer and I get a message that says, "the disk you inserted is not readable." It didn't do this before but after I installed a segate hardrive software. I have removed the segate hardrive software but the message still appears. What can I do to remove this error.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    Third-party system modifications are a common cause of usability problems. By a “system modification,” I mean software that affects the operation of other software — potentially for the worse. The following procedure will help identify which such modifications you've installed. Don’t be alarmed by the complexity of these instructions — they’re easy to carry out and won’t change anything on your Mac. 
    These steps are to be taken while booted in “normal” mode, not in safe mode. If you’re now running in safe mode, reboot as usual before continuing. 
    Below are instructions to enter some UNIX shell commands. The commands are harmless, but they must be entered exactly as given in order to work. If you have doubts about the safety of the procedure suggested here, search this site for other discussions in which it’s been followed without any report of ill effects. 
    Some of the commands will line-wrap or scroll in your browser, but each one is really just a single line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, and you can then copy it. The headings “Step 1” and so on are not part of the commands. 
    Note: If you have more than one user account, Step 2 must be taken as an administrator. Ordinarily that would be the user created automatically when you booted the system for the first time. The other steps should be taken as the user who has the problem, if different. Most personal Macs have only one user, and in that case this paragraph doesn’t apply. 
    Launch the Terminal application in any of the following ways: 
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.) 
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens. 
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid. 
    When you launch Terminal, a text window will open with a line already in it, ending either in a dollar sign (“$”) or a percent sign (“%”). If you get the percent sign, enter “sh” and press return. You should then get a new line ending in a dollar sign. 
    Step 1 
    Triple-click the line of text below on this page to select it:
    kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}' | open -f -a TextEdit 
    Copy the selected text to the Clipboard by pressing the key combination command-C. Then click anywhere in the Terminal window and paste (command-V). A TextEdit window will open with the output of the command. If the command produced no output, the window will be empty. Post the contents of the TextEdit window (not the Terminal window), if any — the text, please, not a screenshot. You can then close the TextEdit window. The title of the window doesn't matter, and you don't need to post that. No typing is involved in this step.
    Step 2 
    Repeat with this line:
    { sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|org\.(amav|apac|cups|isc|ntp|postf|x)/{print $3}'; sudo defaults read com.apple.loginwindow LoginHook; sudo crontab -l; } 2> /dev/null | open -f -a TextEdit 
    This time you'll be prompted for your login password, which you do have to type. Nothing will be displayed when you type it. Type it carefully and then press return. You may get a one-time warning to be careful. Heed that warning, but don't post it. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator. 
    Note: If you don’t have a login password, you’ll need to set one before taking this step. If that’s not possible, skip to the next step. 
    Step 3
    { launchctl list | sed 1d | awk '!/0x|com\.apple|org\.(x|openbsd)/{print $3}'; crontab -l 2> /dev/null; } | open -f -a TextEdit 
    Step 4
    ls -1A /e*/{la,mach}* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta}* L*/Fonts .la* 2> /dev/null | open -f -a TextEdit  
    Important: If you formerly synchronized with a MobileMe account, your me.com email address may appear in the output of the above command. If so, anonymize it before posting. 
    Step 5
    osascript -e 'tell application "System Events" to get name of every login item' | open -f -a TextEdit 
    Remember, steps 1-5 are all copy-and-paste — no typing, except your password. Also remember to post the output. 
    You can then quit Terminal.

  • How at add closd function in the JButton??

    Hi, sir:
    I hope to add a closd function in the JButton, ie, like a JPanel or JFrame, there is a "X" sign icon on the right upper coner, when we click this X sign,
    whole window or JPanel or JFrame will be closed, here I hope to add a "x" sign in JButton, when I click it, itthis button b2 will be vanished.
    I update following code, but looks like not work, I hope Text and its icon on the leading Left, but closed sign is on the extreme end of right.
    Can guru help??
    Thanks
    import javax.swing.AbstractButton;
    import javax.swing.Icon;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.ImageIcon;
    import javax.swing.SwingConstants;
    import javax.swing.GroupLayout.Alignment;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    * ButtonDemo.java requires the following files:
    *   images/right.gif
    *   images/middle.gif
    *   images/left.gif
    public class ButtonDemo2 extends JPanel  implements ActionListener {
        protected JButton  b2,bclosed;
        public ButtonDemo2() {
             Icon closedIcon  = new ImageIcon("images/ActionButton/closed.PNG");
            ImageIcon middleButtonIcon = new ImageIcon("images/little.gif");
            JLabel label1 = new JLabel("Image and Text", middleButtonIcon, JLabel.CENTER);
            bclosed = new JButton(closedIcon);
            bclosed.setBorder(null);
            bclosed.setToolTipText("closed");
            b2 = new JButton("Middle button", middleButtonIcon);
            b2.setText("Middle button");
            b2.setVerticalTextPosition(AbstractButton.BOTTOM);
            b2.add(bclosed, -1);
            b2.setIcon(middleButtonIcon);
            b2.setHorizontalTextPosition(AbstractButton.LEFT);
            b2.setAlignmentX(LEFT_ALIGNMENT);
            b2.setMnemonic(KeyEvent.VK_M);
              b2.setToolTipText("This middle button does nothing when you click it.");
            //Add Components to this container, using the default FlowLayout.
            add(label1);
            add(b2);
        public void actionPerformed(ActionEvent e) {
            if ("disable".equals(e.getActionCommand())) {
                b2.setEnabled(false);
            } else {
                b2.setEnabled(true);
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("ButtonDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            ButtonDemo2 newContentPane = new ButtonDemo2();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

    Thanks, I add as follows:
    package a.border;
    import javax.swing.AbstractButton;
    import javax.swing.Icon;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    import javax.swing.ImageIcon;
    import javax.swing.SwingConstants;
    import javax.swing.GroupLayout.Alignment;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    * ButtonDemo.java requires the following files:
    *   images/right.gif
    *   images/middle.gif
    *   images/left.gif
    public class ButtonDemo2 extends JPanel  implements ActionListener {
        protected JButton  b2,bclosed;
        public ButtonDemo2() {
             Icon closedIcon  = new ImageIcon("images/ActionButton/closed.PNG");
            ImageIcon middleButtonIcon = new ImageIcon("images/little.gif");
            JLabel label1 = new JLabel("Image and Text", middleButtonIcon, JLabel.CENTER);
            bclosed = new JButton(closedIcon);
            bclosed.setBorder(null);
            bclosed.setToolTipText("closed");
            bclosed.setActionCommand("closed");
            b2 = new JButton("Middle button", middleButtonIcon);
            b2.setText("Middle button");
            b2.setVerticalTextPosition(AbstractButton.BOTTOM);
            b2.add(bclosed, -1);
            b2.setIcon(middleButtonIcon);
            b2.setHorizontalTextPosition(AbstractButton.LEFT);
            b2.setAlignmentX(LEFT_ALIGNMENT);
            b2.setMnemonic(KeyEvent.VK_M);
            bclosed.addActionListener(this);
            b2.setToolTipText("This middle button does nothing when you click it.");
            //Add Components to this container, using the default FlowLayout.
            add(label1);
            add(b2);
        public void actionPerformed(ActionEvent e) {
            if ("disable".equals(e.getActionCommand())) {
                b2.setEnabled(!b2.isEnabled());
            if             ("closed".equals(e.getActionCommand())) {
                  System.out.println("OK closed is pressed");
                  remove(b2);
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("ButtonDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            ButtonDemo2 newContentPane = new ButtonDemo2();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }But I cannot see the First Image I add in b2 such as little.gif and "Image and Text" on it, only I can see bclosed icon.
    what is wrong here??
    Thanks a lot
    Good weekend

Maybe you are looking for