How can i  set the .PNG image on JButton

hi deras
i try my best to set the png image on button instead of gif or JPEG.
plz help me as soon as possible.
thanking u i remain.

Try harder.import javax.swing.*;
import java.io.IOException;
import java.net.URL;
public class TestPNGButton {
     public static void main(String[] args) {
          try {
               final JFrame frame = new JFrame(TestTextArea.class.getName());
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               JButton button = new JButton(new ImageIcon(
                         new URL("http://java.sun.com/docs/books/tutorial/ui" +
                                   "swing/components/example-1dot4/images/pngIcon.png")));
               frame.setContentPane(button);
               SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                         frame.pack();
                         frame.show();
          } catch (IOException e) {
               e.printStackTrace();
}It works for me.

Similar Messages

  • How can I set the desktop image for client computers?

    How can I set the desktop image for client computers using ARD or terminal?

    How can I set the desktop image for client computers using ARD or terminal?

  • How can I set the size of an image in java?

    How can I set the size of an image in java? I have to choose the width and height of image...thanks to everybody...sorry for my english :-)

    Hi 43477
    Can you provide more details, do you want to setsize to display an image on a screen of when saving image etc?
    PS.
    There is a good invention called googlegoogle is good, but sometimes it's better to use more specific search, there is a search field avove on this page :)

  • Image: How can I set the inner shadow and inner glow

    Hi
    How can I set the inner shadow and inner glow of a picture in a graphic frame? Any ideas which boss is to use?
    is there anywhere an example?
    Thanks
    Hans

    Hi<br /><br />I try to change the attributes (inner shadow and inner glow) using the following code:<br /><br />int CTest::test(UIDRef uidRefPageItem)<br />{<br />  int                                       iErr = ERR_NO;<br />  int                                       iReturn = -1;<br />  UID                                       uidColor = -1;<br />  IXPAttributeSuite::AttributeList          oAttrList;<br />  IXPAttributeSuite::AttributeTypeAndValue  oAttribute;<br /><br />  do {<br />    // Interface atrribute utils<br />    Utils<IXPAttributeUtils> ipAttributeUtils;<br />    // Set attribute list<br />    {<br />      IXPAttributeSuite::AttributeTypeAndValue  oAttribute(IXPAttributeSuite::kContentInnerShadowApply, kTrue);<br />      oAttrList.push_back(oAttribute);<br />    }<br />    {<br />      IXPAttributeSuite::AttributeTypeAndValue  oAttribute(IXPAttributeSuite::kContentInnerShadowBlendMode, kPMBlendNormal);<br />      oAttrList.push_back(oAttribute);<br />    }<br />    {<br />      IXPAttributeSuite::AttributeTypeAndValue  oAttribute(IXPAttributeSuite::kContentInnerShadowOpacity, 50.0);<br />      oAttrList.push_back(oAttribute);<br />    }<br />    UIDList uidList(uidRefPageItem);<br />    // Kommando ausführen<br />    iReturn = ipAttributeUtils->ApplyAttributesToPageItems(oAttrList, uidList);<br />    if (iReturn != kSuccess) {<br />      iErr = -1;<br />      break;<br />    }<br />  } while (kFalse);<br />  return iErr;<br />}<br /><br />iReturn is success, but this code doesn't change the attributes for an inner shadow.<br /><br />- What could be wrong?<br /><br />- Is it right to use the uid reference from the page item or is it neccessary to use the uid refernece of the image?<br /><br />Thanks for the support.<br /><br />Kind regards<br />Hans

  • How do I set the thumbnail image of my videos that export to my computer?  I'm using Premiere Elements 11 on a windows 8.1 PC 64bit.

    How do I set the thumbnail image of my videos that export to my computer?  I'm using Premiere Elements 11 on a windows 8.1 PC 64bit.
    Or how does Premiere 11 determine where to set the image for the video it is exporting? 
    I already know how to use Freeze frame and save the image to my computer by Publish+Share/Computer/ Immage.
    Thanks,
    Mike

    Mike
    This is not Adobe. Rather user to user. We are all visitors here.
    Just a bit of history....back in the days of Premiere Elements 4, you could set a "poster frame" in what was called the Project area. You did this by right clicking a blank area there and, from the drop down menu that appeared, selecting View/Preview Area, and using the poster frame feature there.
    As I said, when a video imports into Premiere Elements, the thumbnail of the import has been presenting as the first frame of the video. With this Preview area "poster frame" option, you could set the video's thumbnail in the Project area so that the first frame was another frame in the video. But, this "perk" was restricted to thumbnails of the video in Project area.
    If you exported to file with the first frame modified video, the export's thumbnail in Windows Explorer would present with other than the real first frame or the poster frame as the first frame.
    Also, in more recent versions, I have observed that the export to file does not display the real first frame of the video in Windows Explorer. Seems random, but I have not kept track.
    And, remember, at the onset I wrote
    As far as I have ever seen, Premiere Elements Windows uses the first frame of the video for its thumbnail in the program.
    I know of no way within Premiere Elements to control what the program opts to do in this matter. In some compatibility
    issues, it opts to give no image but a generic one.
    I did not say that you can expect to have the Premiere Elements' export file's thumbnail in Windows displaying with its real first frame. And, the more you get into this, depending on the versions, more details need to be added to my comment about "...first frame of video for its thumbnail in the program..."
    I would have to look into all this further to get perspective on the contributing factors.
    ATR
    Add On...The Poster Frame feature appeared in versions 4, 7, 8, and 9 by my count.

  • Formatting issues: when I open a msg, the font is sooo small you need a magnifier to read it. How can I set the font size to one I can easily read?

    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    I have various formatting issues:
    a. When I open a msg from my web browser (Cablevision), the font is sooo small I need a magnifier to read it. How can I set the font to a size I can easily read?
    b. When I forward msgs, the text gets all distorted and I need to clean it up (some symbols, lots of spaces between words). How can this be fixed?
    c. When I want to tell someone about a website, I cannot type the URL in so that all they have to do is click on it. How can this be fixed?
    d. When I open messages, the text opens in a small window and covers the "Show Images" button. Why?
    == This happened
    ==
    Every time Firefox opened
    == Ever since I started using Firefox (a few months ago)
    ==
    '''Troubleshooting information'''
    I didn't find any results
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows 7
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
    == Plugins installed
    ==
    *-nphpclipbook
    *Office Plugin for Netscape Navigator
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *Default Plug-in
    *Adobe PDF Plug-In For Firefox and Netscape "9.3.2"
    *NPRuntime Script Plug-in Library for Java(TM) Deploy
    *The Hulu Desktop Plugin allows Hulu.com to integrate with the Hulu Desktop application.
    *Shockwave Flash 10.0 r45
    *Adobe Shockwave for Director Netscape plug-in, version 11.5
    *iTunes Detector Plug-in
    *3.0.40624.0
    *NPWLPG
    *Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers

    The text editor is the text area that you use on the webmail (Yahoo, Hotmail) website to create a new mail.
    You can compare that with the ''Post new message'' text area that you use to create a new post on this forum.
    Just above the text area that you use to enter the message text there is usually a button bar with buttons that allows some text formatting like Bold and Italic and can also include a button to make a clickable hyperlink.
    Check the tooltip of each button by hovering with the mouse over each button.
    Make Link - https://addons.mozilla.org/firefox/addon/142

  • Trying to create a book and have sorted 900 photos in manual order...the book application resorts my photos and i have to search 900 photos each time. how can i set the sorting

    trying to create an Aperture book and have sorted 900 photos in manual order...the book application resorts my photos and i have to search 900 photos each time to place a photo. how can i set the sorting to stay in my manual setup?

    1.  If you manually sort Images in a Project, and then create a new Book w. "Include selected Images" checked, your manual sort order will be preserved.
    2.  As a workaround for when you have already created a Book, batch rename your Images with a leading index or counter after setting the order manually.  You'll have to create a Naming Preset, e.g.: "{Index}_{Version Name}".  The renaming should go in the order that you selected the Images, so be sure to select the first one first, and then use "Edit→Select all" to extend the selection to all Images.  Once the Images are in your Book, a sort on Version Name should be the same as the manual sort you created.
    3.  At the risk of stating the obvious, you could create the Book, import the Images, and then sort them.  The Book -- it is, to Aperture, just a special kind of Album -- retains its own manual sort order.  I recommend using Albums this way.  Use Projects to cull and develop Images, and use Albums for output.  Sorting for a Book (or any output) is better done in the container devoted to that output (and not in the Project, which is more general).
    Message was edited by: Kirby Krieger -- added #3.

  • How can i set the alternating colors for a table rows

    Dear All,
    Please any one help me how can i set the Alternating colors for Table Rows.
    i created a theam there i set the background alternating color to brown and i set the table design properity to alternating. but it is not reflecting.

    Hi,
    The design property in Table properties should work for your requirement. Select "alternating" value for design.
    Please see the API below:
    design
    Determines the appearance of the table. The property design can take the following values and is represented by enumeration type WDTableDesign.
    alternating - The table rows are displayed alternately in a different color.
    standard - The table background has one color. The individual table rows are displayed with grid net lines.
    transparent - The table background is transparent. The individual table rows are displayed without grid net lines.
    Check whether you have changed the right property or not? Also table should contain more than one rows to test this scenario.
    Regards,
    Jaya.
    Edited by: VJR on Jun 17, 2009 6:43 PM

  • How can I set the page that will open, when I open a new tab, to be the same as the homepage?

    How can I set the page that will open, when I open a new tab, to be the same as the homepage?
    An app changed it to some other search engine, before installing the app, I the tab that would open was the homepage I set.
    In my case it is Google, and I want my new tabs to open on Google like they did before the installation.
    thank you,
    Asaf Privman.

    You can middle-click or Ctrl left-click the Home button on the Navigation toolbar to open the Home page in a new tab.
    You can look at one of these extensions:
    * NewTabURL : https://addons.mozilla.org/firefox/addon/newtaburl/
    * New Tab Homepage : https://addons.mozilla.org/firefox/addon/new-tab-homepage/

  • How can I set the language when sending an e-mail with attachment - 'Html'?

    "Character Broken"
    I made an ALV program, and this convert to "HTML',  and send an e-mail with this.
    Used Process is:
    DATA: gt_abaplist LIKE TABLE OF abaplist,
          gt_html LIKE TABLE OF w3html,
          doc_chng LIKE sodocchgi1,
          objpack LIKE TABLE OF sopcklsti1 WITH HEADER LINE,
          objhead LIKE TABLE OF solisti1 WITH HEADER LINE,
          mail LIKE TABLE OF solisti1 WITH HEADER LINE,
          reclist LIKE TABLE OF somlreci1 WITH HEADER LINE,
          lv_line TYPE i.
    DELETE FROM MEMORY ID '%_LIST'.
    SUBMIT z_template
       AND RETURN EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = gt_abaplist
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
      TABLES
        html       = gt_html
        listobject = gt_abaplist.
    doc_chng-obj_name   = 'URGENT'.
    doc_chng-sensitivty = 'O'.
    doc_chng-obj_descr  = ' '.
    doc_chng-obj_langu  = '3'.
    objhead-line        = ' '.
    APPEND objhead.
    mail[] = gt_html[].
    DESCRIBE TABLE mail LINES lv_line.
    CLEAR: objpack.
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = lv_line.
    objpack-doc_type   = 'htm'.
    objpack-obj_descr  = ' '. 
    objpack-doc_size   = lv_line * 255.
    objpack-obj_langu = '3'.
    APPEND objpack.
    CLEAR: reclist.
    reclist-receiver = 'e-mail address'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng 
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = mail
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    SUBMIT rsconn01 AND RETURN.
    I want to show  this by "Japanese".
    But the character is broken.
    LIke This:
    u01D1u072C          u0205|            u0205u072C          u0508           QC u04B90m
    How can I set the language?  How can I solve "Charancter Broken" ?
    Plesse, let me know.
    Thank you so much.
    Edited by: Jaime White 999 on Nov 21, 2011 8:45 AM
    Edited by: Jaime White 999 on Nov 21, 2011 8:46 AM

    Hi Jaime,
    Are you saying, you are getting junk characters in the email attachment? Then pls check the following. Since you want to send Japanese fonts, please pass language 'J' in both  objpack-obj_langu = '3' & doc_chng-obj_langu  = '3' instead of '3' please replace it with 'J'.
    Another thing which you may have to check is the SCOT device type. As I understand from my basis colleague, this may also affect your attachment fonts since the emails are sent through SCOT. Go to transaction SCOT-> Settings-> Device types for format conversion. Check whether wrong device type is defined for Japanese there. Hope this helps
    Regards,
    Gokul

  • How can I set the data binding between Web Dynpro & Database table

    Dear friend,
    I am a beginner of Web Dynpro. I want to develop my simple project like these:
    1. Create my own database table via Dictionary Project such as TAB_USER and have 3 fields: USER_ID, USER_NAME, USER_POSITION and I have already deployed & archived it.
    2. Create my own Web Dynpro Project, and create the input fields as User ID, User name, User position and icon 'Save' on the selection screen and I have deployed it already.
    For the process, I want to input data at the screen and save the data in the table, please give me the guide line like these:
    1. How can I set the data binding between Web Dynpro and Database table ?
    2.  Are there any nescessary steps that I will concern for this case?
    Sorry if my question is simple, I had try  to find solution myself, but it not found
    Thanks in advances,
    SeMs

    Hi,
    You can write your own connection class for establishing the connection with DB.
    Ex:
    public class  ConnectionClass {
    static Connection con = null;
    public static Connection getConnection() {
    try{
    Context ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("jdbc/TSPAGE");
    con = ds.getConnection();
    return con;
    }catch(Exception e){
    return null;
    You can place the above class file in src folder and you can use this class in webdynpro.
    You can have another UserInfo class for reading and writing the data into the DB .
    Regards, Anilkumar
    PS : Refer
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf
    Message was edited by: Anilkumar Vippagunta

  • In EIC, how can we set the SLA of a subcategory to none SLA-related.

    Hi Experts,
    This is our current setup in EIC...
    Category 0501 has an SLA of 8 hours. Subcategory 050101 has to be none SLA relevant. But if we put zero or blank to the SLA Target Value field, it will automatically have a due date defaulted to today. If we will not indicate 050101 on the configuration, it will have the 0501 SLA of 8 hours.
    How can we set the 050101 SLA off?
    The path: IMG --> Personnel Management --> Employee Interaction Center (EIC) --> Interaction Center Web-Client --> Application Functions --> Activity --> Service Level Agreement (SLA) --> Define SLV Properties
    Thanks in advance.

    Hi Harish and Jarret.
    @Harish, I already tried unchecking the checkbox of the Display field but the problem with this is, it will also apply for the rest of the categories. It should only be for this specific subcategory.
    @Jarret, apology, but can you explain to me further about your instruction/advise? I get the feeling that we're on to something with your advise but I didn't quite get it on how to exactly.
    1. You should build the SLA from the lowest level up...
                        -I'm not really sure how, actually.
    2. If you have 8 subcats... will put the 8 entries in the table...
                        -where do I put the 1 subcat? This is because if I don't put that "No SLA" subcat in the table, the due date of that specific subcat will automatically appear todayu2019s date.
    Thanks for both of you. I really appreciate your help. 

  • How can I set the insert date to auto update in Pages 5.2.2

    how can I set the insert date to auto update in Pages 5.2.2
    I am attempting to have the date in header auto update in a Pages file.
    I can insert it, but where is the AUTO UPDATE selection
    OS10.9.4
    thank you

    Apple never included the auto-update feature for dates in Pages v5.2.2. You would have to single-click the date, and deliberately update it.
    If you have Pages ’09 v4.3 in /Applications/iWork '09, then it will allow you to configure auto-update of the date field. Right-click on the date, set the format, and click the selection for automatically update on open.

  • How can I set the order of search engines on my Macbook?

    When I use "Manage Search Engines" to rearrange the order of my search engines, the order changes temporarily, only to revert to the order the search engine add-ons were installed, the next time Firefox is restarted. How can I set the hierarchy of search engines to suit my preference, and have it stay that way?

    It may be your preferences problem.
    Try to Reset your firefox and try it newly
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • How can I set the size of the font so I don't have to change every new word?

    How can I set the size of the font so I don't have to change every new word?

    In what application?

Maybe you are looking for

  • Calculate Square Root?

    Can I use Simplified field notation to calculate the square root of another field? Not having any success.

  • I have a hp deskjet 3050 all-in-one printer how can i setup for wireless printing my os is windows7.

    how do i setup my hp deskjet 3050 all-in-one printer for wireless printing my operating system is windows7

  • Replacing items in the display list

    I have a series of objects in a display, half of which have to be updated regularly. The items are originally added to the display list in pairs and are of 2 different types. My display list look like this: object1 object2 object1 object2 object1 obj

  • Noticable lag in CS6

    Hey folks I'm hoping you can help me out. I'm using Flash CS6 to generate art assets and animations for a mobile game but I've noticed a lot of lag when navigating the timeline, manipulating objects, just about anything really. Click the timeline and

  • Adding programs to mini notebook NB505-N508?

    This is a novice question, but I was hoping someone could confirm.  Can this mini notebook run Quicken?  I have an external CD-ROM drive for installation, and the specifications for this computer seem to match what is required from Quicken.  My conce