Jbutton with Icon

Hi guys
I would like to tune a little bit my graphical Interface.
and I have used Icon on my J Button.
But when I load my graphical interface and when I click on my new "Ion Jbutton" I cannot see the button pressed.
The function is Ok, when I click on the button it works, but visually I cannot see the button "move" when I press it.
Do you know what I have to change?
thanks for your help
ciao
BR

but visually I cannot see the button "move" when I press it.Then you are doing something wrong. The button contains a border that goes dark gray (on Windows) when you click the button to indicate the button has been clicked.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.

Similar Messages

  • JButton with Icon question

    In the Toolbar I have a JButtons. I created the JButtons with Icons.
    When I click on a button it is putting a dotted line right around the Icon. How can I get rid of that? Thanks.

    You're talking about the focus rectangle. If memory serves in the SwingSet demo there's an entire panel devoted to buttons and such. You can find something there to help you. The toggle in the example is labeled "Paint Focus", and it does what you want.

  • JButton with icons

    I need to create JButton with icon but have not much idea. Is there any code sample that may give me some insight? Any help is appreciated in advance.Thanks.

    Icon play = new ImageIcon("images/Play24.gif");
    JButton PlayButton = new JButton(play);

  • Can i paint a JButton with icon?

    i have jbutton with icon and when i push on him i want him to look like when he doesnt Enabled with gray color but i want him to be enable...
    How i do this?

    i dont want to add icon i want to paint the button in gray color
    like you take a jbutton with icon and you do setEnabled(False)
    Thanks

  • JButton with Icon greyed out

    Hi,
    I am writing a minesweeper program and I have a problem with the icons on the JButtons. Initially the button is set with a grey icon to cover the text normally visible on top of it. When the button is pressed two things happen:
    - its icon changes
    - it is disabled by setEnabled(false).
    My problem is that when when I use the setEnabled(false) method the icon is 'greyed' out. Does anyone know of a way round this?
    Thanks,
    Jolyon

    just set the disabledIcon to the desired Icon:
    button.setDisabledIcon(Icon icon );
    the grayed out one is a default Icon calculated by the button if no disabledIcon is provided.
    regards,
    stefan

  • "Packed" JButton with Icon

    Hi,
    This is not really a problem but here we go... I have this class, that just "packs" a JButton so it fits with the Icon on it.
    public class PackedButton extends JButton {
         public PackedButton(Icon icon) {
              super(icon);
              int w = icon.getIconWidth(), h = icon.getIconHeight();
              Dimension d = new Dimension(w + 10, h + 10);
              this.setMaximumSize(d);
              this.setPreferredSize(d);
              this.setMaximumSize(d);
    }This works, but when I start my application, the button doesn't look packed, I have to resize the mainframe to get the correct result...
    An idea? Refresh problem?
    Thanks!
    Jean

    just set the disabledIcon to the desired Icon:
    button.setDisabledIcon(Icon icon );
    the grayed out one is a default Icon calculated by the button if no disabledIcon is provided.
    regards,
    stefan

  • JButton with Icon - when pressed moves Icon

    When I press on a JButton which contains a icon then the icon is moved a little bit each time I press. Can I disable that?
    I need to place clickable images. Is a JButton the best method for this?

    URL url = this.getClass().getResource("weiher_original.jpg");
    ImageIcon icon = new ImageIcon(url);
    btnIcon = new JButton(icon);
    btnIcon.setSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
    btnIcon.setBorderPainted(false);
    btnIcon.setFocusPainted(false);
    getContentPane().add(btnIcon);Now if you press on the icon the image moves a few pixels until the mouse is released.

  • How to put an icon to Jbutton with Jbuilder 5?

    I have tried to make a jbutton with icon on it,
    i create an image icon object and pass it to the jbutton.seticon method...
    When create the image icon, it need the path of the icon file, what is the relative path of image in jbuilder?
    (not absolute e.g file:///)
    Thanks

    What you need to do is
    if your current class is Test and you image file is in the same directory called cat.gif then do the following
    button.setIcon(new ImageIcon(Test.class.getResource("cat.gif")));
    this should work
    if you image file is in the previous directory you just type in "../cat.gif" and if you have a image directory reltaive then you put in "images/cat.gif"
    I hope this helps

  • JButton help, icon +text position

    Hi, is it possible to have JButton with icon on far left and text between the icon and far right hand side?

    Yo can do it by using the setHorizontalTextPosition() method.
    here is one example
    import java.awt.*;//Frame
    import javax.swing.*;
    public class Test extends JFrame
         public Test()//Constructer. Creates the frame
              JButton bt = new JButton("Done", new ImageIcon("image.gif"));
              bt.setHorizontalTextPosition(AbstractButton.LEFT);
              setBounds(300,300,300,300);
              getContentPane().setLayout(new FlowLayout());
              getContentPane().add(bt);
              setVisible(true);//shows on the screen
         public static void main(String[] args)
              new Test();//Creates a new Instance of our class
    }

  • Customed JButton size with Icon

    Hi,
    I want to place a few buttons in a JPanel in a fashion that it looks like a toolbar, my problem is that these buttons (with icons) take the size they want.
    But I would like to size them like I want (they would have all the same size though).
    Is there any layoutmanager that would let me do that or any other suggestions!?
    Thanks.

    I'm not sure this is what you want but...
    You can use the setPreferredSize method on the buttons and make sure they have enough room.
    Also, the GridLayout places components in areas of equal size.
    Andrew

  • ALV GRID with icon fields. When exports to Excel, icon fields are emtpy.

    Hi all,
    In our SAP system (6.0 ECC) we've noticed the following behaviour:
    In ALV GRID with icons (color lights for example...) when we export the list to Excel format with the standard button bat, the icon column is always empty.
    We think that in previous SAP version (4.7), the code corresponding to the icon appeared (For example @08@ for green light).
    It's possible to have tha same functionality in this new version like in 4.7?
    Regards.
    Edited by: Ole ES on Nov 17, 2010 6:05 PM

    Hi,
    Check the format in which you export to Excel (MHTML, XML, ...) and try antoher one.
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/66/79ad48157f11d2953700a0c930328a/content.htm
    I think the integrated Excel mode shows '@08@'.
    Best regards,
    Guillaume

  • Problem with Icons

    Hi!
    I'm trying to make a chess game, and I'm having the following problem.
    I have a JLayeredPane that contains a JPanel with other 64 JPanels inside. The pieces are JLabels with Icons.
    The problem is that when I begin a new game, the chessboard appears empty, with no pieces whatsoever, even though those labels are in place.
    If I try to resize just for a bit the main frame, the pieces appear on their positions just like they should in the first place.
    I've tried everything, but they just refuse to appear until I resize the frame (I should add that the chessboard is big enough for the icons to fit, so it is not this .... ).
    Can anyone help?

    So here goes:
    I have an intro frame that has a new game button. When the Button is pressed, I create the main frame, I put in the JlayeredPane and all the other panels and pop up a JDialog message, in which I request certain info. This dialog has an OK button, which should add the labels (with the icons) to the panels on the chessboard.
    I don't think the layout creates this problem, because I've seen it working with exactly the same stucture. The only difference I could see was the dialog box. So I'm guessing this dialog is creating the problem.
    PS: I don't have the code here, I'll get back with that later on.....

  • Tree with Icons

    hi, i need to hava a tree with icons in apex
    is it possible?

    hi, First of all You have to create table .
    CREATE TABLE "APEX_PAGES"
    (     "IDENTIFIER" NUMBER(10,0) NOT NULL ENABLE,
         "PAGE_NO" NUMBER(10,0) NOT NULL ENABLE,
         "PARENT_PAGE_NO" NUMBER(10,0),
         "NAME" VARCHAR2(4000) NOT NULL ENABLE,
         "NAVIGATION" VARCHAR2(100) NOT NULL ENABLE,
         "IMG" BLOB
         CONSTRAINT "APEX_PAGES_PK" PRIMARY KEY ("IDENTIFIER") ENABLE
    then create form with report on table apex_pages.
    Please note : - P20_IMG is an form item name...
    use following sql query for tree with image :
    select PAGE_NO id,
    PARENT_PAGE_NO pid,
    '<img src="'||*APEX_UTIL.GET_BLOB_FILE_SRC*('*P20_IMG*',IDENTIFIER)||'" />'||NAME name,
    'f?p=&APP_ID.:'||page_no||':&SESSION.' link,
    null a1,
    null a2
    from APEX_PAGES
    Also u can highlight the current node ................
    select PAGE_NO id,
    PARENT_PAGE_NO pid,
    CASE WHEN page_no = :APP_PAGE_ID THEN
    '<img src="'||APEX_UTIL.GET_BLOB_FILE_SRC('P20_IMG',IDENTIFIER)||'" />'
    ||'<b>'||NAME||'<blink>'||'<font color="red">'||' <='||'</font>'||'</blink>'
    ELSE
    '<img src="'||APEX_UTIL.GET_BLOB_FILE_SRC('P20_IMG',IDENTIFIER)||'" />' || NAME END
    AS name,
    'f?p=&APP_ID.:'||page_no||':&SESSION.' link,
    null a1,
    null a2
    from APEX_PAGES
    Cheers !!!!!

  • Good file-manager for OpenBox? (with icons)

    I tried rox with the magickthumbnails and videothumbmails, but havent got it working yet.
    I am now trying thunar, but it has dull generic icons.  Everything looks like a piece of paper.  I'm sure it'd look good if I was running XFCE.
    Is there a standard/common file-manager for use with openbox?  Preferably one with icons for different file-types.

    DonVla wrote:
    hi,
    i also recommend rox. fast and the drag'n'drop functionality is brilliant.
    the default layout is truely ugly. but you can change everything.
    i've changed the rox icons by hand:
    in my ~/.gtkrc-2.0.mine:
    # rox-filer toolbar icons
    pixmap_path "~/.icons/panel_icons/icons_2"
    style "normal" {
    stock["gtk-close"] = {{"close.png"}}
    # stock["gtk-close"] = {{"exit.png"}}
    stock["gtk-go-up"] = {{"1uparrow.png"}}
    stock["gtk-home"] = {{"gohome.png"}}
    stock["gtk-refresh"] = {{"redo.png"}}
    stock["gtk-zoom-in"] = {{"add.png"}}
    stock["gtk-zoom-fit"] = {{"stop.png"}}
    stock["gtk-jump-to"] = {{"bookmarks.png"}}
    # stock["gtk-sort-ascending"] = {{"bottom.png"}}
    # stock["gtk-help"] = {{"help-icon.png"}}
    stock["rox-show-hidden"] = {{"filter.png"}}
    stock["rox-show-details"] = {{"view_tree.png"}}
    # stock["rox-select"] = {{"select-icon.png"}}
    widget "*" style "normal"
    it's quite self explanatory .
    vlad
    ps:
    and that's what it looks like:
    http://img206.imageshack.us/img206/2949 … 24aak4.png
    That's a pretty cool setup u got there. Is that conky in the top centre? If so, mind sharing your .conkyrc.
    What Icon theme are u using? is that panel-thingy AWN?
    Could u also elaborate this line < pixmap_path "~/.icons/panel_icons/icons_2" > ?

  • I chose a theme and would like my home page to be a blank tab, but show the theme with icons on it instead of a white page. What is the use of having a cool theme if you never see it. Is this a posibility?

    I chose the theme purple moon. I was hoping that the home page could be set up customized with icons of my most used websites and tool icons where you can see the theme, but the only think I can set it to is a blank white page.

    I have now recently downloaded 10.0.2 which is confusing in itself, as, as far as I can ascertain that is actually version 11, but I'm not even sure about that.
    Version 10.0.2 is the newest version and the successor to GarageBand '11 (version 6.0.5).
    The '11 is referring to the iLife '11 suit of multimedia application - the older GarageBand was a part of this bundle.
    Have a look at Edgar's graphical enhanced manuals, the explain very detailed how things work and why. You can buy them as iBooks from the iBook store or directly from the page:
    http://DingDingMusic.com/Manuals/

Maybe you are looking for

  • IAC Question

    Hi I am trying to use the IAC's MEW0, MEW3, MEW5 to create requisition, go through the approval workflow and then create a purchase order. I have already created the screens to create and display requisitions using MEW0. I do not know what to do for

  • Bapi to update miro considering schedule agreement also

    hi experts,       Is any bapi to update miro considering schedule agreement also Moderator message: please do more research before asking, show what you have done yourself when asking. Edited by: Thomas Zloch on Jul 8, 2011 10:48 AM

  • How to connect webdynpro application to database (Sql server)

    Hi Experts, Can someone suggest me how to connect webdynpro application to SQL Server. (Possibly in detail) Thanks Regards, Sandeep

  • Authorization Scheme -- Best Practices?

    Hi All -- We have a reporting application containing approximately 300 pages and 60 or so menu items all using authorization schemes (exists SQL method) as a means to determine whether or not a use can see the menu items and/or access the pages. We'v

  • Iphone 5 calendar wont edit

    Iphone 5 calendar Ios7 plus icon not working? how to resolve?