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);
}

Similar Messages

  • Is there a way to remove the GNome border for Firefox in Fedora 20 (gnome desktop)

    Hi I have Fedora 20 with Gnome 3 desktop. The Firefox 31.0 has a bar above the tabs where it displays a bar and it shows the page title. Is there any way to remove it as it uses some space and I hate it. Is there any way to hide it or remove it.
    I have added screenshots just for reference: https://www.flickr.com/photos/jayabharat/15136543446/ https://www.flickr.com/photos/jayabharat/15159579845/

    Well, that works in my Windows, but not in Gnome 3. So In order to remove the title bar, I had to use Add-ons.
    HTitle 2.13 did wonders.
    Hide Caption Titlebar Plus 2.8.6 is also a good option.

  • How do I remove the inside border in a JScrollPane?

    I'm trying to embed a JTextArea inside a JScrollPane. Not sure if it matters, but the JScrollPane is inside a JSplitPane, i. e.
    JSplitPane js = new JSplitPane(...)
    JTextArea ta = new JTextArea();
    JScrollPane sp = new JScrollPane(ta);
    js.setBottomComponent(sp);Now when the whole thing is seen, a black border is drawn around the TextArea ta. How do I remove this? Doing sp.setViewportBorder(null) doesn't help. Please help! THX.
    Edited by: solletica on Jun 10, 2008 8:45 AM
    Edited by: solletica on Jun 10, 2008 8:50 AM

    The problem is seen ONLY when the neither scrollbar is visible, i. e. when the AS_NEEDED property is set on JScrollPane. When this happens, a black square border is visible around the JTextArea.
    However, when the vertical or horizontal scrollbars are shown, the portion of the border where the scrollbar appears isn't visible (or noticeable).
    Correct me if I'm wrong, but doesn't JComponent.setBorder() only set the OUTSIDE border of a JComponent? I want to eliminate the border being shown around the JTextArea (i. e. between the JTextArea's bounds and the JScrollPane).
    Edited by: solletica on Jun 10, 2008 9:24 AM

  • Removing the Flash Border in HTML

    Hello there,
    Does anyone know if it's at all possible to remove the,
    clear, dotted border around any Flash in a HTML document? I've seen
    several websites which don't have the border around. I've created a
    Flash menu for my website and having the border makes this
    difficult, one has to click on the menu then one has to click on
    the button to lead them to where they want to go.
    Regards,
    Kristopher (UK).

    Hi,
    Yes you can by including your the SWF embed code in a
    separate JS file and call it form your HTML page. Adobe released an
    extention to solve this problem on the following link:
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=7c29e252
    And if you search on google you can find more methods to
    solve your problem (I guess
    http://www.cartoonsmart.com/
    got another methods too)
    Hope this helps

  • How do I remove the black border from around my videos?

    I have PE7 on my Dell laptop with Windows 7. I've been editing videos on it probably since January. I just never thought anything of the black border, but recently it's really been bugging me. I tried Googling some answers, but all I found was to switch your camera to 16:9 Widescreen. My JVC Everio GZ-MG555U was already set to that setting. I'm just frustrated & I want to get rid of this border. If anyone knows the answer to this problem, please let me know. I need help!

    makaylaamae
    Thanks for staying with the troubleshooting. I will stay with this as long as it takes to get the project to a successful conclusion. Let us work through this step by step.
    1. The readout that you give for your JVC video file is consistent with what those .mod widescreen files have been reading out as, that is,
    720 x 480 with a pixel aspect ratio of 0.9091 (standard 4:3) rather than 720 x 480 with a pixel aspect ratio of 1.2121 (widescreen 16:9).
    2. Premiere Elements 7. Start a new project with the project preset of NTSC DV Widescreen.
    3. With Get Media/Files and Folders import your video clip into the project and drag it to the Timeline.
    4. Go to Interpret Footage and, in the Interpret Footage dialog, dot the Conform to: and change the Pixel Aspect Ratio to
    D1/DV NTSC Widescreen 16:9 (1.2).
    5. Right click the Monitor, select Magnification, and make sure that that the setting is "Fit". Now look at the Edit Mode Monitor space. Is the area designated for the video display filled? No black borders? If so, continue. If not, you are going to scale the video to make the fill. It should not take much scaling for this if needed.
    a. Select your video on the Timeline
    b. Open Properties/Motion Panel to reveal Scale. Use the Scale slider to zoom in to fill the monitor space to the minimal degree to achieve that purpose, that is, getting rid of any unfilled space (black borders).
    6.Then export that Timeline to a NTSC DV AVI widescreen file, saving it to the computer desktop.
    Use Share/Computer/DV AVI with Presets: DV NTSC Widescreen
    Check out how your NTSC DV AVI widescreen plays back on Windows Media Player. Nevertheless, continue on....
    7. Go to the YouTube web site and upload your DV NTSC Widescreen there. And, let us know the results.
    We can talk about the upload of your Premiere Elements 7 Timeline with its mod widescreen to YouTube from within Premiere Elements 7 Share/Online/YouTube next if necessary. If you have any problems along the way, stop, let us know the details, and we will work out the problem before continuing with the next steps.
    Thanks.
    ATR

  • Quick question to you n91 owners about the wi-fi

    i borrowed an n91 a couple of weeks ago and i'm sure i used it to connect to the instant messenger app built into the phone via www.packetbox.com using wi-fi? but now i have got an n95, there is no option to set to wi-fi connection within the IM apps settings?
    even if your not using packet box, would you mind having a quick look and see if you can set a wi-fi access point within the server settings?
    cheers
    Nexu 5

    If it is a hardware issue, then you don't get charged the $19.  But, if it turns out to be a setting you messed up, then YES, they will want to charge you $19 to help you learn how to use your phone after your 90-days of FREE phone support expired.  Or you could read the manual or articles that are available for free online.
    Basically, if you want someone to hold your hand, then you'll pay for it.
    However.... having said all of that, try this article: http://support.apple.com/kb/ts1559

  • Quick question - unchecked songs and videos in the iTunes library

    Will these or should these show up in Apple TV ?
    Reason I ask is that they are unchecked as they won't all fit on the iPod touch. However, there is no reason why I wouldn't want to listen or watch them through Apple TV.

    If they are unchecked in the iTunes library, they won't show up on tv. You should still be able to check them separately for iPod using the devices on the left and sync options across the top. ie. I have some thing unchecked so tv won't list them but I sync those same items to iPad/iPhone by using their individual sync options.
    Hope this helps,
    Captfred

  • Removing the black border from exported videos

    Ok, basically I'm trying to rip DVD footage and convert it to something playable on an iPod. Nothing too hard getting it ripped and converted and all, but the VOB files didn't break right on the episodes, and I also wanted to edit out the theme from the beginning of EACH episode in the interest of space.
    Overall it's working pretty well so far, I've been able to perform all that I needed to do, but when I export I get a wide black border around the video which looks fine now, but will take up a lot of valuable space when reduced to iPod resolution. I've found ways to change the color of the border in FinalCut, but no real way to remove it. Anyone have a way of dealing with this?

    Ok, figured out what to do.
    If you go to the canvas, hit the box for the borders, tell it to show the wire frame. Click and you can rotate, resize, etc.

  • How to remove the window border in SAP Script

    Hi,
    In my requirement when I create any window in SAP Script, in the output the border around the window should not be displayed.
    Request to suggest how to proceed on this.
    Thanks,
    Naresh

    Hi.
    I assume that in the window's code, there is a "BOX" statement. Just comment it out and you are done. If you are using SMARTFORM, there is a respective checkbox in the windows properties.
    Reward please if it helps.
    Regards,
    George

  • Removing the Black Border

    Hello 
    I recently I used a HDRPJ230 SONY HANDYCAM PROJECTOR to do some filming. When I uploaded the film to my iMac, I noticed that is a wide black border around the film content.
    How do I get rid of this wide black border which takes up a lot of the screen?
    All guidance appreciated.
    Regards,
    Peter
    iMac, OS X Mavericks (10.9)

    Ok, figured out what to do.
    If you go to the canvas, hit the box for the borders, tell it to show the wire frame. Click and you can rotate, resize, etc.

  • 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

  • Photosmart 8230. How do you Remove the print heads for cleaning?

    Hi guys, I have a Photosmart 8230. After a few lines of printing the black ink fades to almost nothing, all the colours are perfect. There are no error messages. I have done the self cleaning and alignment procedures and wasted a lot of expensive ink. The test page comes out with streaks on the black only. It has been suggested that I take the print head out and immerse it in hot water as a last resort. The question is, how do I remove the printhead? or should I use it as a sea anchor!!
    This question was solved.
    View Solution.

    I just did this to a HP Photosmart 8250 which is in the 8000 series range. I assume they are similar. I was an appliance repair man and have done a lot of other tings in my life, so I decided to take a shot at repairing my 8250 rather than junk it. For 3 Years it was great, only one paper jam, and fast great photos, so I didn't want to give up on it. HP will not repair printers for us, I think because it is too labor intensive, and they can sell a new one for what it would cost.
    I actually fixed my HP Photostat 8250. Its working but the color printing is not as good as it was, yet, but I am hoping that will improve as all of the colored inks work their way through the system.
    Taking one of these apart and putting it back together is like a Chinese puzzle, so its appropriate that they are made in China. Most of the parts inside can be easily damaged if you are not careful. The covers have very clever ideas to their design and how they snap in place. Take your time with the covers and use small tools.
    Getting it back in working condition is another matter. There is a 6 circuit pump and more than a few feet of tubing. I had the side covers off while I tested it and this pump seems to work in both directions. This pump is inside the left side cover. There is another motor with a timing wheel of some kind that stops and starts in both directions at the same time the printhead carriage is whipping back and forth printing. There are other motors also. These things are ingenious. It is surprising that I bought it for less than $100 on sale. It looks like a $1000 piece of equipment inside.
     It would probably be a good idea to not remove the left side cover, but if you do, be very careful around the clear timing wheel. it looks delicate. Below is from an email I sent to a friend and I am revising it to make sense. Remember this is something that really requires training to do this, but I see people today that have the guts to tackle all sorts of projects, so for what its worth, and you asked.
    Under the right side cover is a motherboard, with a bunch of cables plugged into it, small, larger and even ribbon cables. I found it necessary to remove the motherboard. I had a bit of experience working on Canon printers and I would also suggest you take digital pictures as you go so you can view them on your PC. I am also going through this because I don't like being told we can get anything repaired correctly today, its ridiculous that these printers have become just more throwaways. If you want to do this, as a guide, I must have spent 8 to 10 hours doing this, but now I could do it again in 2, that is the learning process.
    Once you get the top off the printer, you will see the printhead carriage. The carriage will be to the right side. The printhead is retained by two screws at the front, (take pictures) a spring clip at the rear and two screws that hold a plastic cover over the six ink hoses that plug into the printhead, its a manifold strip affair. You have to unplug the manifold to remove the printhead, but now I am not 100% sure its necessary to remove the printhead? The ink gunk you will see after you move the printhead to the left is no doubt most of the problem.
     Probably after the hot water treatment as described below, the built in printhead cleaner will be able to resume cleaning the printhead, after the hot water cleans the gunk from IT.
     I removed the printhead like I say below, but first do this. Under the printhead there is a little carriage with a patch of foam rubber that cleans the print head nozzles.This little device works back and forth while cleaning, but while it is parked, with the printer off, it is forward and you won't be able to move the printhead. Use a flashlight to be sure and you will see how to push the cleaner carriage  to the rear and then move the printhead carriage to the left. THEN, you will see the gunky ink mess that has accumulated. This gunky mess I think is the main problem. There are also some felt pads below the cleaning device to absorb some of the ink gunk. I don't know how the HP techs do this, but I used the hot water method below, I had nothing to lose. I would move the printhead first and then you can decide about removing it. I would make sure not to get any of the electronics wet and why I removed the motherboard and why I say take photos. Its hard enough to remember where the different screws alone go, when you are doing this. It can be done, mine is working, even if not perfectly, YET.  You need to be very careful with your fingers, because it is hard to find space to hold onto the printer and whay it might be a good idea to not remove the left side.
    They are so complicated, its just a matter of time before they get gunked up with ink and the printhead begins floating in the mess. I had nothing to lose so I removed the printhead, carefully, taped up all the hoses so they didn't dry out, Then I removed the motherboard to keep it from getting wet, THEN I held the messy ink end under the HOT water in the laundry tub and flushed out enough ink to dye a bathtub full of water. The hot water worked well. Then I let it all dry out. There are some delicate procedures to all of this and it takes time. I think that is why its very hard to find anyone to fix them. Its labor intensive and probably why HP won't repair them.  The print section is the problem, and why I won't buy an All in One printer, Fax, and Scanner. I do buy the extended warranty's now. If you tackle this, take your time, take photos, and good luck. By the way, the 8250 uses O2 print cartridges, is that the type of printer you have, but a lot of this applies to other printers and other brands, and I bet I am not the only one to do this. Before I started this the diagonstics showed no problems, so I assumed it was the the ink aspect of the printer, and not an electronic of mechanical problem. I hope this helps.
    ----- Original Message -----

  • How to remove the buttons

    When I use quiz manager to make some test question, I would
    like to remove the bottom buttons ,
    For example, play button, I just need submit button. Would
    you all to tell me how to do it? Thanks.

    You can actually remove the playbar from the entire presentation.  Here's what I did. 
    I created a simple "shell" presentation of only a few slides with a standard look and feel that I would use on all the presentations requiring no playbar. In the theme editor, I set everything up as I wanted it (the playbar will show at first), I then did a save as with an appropriate name for the theme.  Next, I published the presentation using the theme name.  In the published data file, I opened the vconfig.xml file in notepad and altered the playbar line from
    <uishow name="playbar" value="true"/> to <uishow name="playbar" value="false"/>
    I then copied the entire published folder and placed it C:\Program Files\Adobe\Presenter 7\Themes
    The next time I go to create a presentation, I go to the theme editor, choose the theme I created and you will notice that the playbar will not appear.

  • Remove the flashback logs in EBS envoirnment.

    Hi,
    In my production database(primary) machine flashback is ON.
    So, logs are creating in following directory:
    /d01/silprod/SILP/db/apps_st/data/archives/SILP01_SER/flashback
    In my physical standby database flashback is OFF.
    So, My question is that:
    Can I remove the flashback logs from production safely?
    Thanks.

    Hi,
    How to identified that which archive logs no longer needed and can delete, and how to reclaim the archive space?
    Is below steps are correct?
    Archive location: /d01/silprod/SILP/db/apps_st/data/archives/SILP01_SER/archivelog
    Archive files name like: o1_mf_1_894_5jpkly8k_.arc -------------> Sequence#=894
    Archive Size occupied:
    > du -sh archivelog/ ------------> 2.7G archivelog/
    STEP#1:
    SQL> SELECT THREAD#, SEQUENCE# FROM V$LOG WHERE STATUS='CURRENT'; -----------> RESULT: THREAD#=1 AND SEQ$= 894
    SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;---------------->DONE
    SQL> SELECT THREAD#, SEQUENCE# FROM V$LOG WHERE STATUS='CURRENT'; -----------> RESULT: THREAD#=1 AND SEQ$= 895
    Confirm the current file have been applied to the standby database with the below query
    SQL> SELECT MAX(SEQUENCE#) FROM V$LOG_HISTORY; -----------------> RESULT: THREAD#=1 AND SEQ$= 894
    Step#2:(Memory)
    > delete unwanted archive log files from disk (rm, del commands)---------> all archives files deleted expected of PROD_1_894.arc
    RMAN> crosscheck archivelog all; - marks the controlfile that the archives have been deleted
    RMAN> delete expired archivelog all; - deletes the log entries identified above.
    But, How to identified that which flashback files no longer needed and can delete, and how to reclaim the flashback space?
    Flashback location: /d01/silprod/SILP/db/apps_st/data/archives/SILP01_SER/flashback
    Flashback files name like: o1_mf_5jlc8gb0_.flb, o1_mf_5jlcb2bv_.flb etc ------------> how to identified which file(File Name has no sequence#) should I delete?
    Flashback Size occupied:
    > du -sh flashback/ ------------> 3.5G flashback/

  • Just a quick question regards my mobo..

    I might possibly bricked my motherboard which I already ask a while back,, just a quick question,,, Now I did hooked up the powersupply to the motherboard alone,,, no other components,,, just the PSU and motherboard,,, then I use a paperclip to put static force on the motherboard's power button ( where powercables on the case should suppose to be in ),,, now the motherboard just keeps on blinking as my problem b4,, so its really the motherboard right??? I just want to confirm that the motherboard is the problem and no other components... thnks

    It is finally enough n2th2n. Don't open tons of threads for the same issue. For your board issue use your original thread: forum-en.msi.com/index.php?topic=184002
    Consider this a final warning.

Maybe you are looking for

  • Shutting down from a console you're not using.

    As described by many users of fglrx or r128 on old cards... when shutting down from inside X, there is a very good chance that the computer will freeze before it finishes shutting down. Nothing I can do saves that and from others I hear the only way

  • AMD Radeon HD 7670M

    I am looking at replacing our laptop, mainly used for travel, with one that is good for CS6 applications but neither very big in screen size nor too heavy ie not a gaming laptop. For Photoshop and many other CS6 applications the Ivy Bridge systems cu

  • Unable to start Analytic Workspace Manager

    Hi, I have installed the 10g client on my PC (Window XP professional). Nevertheless, when I tried to start the Analytic Workspace Manager, it just crashed with the error "no JAWTAccessBridge in java.library.path" Below is the full error log. C:\oracl

  • ABAP METHODS : HELP

    hello friends,                     I need some basic stuff on Method like what actually there role is in ABAP as i am shifting to OOPS . I have read some document but all are explaning methods with classes , kindly reply with some stuff which should

  • Suddenly applet stopped working on IST 13 Sept 2012 12:25 in 50% Linux Machines

    I am using Applet for Raw Dot Matrix Printing. I.e. Its like "lpr test.txt " in linux. Few days back on 14th august you have disabled the applet. As per forum we have enabled it. Now same issue arrived on 13 Sept 2012 at 12:25 ... Please help me why