Simulating visual behaviour of buttons on button bar, like Firefox.

I want to introduce visual behaviour like the Firefox button bar, where the buttons display with no background and no border, until you mouse over them.
I have a panel that I use to display a button bar. The buttons on the button bar are instances of JButton.
I can use jButton.setBorderPainted(false) and jButton.setBorder(null) to turn off the button frame.
However, when using a look and feel, set by UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()), then the borders always paint.
How can I turn off the borders and background for these buttons?

On windows xp platform
use JToolBar instead of panel, look at the code below and try to run it on windows xp platform
import javax.swing.UIManager;
public class NewJFrame extends javax.swing.JFrame
    public NewJFrame()
        initComponents();   
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
        jPopupMenu1 = new javax.swing.JPopupMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jToolBar1 = new javax.swing.JToolBar();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jMenuItem1.setText("Item");
        jPopupMenu1.add(jMenuItem1);
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jToolBar1.setRollover(true);
        jButton1.setText("jButton1");
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton1);
        jButton2.setText("jButton2");
        jButton2.setFocusable(false);
        jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton2);
        jButton3.setText("jButton3");
        jButton3.setFocusable(false);
        jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton3);
        getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH);
        pack();
    }// </editor-fold>
    * @param args the command line arguments
    public static void main(String args[]) {
        try
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        catch(Exception e)
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPopupMenu jPopupMenu1;
    private javax.swing.JToolBar jToolBar1;
    // End of variables declaration
}

Similar Messages

  • How Can I disable Button from Button Bar on OAF page

    Hi Everyone,
    We have a requirement like, in button bar I need to hide one button.
    I worked on personalization but there is a option to hide entire button bar, not single button.
    If I extend controller, how can I proceed , please provide steps.
    or
    please provide how can i achieve this??????
    Thanks,
    Rakesh

    Hi,
    If your issue has been resolved than please close the thread so that it can be helpful for others as people may search with answered threads.
    --Sushant                                                                                                                                                                                                                                                                                                                                   

  • What's wrong with my toggle button bar?

    I've used one before, and I don't understand why my toggle
    button bar is not showing the "active" state for the first index of
    the viewStack it is linked to.
    Normally, I use mainStack.selectedIndex = 0 and that
    highlights the first (default) item of the view stack.
    I change the viewstack with a timer, and all subsequent
    states the correct button highlights, even when I have it loop
    around to the first item again. It's only initially on load.
    Thoughts?

    Thanks, Greg.
    That didn't work either, but it got me thinking. Moving it to
    the end of the function that assigns the children to the view stack
    finally worked:

  • How to remove the divider at the end of application panel page button bar

    I want to remove the divider at the end of the application panel's page button bar. I dont see a handle in the propery inspector which can be set or unset to remove this divider.
    I am thinking more in lines of something like a "SecondaryToolbarRendered =false" kind of thing to remove this divider.
    Any suggestions?

    Applications Panel is an internal Fusion Apps component. Please post this in Oracle's intrnal ADF Frontnd Forum at myforums.oracle.com.
    We , the world outside Oracle are oblivious to this component :)

  • Tom Wolskys book-"Editing Workshop Button Bars"

    I have fce hd v 3.5 but I purchased tom's bookFCE 2 Editing Workshop. I figured I could bridge the gaps between the little differences between the book and my newer version but I have run into a very minor problem. For some reason I am unable to locate "Load Button Main Button Bars"(p16, par4) function in order to navigate to the "extras" file on the dvd. When I double click on the "Editing Workshop Button Bars" it says File Error: wrong type. I know this isn't critical, and I am probably missing something simple but I don't want to miss a beat in learning this software. Could someone help? Thanks.

    You have to right-click on the button holder itself.
    The terminology has been changed to "Load All Button
    Bars." Then from the navigation dialog select the
    file from the disc.
    Thank You Tom. I appreciate it.

  • How do I set up a new button on the button bar?

    I was used to previous versions of A/Works in which you just needed to create a macro. In the latest version, it's not so simple. Could someone let me know, preferably in words of one syllable (lol), the steps to take to set up a button. I want a double underline one, it's so frustrating not having one as I use it all the time.
    Any help gratefully received!
    Thankyou
    Marianne
    Mac Pro   Mac OS X (10.4.9)  

    In the Finder, choose New Finder Window from the File menu, and then locate and click on the item in the sidebar named Applications. Next, open the AppleScript item inside, find the Script Editor application, and double-click it. Copy and paste the following text into it up to the second blank line following:
    tell application "AppleWorks 6"
    set style of selection of document 1 to {class:text style info, on styles:{double underline}}
    end tell
    Press the Command and S keys, choose Application as the File Format, and click Save. Open AppleWorks and click on the AppleWorks menu, followed by scrolling down to Preferences and clicking on Button Bar. Find and push the New button, choose Launch Application from the Action drop-down menu, click Choose, locate the script, and click OK.
    (20382)

  • Using a Button Bar and Menu Control

    Hi All,
    I am using button bar and menu bar control .But the problem  i am facing is that  how to align menu to the bottom of respective button of button bar.
    Tanks In advance

    Hi All,
    I am using button bar and menu bar control .But the problem  i am facing is that  how to align menu to the bottom of respective button of button bar.
    Tanks In advance

  • How could i put image in button bar

    import events.ToolbarEvent;
    import mx.events.FlexEvent;
    import mx.events.ItemClickEvent;
    import mx.events.SliderEvent;
    import mx.core.*;
    import spark.skins.spark.ImageSkin;
    import ui.presenters.MainPresentationModel;
                [Bindable]
                public var fileButtons:Array = [{label:"Open"},{label:"Save"}];
                [Bindable]
                public var navButtons:Array =
                    {label:"Adjust",state:MainPresentationModel.ADJUST_STATE},
                    {label:"Touchup",state:MainPresentationModel.TOUCHUP_STATE},
                    {label:"Effects",state:MainPresentationModel.EFFECT_STATE}
                [Bindable]
                public var historyButtons:Array = [{label:"Undo"},{label:"Redo"}];
                private function handleFileClick(e:ItemClickEvent):void
                    if (e.label == "Open")
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.OPEN));
                    else if (e.label == "Save")
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.SAVE));
                private function handleNavClick(e:ItemClickEvent):void
                    callLater(handleNavigation,[e.item.state]);
                private function handleNavigation(state:String):void
                    if (navBar.selectedIndex == -1)
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.SHOW));
                    else
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.SHOW,true,false,state));
                private function handleHistoryClick(e:ItemClickEvent):void
                    if (e.label == "Undo")
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.UNDO));
                    else if (e.label == "Redo")
                        dispatchEvent(new ToolbarEvent(ToolbarEvent.REDO));
                private function handleZoomChange(e:SliderEvent):void
                    dispatchEvent(new ToolbarEvent(ToolbarEvent.ZOOM, true, false, null, e.value));
            ]]>
        </mx:Script>
        <mx:ButtonBar dataProvider="{fileButtons}" itemClick="handleFileClick(event)"   />
        <mx:ToggleButtonBar id="navBar" dataProvider="{navButtons}" toggleOnClick="true"
            creationComplete="event.target.selectedIndex=-1" itemClick="handleNavClick(event)"/>
        <mx:Button label="Show Source" click="dispatchEvent(new ToolbarEvent(ToolbarEvent.SRC))"  />
        <mx:Spacer width="100%" />
        <mx:ButtonBar dataProvider="{historyButtons}" itemClick="handleHistoryClick(event)"  />
        <mx:HSlider value="1.0" minimum="0.1" maximum="3.0" snapInterval="0.1" liveDragging="true" change="handleZoomChange(event)" />
    </mx:HBox>
    using this code what shoud i do to add image on button bar

    I would extend the button bar and in create children I will add the image.

  • Anyone know of a "button bar" toolkit?

    I know it goes against everything I think about Microsoft, but I am looking for a button bar similar to those in MS API. As long as there is a standard, I may as well use it.
    For those who are unaware of what I speak, a button bar is a set of icon/text/icon&text buttons that appear at the top of some applications (most these days). I have Eudora, which has a great example of the button bar, but also, Power Point, Exel, and other MS apps have them too. I want to be able to easily create them in LabVIEW.

    Labviewguru,
    I've done a presentation a few weeks ago, and it's online. It has an example
    of the a "toolbar" and "coolbar" (coolbar is when the icons change when the
    mouse hovers above them...).
    It's just an example, one simple, and one with menus that come out of the
    buttons (like the 'New' button in IE).With some imagination dynamic menus
    and other stuff can be implemented (easily..).
    It's at the bottom of:
    http://www.air.nl/info/ww.html
    (Please don't mind the picture, not one of the best pictures of me!) The
    text at the site is dutch, but the presentation is in english. It covers
    several COM objects, including the buttons.
    Also note that the VI's are ment to illustrate the technique. The use of Sub
    VI's is recommended, but avoided to clearify t
    he technique.
    Have fun,
    Wiebe.
    "Labviewguru" wrote in message
    news:[email protected]..
    > I know it goes against everything I think about Microsoft, but I am
    > looking for a button bar similar to those in MS API. As long as there
    > is a standard, I may as well use it.
    >
    > For those who are unaware of what I speak, a button bar is a set of
    > icon/text/icon&text buttons that appear at the top of some
    > applications (most these days). I have Eudora, which has a great
    > example of the button bar, but also, Power Point, Exel, and other MS
    > apps have them too. I want to be able to easily create them in
    > LabVIEW.

  • Created a custom button bar and pull-down menus are missing

    created a custom button bar and pull-down menus are missing.
    I want pull-down menus of 'action', 'edit', 'query', 'block','record', 'field', 'window' and 'help' to display.
    What property setting or other item do I need to change?
    Thank you for your help.

    You could try this, I haven't used it before so I'm not sure if it's what you're looking for but it's worth a shot if you can't get anything else to work.
    http://web.mac.com/ijasonwhite/iwebunlimited/TipsBlog/Entries/2008/12/29_Drop_Down_Navigation_iniWeb.html
    Hope this helps!
    Josh

  • Page button bar

    How to create button region such that the buttons appear both on top and bottom of the page.
    similar to page button bar in OAF, do we have any inbuilt way of doing this?
    I read somewhere that panelButtonBar should be used. But I could not find any panelButtonBar in my jdev.
    I am using jdev11.1.1.2

    You will need template where you can have af:panelStretchLayout which has top and bottom facet. I use train tf with trainButtonBar.

  • Page Button Bar Layout in ADF

    Dear Members,
    I have developed a simple master detail page in ADF 11g.
    I am displaying Departments and corresponding employees data in JSF Page.
    I am displaying Departments Data in the Panel Form Layout and Employees Data in the table layout.
    Now in this page I want to display the Navigational Buttons i.e., First, Next,Previous and Last buttons on the top and bottom of the right hand side of the page. Similar to Page Button Bar in OAF.
    Can any one please tell me which component I should use to achieve the above functionality?
    Many thanks in advance.
    Regards.

    Hi,
    Say your parent collection is "DepartmentsView1" in the ADF Data Control panel. Drag the DepartmentsView1 collection from the DataControls panel and drop it onto the page. In the opened context menu, choose Navigation and then "ADF Navigation Buttons". A button bas is a layout container (can be toolbar or panelGroup layout) that hosts a number of buttons. If you need a more sophisticated component to do this, read this: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/24-generic-toolbar-component-169163.pdf
    Frank

  • Flash button bar integration

    Hi there,
    I'm using flash MX2004 to create a navigation bar for a
    project in Director 8.5. I have used the getURL command in Flash to
    transfer information to Director. The buttons are names button1,
    button2 etc. I have put the flash component in Director and tested
    that it is recieving variable button names successfully.
    I want the button bar to change the director movie depending
    on what button is pressed. I am able to have the buttons jump to
    marker but not change movie.
    I'm also trying to implement a roll-over information feature
    ie. when the user rolls the mouse over a Flash button from
    Director, a text box in Director displays information, eg. When the
    user rolls over the "home" button, the information box reads "This
    button takes you to the first page".
    I'm pretty new to Director and randomly scouring the Lingo
    help doesn't seem to be helping me :)
    If anyone has any tips or solutions for my problems it would
    be much appreciated.
    Thanks in advance,
    GL

    It sounds like you want to have a number of different results
    from these
    flash button events. It also sounds like you have a number of
    buttons in
    the flash sprite.
    As duckets said, you can use the getURL() actionscript method
    to send
    information to Director, either to a behavior attached to the
    flash
    sprite or to a movie script.
    Director can interpret a mouse event on the Flash sprite, but
    it can't
    tell which object inside the flash sprite has been effected.
    In other
    words Director knows that the cursor rolled over the sprite,
    just not
    which clip or button was specifically rolled over.
    You will need to set up a strategy for working with these
    flash buttons.
    You will need to decide how much information to send to
    Director and
    when to send that information.
    Actionscript has rollover and rollout events as well as
    mouseDown and
    mouseUp events. So one way to deal with this is to use the
    individual
    rollover and rollout events to send information about the
    text display.
    Then use the mouseup event for navigation control.
    One way to simplify the work on the Flash end is to name each
    button
    instance. Then on the rollover, rollout and mouseup events,
    send the
    name of the button instance to Director. You can then use a
    simple case
    statement to parse out the button's instance name and use
    that name to
    tell Director what to do.
    In flash, name your buttons, it could be as simple as "one",
    "two", etc.
    The write a series of functions for those buttons. Maybe
    something like
    this:
    -- create an array to hold the names of all of the buttons...
    var buttonArray:Array = new Array(one,two,three,four);
    -- create a set of functions for these buttons...
    for (i in buttonArray) {
    buttonArray
    .onRollOver = sendRollOver;
    buttonArray.onRollOut = sendRollOut;
    buttonArray
    .onMouseUp = sendMouseUp;
    -- for the rollover event, send a string that contains a key
    word and
    the button name...
    function sendRollOver() {
    var stringToSend:String = "roll$"+ parseButtonName(this);
    getURL(stringToSend);
    -- do similar for the mouseUp event...
    function sendMouseUp() {
    var stringToSend:String = "up$"+ parseButtonName(this);
    getURL(stringToSend);
    -- for the rollout event just send a simple string...
    function sendRollOut() {
    getURL("rollout");
    -- this function will strip out the simple button instance
    name from its
    full path...
    function parseButtonName(button) {
    var buttonName:String = string(button);
    var nameParts:Array = buttonName.split(".");
    var shortName = nameParts[nameParts.length -1];
    return shortName;
    Now you have a very simple flash movie that doesn't need to
    be edited
    every time something changes in the Director movie.
    in Director make a behavior that will sit on the Flash
    sprite:
    property thisSprite
    on beginSprite me
    thisSprite = me.spriteNum
    end
    on getURL me,data
    if data = "rollout" then
    member("text display member").text = ""
    else
    parseOut(data)
    end if
    end
    on parseOut(thisString)
    oldDelim = the itemDelimiter
    the itemDelimiter = "$"
    if thisString.item[1] = "roll" then
    case (thisString.item[2]) of
    "one": member("text display member").text =
    "first button string"
    "two": member("text display member").text =
    "second button string"
    -- continue as needed
    end case
    if thisString.item[1] = "up" then
    case (thisString.item[2]) of
    -- similar to above
    end case
    end if
    the itemDelimiter = oldDelim
    end
    Rob
    Rob Dillon
    Adobe Community Expert
    http://www.ddg-designs.com
    412-243-9119
    http://www.macromedia.com/software/trial/

  • How can I customize the navigation bar in Firefox 29? I would like to have the refresh/stop button back in front of the navigation bar!

    How can I customize the navigation bar in Firefox 29? I would like to have the refresh/stop button back in front of the navigation bar!

    There isn't a built in way to do that since all the navigation toolbars are on one toolbar.
    You can restore this functionality by installing the Classic Theme Restorer add-on
    *https://addons.mozilla.org/en-US/firefox/addon/classicthemerestorer/

  • ViewStack and button bar

    I have a button bar and I have a viewstack which is the
    dataprovider for it. The problem is under one of the canvas's in
    one part of the viewStack I change the state based on some
    conditions. When I click on another button in the button bar and
    then try to go back where I was it keeps the state where I last
    was. I would like to return to the original state. Is there any way
    to do this? Let me know if you need more info. Thanks.

    Also, if you don't want the reset function to fire on every
    change of the viewstack, you could add some additional logic to the
    function to check if the selectedChild of the viewstack matches
    your stateful canvas, and if so only enable the reset then when you
    click back to it.

Maybe you are looking for

  • Windows 8 on macbook air

    Anybody aware of any challenges installing Windows 8 on Macbook Air? Just want to ensure that all audio, video and all ports continue to work when installing Windows 8. Don't want to take the plunge without getting some advice, since the system requi

  • Logical "OR" with 2 counters

    Hello, i need to produce complex signal (attached as image), the signal is a logical "OR" operation of 2 pulse trains, are there any option in labview to produce such signals with PCI-6602 board? Thanx! Attachments: logical-OR.jpg ‏28 KB

  • LCD/LED Monitor Problems

    I have just purchased a new 2010 Mac Mini and an LG E2240S LCD - LED backlit monitor. I have this connected using a Mini DisplayPort > VGA adapter. I have resolution set at 1920x1080 at 50Hz which seems the best setting. The problem is everything see

  • GR against STO

    Guys, Here is my scenario...We have a decentralized warehouse systems. I created a STO order and created an outbound delivery and processed that delivery in our Warehouse. After that delivery is updated back with the status saying it is completed. No

  • "replace with after effect comp" problem

    I started my project in Prelude where I mad subclips.  I then imported those subclips to premiere to edit my story.  Some of those subclips I would like to key or do other effects with in after effects, but I when I click on those clips and choose re