Adding icon to a button

Hello
When I put a JButton on a frame I see in Property Inspector , Visial tab a icon section which it's follow is "<none>"
how I can use it for adding a icon to the button
my mean is I want add an icon to button by Property Inspector , but I don't know how I can do it
can you say to me ?
thanks

Hi,
I don't think the property inspector will help you adding the icon because it needs to be added from the class loader path. In an older JCLient Demo we used the following class
public class ImageLoader
   public ImageLoader()
   public ImageIcon getImageIcon(String name)
      return new ImageIcon(getClass().getResource(name + ".gif"));
}This then could be called when setting the icon to a JButton at runtime, passing the icon name to it
Frank

Similar Messages

  • Trouble displaying icon on push button in 6i Forms

    Hi,
    I'm having trouble displaying an icon on a button at both design and run times. I'm using Forms 6i with client/server enviornment. I have tried to follow several forums regarding icon setup and the Whitepaper articles. I have tried different suggestions but am still unable to get the icon. Here's my latest attempt:
    1. Copied .jar file to C:\Oracle_Developer_9i\forms90\java folder
    2. Modified formsweb.cfg (in the serverApp=default section) and included the following:
    archive_jini=f90all_jinit.jar,myAppIcons.jar
    imagebase=codebase
    3. In button's properties I set:
    iconic = 'Yes'
    icon filename = C:\Oracle_Developer_9i\forms90\java\myAppIcons.jar
    My guess is that I didn't copy the icon files (from the .jar file) correctly. As suggested in the Whitepaper, I don't have the c:\ myApp\ icons directory. I did a search for an icon directory and found multiple icons folders (due to other oracle projects installed on my pc) but don't know which one to use. Being that I'm using 6i and the instructions were for 9i I didn't know if the directory/folder name is different. Is there another directory/folder (using 6i) where I should copy all the .gif files from in addition to storing the .jar file in the C:\Oracle_Developer_9i\forms90\java directory?
    Also, I feel that I'm not calling it correctly from the location in step 3. Being that the icon exists in the jar file, how would I reference it within the file? Does anybody have any suggestions? Any help would be greatly appreciated.
    Thank you,
    Eric

    Robin,
    I tried your suggestions but am still unable to view the icon. Here's what I now have tried.
    1. I've created UI_ICONS in the windows registry under the form's oracle home and am calling c:\icons from that variable.
    2. In c:\icons, I copied the .jar file's contents (search.gif) into this folder. This is where I may have a problem in addition to my next step in calling the filename. You mentioned in your first post to put my .ICO files there. Should I rename my .gif to .ico? Not sure if I followed you there.
    3. In the button property, I set icon = yes and icon filename = c:\icons\search.gif -- Not sure if I used the right syntax for the filename. I've tried renaming it to .ico and it still does not display.
    Sorry about all the questions but I really appreciate your help. Do you see anything else that I did that may cause it to not display?
    Thanks again,
    Eric

  • User exit/ BADI in f-32 / f-28 for adding application tool bar button

    Hi Experts,
    There is a requirement, for adding application tool bar button in the Transaction codes F-32 / F-28 / Feba_lockbox. So that while clearing documents with reference document, they can upload the data(Reference Documents) from local file and after the data is fetched for clearing, they need to download the data to local file for verification. If the data is verified to be okay, then they can go ahead with simulation and posting. They need this verification to be done in excel sheet, so need to download the data into local file.
    I found a BADI in that screen is BADI_LAYER but I don't think it is relevant.         
    Any help is apreciated!
    Is there any EXIT ? Because I can not find it too.
    Regards,
    Nitin

    where you did the enhancement?
    I have to create the IDOC once Clear docuemnt is created.. It may help me.

  • How to change an icon of a button

    hi guys,
    i want to change the icon of a button when it is click
    how can i do it?
    thanks

    You register a listener for that button, e.g.:
    button.addActionListener(new...)
    Then add code to the listener class:
    button.setIcon(new...)
    If you've not come across listeners yet though, you'll need to explore these a bit first.
    Andy.

  • How to create icon on Push button

    Hai All
    I have a button, when the user press the button i will display the calander. So now i need to place a small calander picture in that so Pls tell me the steps to create a iconic button.
    Pls explain me the steps...
    Any Help is highly appricatable
    regards
    Srikkanth.M
    Edited by: Srikkanth.M on Apr 28, 2010 11:00 AM

    Hi,
    you have to create a jar file of the pic and have to place it in java folder .
    Also have to edit cfg file in server folder .in that you have to include the jar file name in parameter archive_jini =
    iconic property of button should set yes
    give the name of jar file without any extension( suppose list.jar you just give list ) in the iconic name property
    cheers
    Rinz

  • ALV Grid default values for new rows added with Add/Insert buttons

    Hi!
    Help, please,  to find a way how to set default values for new rows added with Add/Insert buttons in
    ALV Grid.

    I have found salution:
    ALV Grid u2013 Insert row function
    Sometimes we need to assign some default values when we create a new row in a grid using standard ALV Append row button. In our scenario we will see how to assign default values to Airline Code (CARRID), Flight Connection Number (CONNID) and Flight date (FLDATE) when a new row is created. To do that we need to handle DATA_CHANGED event in the program like mentioned below.
    Definition of a class:
    Code:
          CLASS lcl_event_receiver DEFINITION
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
    METHODS:
         handle_data_changed
         FOR EVENT data_changed OF cl_gui_alv_grid
         IMPORTING er_data_changed
                           e_ucomm.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    Implementation of a class:
    Code:
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_DATA_CHANGED.
        DATA: dl_ins_row TYPE lvc_s_moce.   " Insert Row
          FIELD-SYMBOLS: <fs> TYPE table.    " Output table
    Loop at the inserted rows table and assign default values
        LOOP AT er_data_changed->mt_inserted_rows INTO dl_ins_row.
          ASSIGN er_data_changed->mp_mod_rows->* TO <fs>.
          loop at <fs> into ls_outtab.
            ls_outtab-carrid  = 'LH'.
            ls_outtab-connid  = '400'.
            ls_outtab-fldate  = sy-datum.
            MODIFY <fs> FROM ls_outtab INDEX sy-tabix.
          endloop.
        endloop.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    Register the events to trigger DATA_CHANGED event when a new row is created.
    Code:
        CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
          EXPORTING
            I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
        CALL METHOD OBJ_GRID->REGISTER_EDIT_EVENT
          EXPORTING
            I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.

  • Using search help icon for a button

    Hi Experts,
    For a Webdynpro layout I have created a button and I want to assign an icon/image similar to the search help image(two squares type).
    Is there any way to assign the webdynpro search help icon to a button?
    I was searching in ImageSource under Button property but did not find any similar image. Else Is there any option to upload and assign an image to the button?
    Thanks.

    Hi,
    Under properties of button press F4 in image source attribute, you can select standard SAP icons, if not you can upload icon to your web dynpro component and then press F4 and select Component images tab and select your icon.
    For uploading icons to web dynpro abap check this reference: [Displaying Logos in WDA|http://www.****************/Tutorials/WebDynproABAP/Logo/Page1.htm]
    Hope this helps u.,
    Thanks & Regards,
    Kiran.

  • [svn:osmf:] 10017: Adding a style sheet, adding a backdrop to the examples list, adding icons to play and pause icons.

    Revision: 10017
    Author:   [email protected]
    Date:     2009-09-04 06:43:44 -0700 (Fri, 04 Sep 2009)
    Log Message:
    Adding a style sheet, adding a backdrop to the examples list, adding icons to play and pause icons. Setting theme color to red.
    Modified Paths:
        osmf/trunk/apps/samples/framework/ExamplePlayer/ExamplePlayer.mxml
        osmf/trunk/apps/samples/framework/ExamplePlayer/org/openvideoplayer/view/MainWindowLayout .mxml
    Added Paths:
        osmf/trunk/apps/samples/framework/ExamplePlayer/assets/
        osmf/trunk/apps/samples/framework/ExamplePlayer/assets/ExamplePlayer.css
        osmf/trunk/apps/samples/framework/ExamplePlayer/assets/assets.swf

    Revision: 10017
    Author:   [email protected]
    Date:     2009-09-04 06:43:44 -0700 (Fri, 04 Sep 2009)
    Log Message:
    Adding a style sheet, adding a backdrop to the examples list, adding icons to play and pause icons. Setting theme color to red.
    Modified Paths:
        osmf/trunk/apps/samples/framework/ExamplePlayer/ExamplePlayer.mxml
        osmf/trunk/apps/samples/framework/ExamplePlayer/org/openvideoplayer/view/MainWindowLayout .mxml
    Added Paths:
        osmf/trunk/apps/samples/framework/ExamplePlayer/assets/
        osmf/trunk/apps/samples/framework/ExamplePlayer/assets/ExamplePlayer.css
        osmf/trunk/apps/samples/framework/ExamplePlayer/assets/assets.swf

  • ICON for a Button( Forms 4.5)

    I am trying to show an ICON for a Button
    in Forms 4.5 under Windows OS.
    I am not able to find any of these
    TK_ICON, UI_ICON and TK25_ICON in the registry
    to set the path.
    Shoud I have to install any other utility/option ?
    please guide me

    Just create the new registry entries by yourself under
    H_KEY_LOCAL_MACHINE/SOFTWARE/ORACLE and write the correct path
    inot it.
    Michael

  • Displaying Icons on Push Buttons in forms 10g

    How can i Display Icons on Push Buttons in forms 10g ?

    Set the property "Iconic" of the button to "Yes" and enterthe iconname in the Property "Icon Name" (without path and extension).
    About how to make items accesible in forms, have a look at this http://download.oracle.com/docs/cd/B14099_19/web.1012/b14032/configure009.htm

  • Add icon on spark button skin

    Hello all I am trying to add different icon on different buttons. I have my skin file ready but not sure if I have to create different skin class for different button. It sounds inefficient. Any suggestions? Thanks for the reply...
    <s:Button id="pass"
          width="110"
          height="35"
          fontWeight="bold"
              fontSize="12"
          fontFamily="arial"
          label="Past Track"
         click="pass_clickHandler(event)" skinClass="skins.CustomSkin"/>      
    <s:Button id="future"
          width="110"
          height="20"
          fontWeight="bold"
          fontSize="12"
          fontFamily="arial"
          label="Future Plan"
              click="future_clickHandler(event)"
              skinClass="skins.CustomSkin"/>
    Skin.....
       <!-- layer 2: fill -->
        <!--- @private -->
        <s:Rect id="fill" left="1" right="1" top="1" bottom="1" radiusX="2">
            <s:fill>
                <s:LinearGradient rotation="90">
                    <s:GradientEntry color="#304fd7"
                                 color.over="#4b6bf6"
                                 color.down="0xAAAAAA"
                                 alpha="0.85" />
                <s:GradientEntry color="#1f38a3"
                                 color.over="#3653cf"
                                 color.down="0x929496"
                                 alpha="0.85" />
            </s:LinearGradient>
        </s:fill>
    </s:Rect>
    <!-- icon --> // I could add my icon here but that would make me to create 
                      //different icon image for different button

    so you could do something like this even though it doesn't have to be a required item.
        public class ImageButton extends Button
             *  The skin part that defines the area where
             *  the user may drag to resize the window.
            [SkinPart(required="true")]
            public var buttonImage:Object
    Then , in your skin you would have an mxml image with the same name ( buttonImage ) that you would position in the skin.  In the mxml where you use the class you could just do
    <custom:ImageButton id="ib" buttonImage="assets/myButton.jpg" />
    I must warn you though , skinning is not my specialty.
    If this post was helpful please mark it as such.
    Sincerely ,
      Ubu

  • Adding text to a button.

    Can anyone tell me how to add text to a button I created? If it changes anything, it is a sub-menu button

    Hi:
    Sorry if it sounds like a RT_M answer, but look in the User Manual for the topic Adding Text to a Button and you'll get the step by step procedure.
    If it don't answer your question or you mean something different come back please !
      Alberto

  • Make the purple box around text and icon of a button go away?

    I have noticed that the first button of a group (or the last one pressed) displays a purple box around the text and/or the icon of a button. I don't want this. How do I get rid of it?

    Have you tried setting the colour that you want manually? Or perhaps setting the setOpaque() method with false?
    Not entirely sure what you mean...what look and feel are you using? Is it the Metal LAF or something else?

  • Displaing Icons on Push Button

    Hello Everyone,
    Can someone help me how to display icons on push buttons?
    Thanks

    Oh come on,
    don't do this to me. I was under the impression that this paper I wrote was easy to understand and contains all information needed to get this running ;-(
    Lets try and find the trouble maker:
    The Whitepaper works for Forms on the Web, are you on the Web or client/server?
    If client/server use icons in .ico format and set the directory path for the icons in teh UI_ICON registry variable.
    If you are on the Web and use Forms6i, follow the instructions regarding referencing the icon location in the registry.dat file and map the directory you refer to in teh httpd.conf file of the Apache HTTP Server
    If you are on Forms9i then the paper is all you need.
    Fran

  • Set Icon for toggle button

    I created Icon with Borderpane, image and text which I want to set as button icon.
    @Override
        public void start(Stage primaryStage)
            final VBox vbox = new VBox();
            // create 3 toggle buttons and a toogle group for them
            ToggleButton tb1 = new ToggleButton();
            tb1.setGraphic(newConnectionIcon());
            ToggleButton tb2 = new ToggleButton();
            ToggleButton tb3 = new ToggleButton();
            final ToggleGroup group = new ToggleGroup();
            tb1.setToggleGroup(group);
            tb2.setToggleGroup(group);
            tb3.setToggleGroup(group);
            // select the first button to start with
            group.selectToggle(tb1);
            final Rectangle rect1 = new Rectangle(300, 300);
            rect1.setFill(Color.DARKOLIVEGREEN);
            final Rectangle rect2 = new Rectangle(300, 300);
            rect2.setFill(Color.LAVENDER);
            final Rectangle rect3 = new Rectangle(300, 300);
            rect3.setFill(Color.LIGHTSLATEGREY);
            tb1.setUserData(rect1);
            tb2.setUserData(rect2);
            tb3.setUserData(rect3);
            group.selectedToggleProperty().addListener(new ChangeListener<Toggle>()
                @Override
                public void changed(ObservableValue<? extends Toggle> ov, Toggle toggle, Toggle new_toggle)
                    if (new_toggle == null)
                    else
                        vbox.getChildren().set(1, (Node) group.getSelectedToggle().getUserData());
            HBox hBox = new HBox();
            hBox.getChildren().addAll(tb1, tb2, tb3);
            hBox.setPadding(new Insets(10, 10, 10, 10));
            vbox.getChildren().addAll(hBox, (Node) group.getSelectedToggle().getUserData());
            StackPane root = new StackPane();
            root.getChildren().add(vbox);
            Scene scene = new Scene(root, 800, 850);
            primaryStage.setScene(scene);
            primaryStage.show();
        private static BorderPane newConnectionIcon() {
            // Add background effect
            DropShadow ds = new DropShadow();
            ds.setOffsetY(2.0);
            ds.setOffsetX(2.0);
            ds.setColor(Color.GRAY);
            // New BorderPane which will hold the components
            bpi = new BorderPane();
            bpi.setEffect(ds);  // Add the effect
            bpi.setCache(true);
            // Set the size of the BorderPane
            bpi.setPrefSize(30, 30);
            bpi.setMaxSize(30, 30);
            // Add style       
            bpi.setStyle("-fx-background-color: linear-gradient(#f2f2f2, #d4d4d4);"
                    + "  -fx-background-insets: 0 0 -1 0, 0, 1, 2;"
                    + "  -fx-background-radius: 3px, 3px, 2px, 1px;");
            // Add Label to the Icon
            Text inftx = new Text("New Connection");
            inftx.setFont(Font.font ("Verdana", 5));   // Set font and font size
            inftx.setFill(Color.WHITE); // Set font color
            ncpic.setFitHeight(25);    // Set size of the Icon picture
            ncpic.setFitWidth(25);
            // Internal StackPane which will hold the picture and the Icon Label
            StackPane stack = new StackPane();
            stack.getChildren().addAll(ncpic, inftx);   // Add the picture and the Label
            // Add the StackPane to the main BorderPane       
            bpi.setCenter(stack);
            // Change the border of the Icon when the mouse is over the Icon
            bpi = mouseOver(bpi);
            // Navigate to new Panel when the user clicks on the Icon
            bpi.setOnMouseClicked(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent t) {
            return bpi;
    How I can remove the default togglebutton and use the my custom icon as a button?

    Yes, they are icons and they are called "handles". The easiest way to change then is to use UIManager.
    If you haven't done so before, look through the hash table UIManager.getLookAndFeelDefaults().
    import java.awt.*;
    import java.net.*;
    import javax.swing.*;
    public class TreeIcons {
         public static void main(String[] args) throws MalformedURLException {
              String prefix = "http://forum.java.sun.com/images/";
              UIManager.put("Tree.openIcon", new ImageIcon(new URL(prefix + "dont_save.gif")));
              UIManager.put("Tree.closedIcon", new ImageIcon(new URL(prefix + "save.gif")));
              UIManager.put("Tree.leafIcon", new ImageIcon(new URL(prefix + "forum_new.gif")));
              UIManager.put("Tree.expandedIcon", new ImageIcon(new URL(prefix + "email_faded.gif")));
              UIManager.put("Tree.collapsedIcon", new ImageIcon(new URL(prefix + "email.gif")));
              JFrame f = new JFrame("TreeIcons");
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.getContentPane().add(new JTree());
              f.setSize(new Dimension(300,400));
              f.setLocationRelativeTo(null);
              f.setVisible(true);
    }

Maybe you are looking for