How can I "hide" borders for buttons ?

Hello!
I have a toolbar with several buttons on it. If I run my application, these buttons appears initially with a border around.
I made a custom button, class which implements MouseListener (extends JButton of course) and for each event like mousePressed(...), mouseEntered(...) I set a specific border for my button.
If I move the mouse cursor over the button the border will not be visible because I use (setBorder(...) in my class) an EmptyBorder(...). I want to happen this when my application starts.
With respect,
Cristian

I changed a little your code to figure what's wrong; here it is modified code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class Test extends JFrame {
     public Test () {
          getContentPane ().setLayout (new FlowLayout ());
          ImageIcon icon = new ImageIcon("images/"+"save.gif");
          Action actionNew = new AbstractAction("save", icon) {
               public void actionPerformed(ActionEvent e) {
          JToolBar toolBar = new JToolBar();
          CustomButton save = new CustomButton(actionNew, "save");
          toolBar.add(save);
          getContentPane ().add (toolBar);
          setDefaultCloseOperation (EXIT_ON_CLOSE);
          setTitle ("Button without border");
          pack ();
          setLocationRelativeTo (null);
          show ();
     public class CustomButton extends JButton {
          private Border emptyBorder;
          private Border lineBorder;
          public CustomButton (Action act,String text) {
               super((Icon)act.getValue(Action.SMALL_ICON));
               //super (text);
               setFocusPainted (false);
               emptyBorder = BorderFactory.createEmptyBorder (1, 1, 1, 1);
               lineBorder = BorderFactory.createLineBorder (Color.BLACK);
               setBorder (emptyBorder);
               setToolTipText(text);
               addMouseListener (new MouseAdapter () {
                    public void mouseEntered (MouseEvent event) {
                         setBorder (lineBorder);
                    public void mouseExited (MouseEvent event) {
                         setBorder (emptyBorder);
          public static void main (String[] parameters) {
               new Test ();
     }And I realized that if I put my buttons on a toolbar they will be bordered and I don't now if I need to customize the toollbar too in order not show borders arround.
To run this code you should have an image called save.gif placed in images directory.
Thanks Levi, I will search further !
Kind regards,
Cristian

Similar Messages

  • How can you hide a Continue button until all clickboxes are clicked?

    I have seen similar questions to this one, but none seemed to be the exact situation as mine.
    What I have: Several images on a screen.  When a user clicks an image it is replaced with another image.  I am using clickboxes for this task.  I do not wish for them to toggle back and forth. Once they click the original image it should stay changed.
    What I am trying to do: Once a learner clicks all the images (in no particular order) a Continue button appears that allows them to go to the next screen.
    If anyone has some suggestions on this situation please let me know, thanks.

    I cannot log in on the forum for the moment, so will try by answering by
    mail. I was aware of that problem (have presented those solutions so
    often), thought that since you left all images visible once the click box
    was clicked it wouldn't be a problem.
    Two possible solutions:
       1. Easiest one: add a statement in the Always decision that will Hide
       the click box just clicked. It has no sense to click it another time. That
       will mean that you still can do it with a shared action but that shared
       action will have two parameters now, the second one being the click box
       that has to adapted on each application of the shared action.
       2. If you don't want to make the click box hidden (which means at the
       same time disabled), you'll need a user variable for each click box,
       starting with a default value of 0, and toggle it in the Decision 'Always'
       to 1. The second decision will then need a condition that checks the value
       of all the user variables (with AND) and shows the Next button only when
       all variables have the value of 1.
    Sorry, but have to mail, cannot offer a screenshot in that case.
    Lilybiri
    2014-03-13 5:31 GMT+01:00 Joseph_McDonald <[email protected]>:
        Re: How can you hide a Continue button until all clickboxes are
    clicked?  created by Joseph_McDonald<http://forums.adobe.com/people/Joseph_McDonald>in *Advanced
    Adobe Captivate Users* - View the full discussion<http://forums.adobe.com/message/6205043#6205043

  • There is a line showing on top of my ipod.  How can I hide it for make it disappeared?

    There is a line showing on top of my ipod.  How can I hide it for make it disappeared?

    Try a hard reset first.  To do this, press and hold both the Select (Center) and Menu buttons together long enough for the Apple logo to appear.
    The next step would be to restore the iPod to factory setting in iTunes.
    And if still no luck, it's likely a hardware issue/malfunction with the screen.
    B-rock

  • How Can I hide search help button in alv ?

    Hi Sdn .
    I want to hide search help button in my alv ..
    My  gs_fcat-f4availabl  = 'X'. is not active ..  but  there is search help button  .
    How Can I hide button .
    Regards  .
    Serkann

    donnot pass any values in field catalog for reference field and reference table.
    or dont use any standard data element

  • How can I hide the marker button in an ALV GRID line?

    Hi all,
    I am switching an old program from ALV LIST to ALV GRID. In the old list, I put a checkbox on each line to abilify the user to mark some lines. However, there are some lines that I don't want the user to select. In the list, I set the field for the box name to "*" (asterisk) and in the list, the checkbox is not input enabled.
    Now in the grid, this does not function any more. all lines are markable. How can I deactivate the marker function for some lines?
    Greetings
    Jörg

    Hi,
         use the below snippet in your code
      DATA: ls_celltab TYPE lvc_s_styl.
      REFRESH pt_celltab.
      IF p_mode EQ text-103.
    *§2a.Use attribute CL_GUI_ALV_GRID=>MC_STYLE_ENABLED to set a cell
       to status "editable".
        ls_celltab-fieldname = c_character1.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_character2.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_character3.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = text-107.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
        ls_celltab-style2 = cl_gui_alv_grid=>mc_style_f4.
        INSERT ls_celltab INTO TABLE pt_celltab.
        ls_celltab-fieldname = c_selectionid.
        ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
        INSERT ls_celltab INTO TABLE pt_celltab.
    Regards

  • How can I Hide/ Disable the Question mark and Exit button in the Top right corner of Link Bar of Excel Documents in SharePoint 2013?

    Hi,
    How can we  Hide / Disable the Help(?) and Close(x) buttons which are located in the right corner of the Top Link Bar in the Sharepoint Document Library pages as well as Excel Web Access?
    Our requirement is : When we try to view the Excel Services Report from another web site, Help(?) and Close(x) icons are also appearing in the Excel Web Access Web Part, but we don't want to display them in our site.
    Please let us know the solution for this case.
    Thanks in advance.
    Regards,
    Sanjana

    Hi,
    In the xlviewer.aspx, we can find the two buttons like this:
    To hide them, you need to add the CSS into the xlviewer.aspx which stays in:
    C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • How can I hide a worksheet in a workbook in Numbers 1.5 for iPad?

    How can I hide a worksheet in a workbook in Numbers 1.5 for iPad 2?

    Numbers for the pad, as near as I can tell, does not do hidden sheets.  There are some options though.
    1. You can narrow the columns to the point that they are unreadable.
    2 you can open and store those sheets is a different app, such as docs to go or quickoffice.  Bury that app in a folder that would not be found easily.
    To see the numbers help section, open numbers, tap the wrench and tap help. 

  • How can I hide the borders and keep it as an option?

    How can I hide the borders and keep it as an option?  I had someone go into the css I believe, and make it so there were no borders visible on the page (I could see the dotted outline while working on it, but when pushed, it wasn't visible (which is what I wanted).  They called it "noborders."  Since I had to reinstall, it went away.  Help?
    I have Dreamweaver CS5.5

    Try this site:  CSS Border
    Add code then type in a zero. Later add border size you want.
    examples:  border: 0px solid black;
    or
    border: 1px 000000;
    or
         border-top-style: solid; 0px 000000;
         border-right-style: dotted; 0px 000000;
         border-bottom-style: solid; 2px 000000;
         border-left-style: dashed; 1px 000000;

  • How can I hide the error prompt for confirm?

    As I schedule job the read PDF to Text program, but acrobat prompt "Message Box for confirm" while error throws.  How can I hide this?
    My code as below:
                    Acrobat.AcroApp gAppClass = new Acrobat.AcroApp();
                    gAppClass.Hide();
                    Acrobat.AcroAVDoc avDoc = new Acrobat.AcroAVDoc();
                    if (avDoc.Open(filespec, string.Empty))
                        Acrobat.AcroPDDoc pdDoc = (Acrobat.AcroPDDoc)avDoc.GetPDDoc();
                        string txt = PdDocGetText(pdDoc);
                        pdDoc.Close();
                        avDoc.Close(1);
                        gAppClass.Exit();
                        return txt;
                    else
                        return null;

    I find a solution from MVP.
    http://forums.adobe.com/thread/1435717?tstart=0

  • How can I click on a button and make a text box appear or disappear

    How can I click on a button and make a text box appear or disappear?
    Thanks ahead of time for your help,
    Doug

    Hi Denes,
    I just thought that the example you pointed the OP to, is far more complex than what I understood he needs. The OP was talking about using a button, which I thought was a very basic and simple case. Your example is much more complicated. If memory serves, the radio group item, at the time (prior to 3.1 fieldset) behaved differently, so you needed to create a new value retrieving function, and then was the need to preserve the items show/hide status upon reloading the page. In short, I thought maybe I didn’t see the complexity in the OP post, but it seems that his requirement was indeed a simple one.
    Regards,
    Arie.

  • How can I hide my e-mail???

    How can I hide my e-mail???

    Hi, Smittycoco, and welcome to the Community,
    Your Skype account's registered e-mail address is not displayed anywhere.  You are the only one who can see it.  You may, however, remove e-mail addresses from your Profile settings -- even though e-mail addresses added there are again only viewable by you (private) and used only as a way for your friends, family, and colleagues to locate you on Skype.
    If there is something I am mistaking or missing, please do post back with a screen shot where you are seeing your e-mail address displayed.  Please, redact or 'white out' any personal information before uploading your screen shot.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • How can I hide figures or characts. using javascript in wad report BI NW 7

    Hi,
    How can I hide figures or characteristics using javascript or command in wad report ( BI NW 7).
    I have read the documentation for WEB API, but it doesn't provide some info on that area.
    Thank you.
    Edited by: Sergey Antonov on Jul 29, 2011 3:08 PM

    You can use REMOVE_DRILL_DOWN in WAD to remove characteristic..to remove a keyfigure with a button you could a variable with that button, which makes an invalid selection of the keyfigure though it is 2000, e.g. set CALYEAR = 1900.
    Hope it helps,
    Christian

  • How can you get your submit buttons to be a single click instead of the default double click?  (The

    How can you get your submit buttons on the quiz template to be a single click instead of the default double click?  (The option to choose double click or not is not showing in properties for this).

    Hmmm... Submit button doesn't need a double click at all. Maybe you are talking about the two-step process? When you click on Submit, the feedback appears with the message to click anywhere or press Y. Is that what you are talking about? If you are talking about a real double-click, something must be wrong in your file. And which version are you using?
    http://blog.lilybiri.com/question-question-slides-in-captivate
    Lilybiri

  • How can I hide the class file ??

    Hi !
    I has a question, when i write a program of Java, then use the command "javac" to compiler to class file for other people using, but the class file can be disassembled and convert to source code. How can I hide the class file and let people can not disassemble, or can not see the source code. Thinks

    See these....
    http://www.saffeine.com/
    http://www.jarsafe.com/
    I recently read this. This will help you.
    http://developer.java.sun.com/developer/qow/archive/160/index.jsp
    Enojy....
    Rajesh

  • How can i disable a submit button and execute submit_action method on click

    Good Day,
    On my page I have a submit button that execute the submit_action method of the page backing bean that submit data captured on the page into a database and activate another class that send mail at the same time on a click of the submit button,the mail process takes a while before returning back to the page.I was able to disable the submit button to prevent the user from keep click while the process is running but the issue is on clicking the submit button it only disable the submit button without executing the submit_action method of the page backing bean.How can i disable the submit button and execute submit_method of the backing bean at the same time.
    Thanks in advance.

    I tried this out on one of my pages to see if it works.
    First, I added the following JavaScript to my submit button's onClick event:
    this.disabled=true; return true;When I clicked the submit button, it was disabled but the form was not submitted.
    I deleted the JavaScript from the onClick event and added the following JavaScript to the form's onSubmit event:
    var button = document.getElementById("form1:submitButton"); button.disabled=true; return true;When I click the submit button, it was disabled and the form was submitted but the button's action method was not called.
    The next thing I tried was to change the onSubmit event code:
    var button = document.getElementById("form1:submitButton"); setTimeout("button.disabled=true", 500); return true;This seemed to work. The difference was that I added a 1/2 second delay before disabling the button.
    See if that works for you. If not then I'm fresh out of ideas.

Maybe you are looking for