Adding GIF images to a stand-alone program

To add a GIF image to an applet one can use the "getImage" function defined in the applet class.
How do i add an image to a stand-alone program in java when one doesn't extend the Applet class ( and so one doesn't have access
to the "getImage" procedure)
I have just begun with Java so please reply in simple english and not in some hard-to-understand "Javian" crap!
Thank u

You mean a JFrame?
import java.awt.*;
import javax.swing.*;
public class JFrameImage extends JFrame {
  public JFrameImage() {
      Container c    = getContentPane();
      JPanel panel = new JPanel(){
             public void paintComponent(Graphics g)     {
// puts an image on the whole program as background
                  ImageIcon img = new ImageIcon("myBackground.jpg");
                  g.drawImage(img.getImage(), 0, 0, null);
                  super.paintComponent(g);
        panel.setOpaque(false);
// puts an image on the button
      ImageIcon icon = new ImageIcon("myButton.jpg");
      JButton button = new JButton(icon);
      panel.add(button);
      c.add(panel);
  public static void main(String[] args) {
    JFrameImage frame = new JFrameImage();
// puts your own personal image on the frame itself
      Image onFrame = Toolkit.getDefaultToolkit().getImage("myIcon.gif") ;
    frame.setIconImage(onFrame);
    frame.setSize(200,200);
// stops the thing looking sh*tty and amateurish by putting it nearer the middle
// of the screen, instead of the default top left hand corner
    frame.setLocation(300,200);
    frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
    frame.setVisible(true);
}

Similar Messages

  • PROBLEM IN ALE/IDOCS  USING STAND-ALONE PROGRAM AND CHANGE-POINTER.

    Hi All,
      Recently i have joined a company where i have to work on ALE/IDocs , So for this i need some help, Actually i need to know the complete senerio of this, I know some configuration part but after this what i want to know is the coding part
    of it.
    IN STAND-ALONE PROGRAM..
      I NEED TO EXTEND AN IDOCS WITH ADDING FEW MMORE FEILDS, SO IN   
      THAT CASE WHAT ALL THE THINGS I HAVE TO DO..
    IN MESSAGE CONTROL ..
       I NEED TO EXTEND AN IDOCS WITH ADDING FEW MORE FEILDS, SO IN 
       THAT CASE WHAT ALL THE THINGS I HAVE TO DO..??

    Hi,
    please have a look at
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/78/217d6851ce11d189570000e829fbbd/frameset.htm
    Hope this helps.
    Regards
    Bernd

  • Displaying an image in a stand alone application

    I know that this is a simple process, but I do not know how to display an image in a stand alone application.

    public class MyFrame extends Frame {
    Image image;
    MyFrame() {
    image = getToolkit().getImage(pathToImage);
    setSize(800,600); //for example
    show();
    public void paint(Graphics g) {
    super.paint(g);
    if(image != null)
    g.drawImage(image,0,0,this);
    }

  • Security Exception from Java stand-alone program on Linux

    Hi All,
    I am getting the following exception while running a Java stand-alone program on Linux.
    The stand-alone program internally calls the JCE (Java Cryptography Extension) library for Encryption of data.
    Does anybody have the solution for this error?
    Is there any Security policy modification to be made for the same?
    Exception in thread "main" java.lang.ExceptionInInitializerError
    at javax.crypto.Cipher.a(Unknown Source)
    at javax.crypto.Cipher.getInstance(Unknown Source)
    at lncrypt.LnCryptBase.encryptImpl(LnCryptBase.java:122)
    at lncrypt.LnAes.encrypt(LnAes.java:78)
    at CloakingUtils.encrypt(CloakingUtils.java:69)
    at AlertsMigrationSweepUtil.updateAlerts(AlertsMigrationSweepUtil.java:203)
    at AlertsMigrationSweepUtil.main(AlertsMigrationSweepUtil.java:65)
    Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs
    at javax.crypto.e.<clinit>(Unknown Source)
    ... 7 more
    Caused by: java.lang.SecurityException: Jurisdiction policy files are not signed by trusted signers!
    at javax.crypto.e.a(Unknown Source)
    at javax.crypto.e.a(Unknown Source)
    at javax.crypto.e.g(Unknown Source)
    at javax.crypto.f.run(Unknown Source)
    at java.security.AccessController.doPrivileged1(Native Method)
    at java.security.AccessController.doPrivileged(AccessController.java:351)
    ... 8 more
    Regards,
    Vilas Kulkarni

    No security modification is normally required. I can't be sure but it looks to me like the jar file containing the package javax.crypto.e has not been signed by Sun. If you are writing your own provider then you would do well to look at reply #7 of http://forum.java.sun.com/thread.jspa?threadID=5222038 .

  • Stand alone program

    hi all
    plz send the code for a stand alone program for idocs
    mesg type:isu_mr_upload
    basic type:isu_mr_upload01
    process code:ismr
    reciever port:sapect
    reciver parnter no:aio
    reciver partner type:ls
    reciever type:ls
    sender port:zdump
    sender partner no:aio
    sender partner type:ls
    sender type:ls
    plz send the stand alone program.....
    its very ugent help me out..the answer will be rewarded..

    hi all
    plz send the code for a stand alone program for idocs
    mesg type:isu_mr_upload
    basic type:isu_mr_upload01
    process code:ismr
    reciever port:sapect
    reciver parnter no:aio
    reciver partner type:ls
    reciever type:ls
    sender port:zdump
    sender partner no:aio
    sender partner type:ls
    sender type:ls
    plz send the stand alone program.....
    its very ugent help me out..the answer will be rewarded..

  • Muse as a stand alone program

    Hey Adobe, where I teach the university pays for CS 6 Master Suite for all the instructors. I used Muse when it was beta and looked forward to buying it when it came out because my university doesn't plan on using the program for instruction. But YOU will only let people use it if we pay for Cloud access for ALL your programs.
    Using Muse only through Cloud, instead of also selling it as a stand alone program is just plan stupid. Makes no sense to me. Rediculous to have to pay for all the services of Cloud when I only want Muse. Get it. I have the Master Suites. I don't need Cloud. I just want Muse.
    Please release Muse as a stand alone produce just like your other programs. I'd be happy to pay for it. I loved the beta version.
    Frustrated.
    Walt Calahan

    Walter Calahan wrote:
    I'd still like the option of buying the program as a stand alone.
    That definitely won't happen.
    Muse was aways going to be subscription only and I suspect Adobe's entire software delivery will go that way sooner rather than later once they've established a viable, sustainable business model.
    http://www.adobe.com/products/muse/faq.html
    Why is Adobe Muse sold only by subscription?
    Adobe Muse is sold only by subscription because it will allow the Adobe Muse team to improve the product more quickly and be more responsive to your needs. New features will be made available when they're ready, likely to be released on a quarterly basis. This will allow us to stay on top of browser and device compatibility issues and web design trends and standards, as well as allow us to respond to feature requests and market changes in a timely fashion.
    Walter Calahan wrote:
    I see the two options for pricing, but the Adobe page continues to have a "Buy" button for a totally different price then the two listed.
    Not sure what you mean. Can you elaborate?

  • Migrating stand alone programs to web based application

    Hi,
    I have a small application consisting of .class files. I created these using Swing components and it's based on Client/ server model where it accesses Oracle Database.
    I want to deploy these programs in Java App Server so that it can be accessed thru web browser.
    Please tell me how to do it.
    Thanks in advance.
    Rajeev.
    Message was edited by:
    Rajeev.Asthana

    If this was the thing, Sun, Microsoft and IBM
    wouldn't have even giving a thought of migrating
    legacy application (I'm talking about Mainframes and
    AS/400 here). If this kind of migration is possible,
    can't we migrate a java code from stand-alone
    "version" to web enabled.
    Migration is not really a term to use to for converting a stand alone application to a web application. Unless of course again you are prepared to turn it into an applet.
    The flow and control of a web application are entirely different from a stand alone app. You will not be able to reuse Swing GUI's from a web server. I don't know how to make that any clearer.
    Hopefully you have a good design for your existing application and you can relatively easily reuse your existing business logic components.

  • Windows Media Player ActiveX not playing image, but WMP stand alone application does. Why?

    I use my Windows Media Player v11 with additional codec to play mp4 files (mp4 are not supported by default with WMP 11, so I had to install a codec). It works fine in the stand alone application, but when I use the ActiveX control in NI, it does not use the codec and I get only the sound... no image. I thought the ActiveX was simply an interface to the same core application used by NI and the stand alone media player. And if it is the same core, it should use the same codec. What am I missing?
    Solved!
    Go to Solution.

    I have a tip for you. If you download Quicktime 7(QT), you may select the QT activex player(see picture). It plays mp4 and looks better. And QT is free so it should not any problem. Try and see if it do you any good
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)
    Attachments:
    sample.PNG ‏114 KB

  • XMLSignatureFactory fails in servlet, but works in a stand-alone program.

    Hi all,
    I am trying to write a servlet which will do XML signature et al. For the same, I am using JWSDP 2.0 (Java WebServices Developers Pack) on JRE 1.4.2_5. The servlet is hosted on SAP Netweaver 7 platform on Windows.
    I am getting an exception:
    javax.xml.crypto.NoSuchMechanismException: Cannot find DOM mechanism type
    in the "XMLSignatureFactory.getInstance" line. I looked up in the documentation of XMLSignatureFactory and it says that the DOM mechanism should be provided by the provider argument -  org.jcp.xml.dsig.internal.dom.XMLDSigRI in this case.
    import javax.xml.crypto.dsig.XMLSignatureFactory;
    XMLSignatureFactory sigFactory =
    XMLSignatureFactory.getInstance("DOM", new org.jcp.xml.dsig.internal.dom.XMLDSigRI());
    I tried the above 2 lines in a stand-alone Java client and they work without any issues.
    I also used JWSDP 1.5 and the result was same.
    This means that the servlet API or container for SAP is creating some issues to make this fail.
    I tried to add the "org.jcp.xml.dsig.internal.dom.XMLDSigRI" in the jre/lib/security/java.security, but then the server0 does not start-up.
    Any hints/pointers to resolve this issue?
    Thanks in advance.

    This problem is solved. I am putting the reply here so that others who stumble upon this error can benefit.
    Add the following line to explicitly include the provider before the getInstance
    Security.addProvider(new org.jcp.xml.dsig.internal.dom.XMLDSigRI());
    XMLSignatureFactory sigFactory =
    XMLSignatureFactory.getInstance("DOM", new org.jcp.xml.dsig.internal.dom.XMLDSigRI());

  • Adding gif image to a panel

    Hi
    i have had a look at the link that you have directed to me but i dont understand which code is neccessary for me. please could you help me with the code to add a GIF background image to a Jpanel.
    Thanks

    hi, no it wasnt this link but the link given was not suitable for my programming i need to add an image to a background using the drawImage() method could you please please please help me.
    Thanks

  • Is InCopy a stand-alone program?

    Such a basic question, but I can't fine the answer anywhere.  We use InDesign CS4 for magazine production on a Mac.  The editor (on a PC, of course), wants to do edits on his end.  We understand this is what InCopy is for, but does the editor need a full version of InDesign or just InCopy.  Also would I as designer need to have InCopy also?  We're trying to find out who has to purchase which programs.  Thanks.

    Dear AnneMarie:
    I have looked at InDesign Secrets for years.  You can never know how 
    much free-lancers working in remote home-offices (read: no other way 
    to learn or get help) appreciate your generosity in sharing all your 
    experience. THANK YOU!
    Peter Taylor
    The editor just needs InCopy. The designer just needs InDesign (in 
    ID, the InCopy-related features are already present ... look at 
    Edit > InCopy and Window > Assignments).
    >
    The editor needs to have the fonts used in the text that he/she'll 
    be editing if they want to be able to copyfit and edit linebreaks 
    accurately etc.
    >
    There are some useful videos on Adobe TV about getting started with 
    an InCopy workflow, as well as the ones I did on lynda.com; and 
    some whitepapers you might find useful on http://incopysecrets.com.
    >
    AM
    >

  • Is lightroom a stand alone program

    I'm working on a slightly outdated laptop...and I desperately need access to Adobe photo editing capabilities. I could not install a free trial of Ps and Lightroom...wondering if Lightroom alone will work?

    Time for a new computer if you're serious about running Lightroom (4-cores or more, 6GB ram or more, 3GHz clock-rate or more..).
    You can try it with the machine you've got, but unless you're editing very small raws (or jpegs), I think it will be too frustrating (slow) to use for long.
    That said, you can install Lr5 on a Vista machine, via a hack, but you lose the right to complain about problems if you do:
    start:computer:lightroom5vista [Marcel Dörges Homepage]
    PS - Consider Lr3 if you can't upgrade your machine.
    Rob

  • I am designing a stand alone program

    Hello there,
    i am not sure whether i am in the right forum.
    anyways, i am or i want to develop a music player like
    winamp.
    i need a little help as to which apis i am suppose to use
    or am i supposed to use frames?
    thats it
    bharath

    http://java.sun.com/docs/books/tutorial/index.html
    http://java.sun.com/developer/onlineTraining/GUI/
    http://java.sun.com/j2se/1.5.0/docs/guide/sound/programmer_guide/contents.html
    http://java.sun.com/developer/technicalArticles/Media/JavaSoundAPI/

  • Download LR 5.5 as stand-alone

    Hi,
    I am using LIghroom 5.4 and have heard about the updated version 5.5 which I would like to download and install as it worked fine since I started using LR as from version 3.
    I want to use it as a stand-alone program and have no interest to join the Adobe cloud.
    How and from where can I download the latest update without installing the cloud desktop software?
    Update:
    found the solution myself:
    I went to the download page , pressed on the the windows version of LR 5.5 (german in my case). This opened up a text page with links. Here you scroll down (press page down couple of times) until you see Downloads, and here you press "Proceed to download" which will download the 920 MB exe file on the local harddrive.
    I got frustrated because I missed that I had to scroll down so far, so all I ended up a couple of times was the cloud installer.
    For amateurs this is not the way how I will continue. I will stick to LR as long as it is offered as a stand-alone program. I am not willing to go into the cloud and make it a cash cow for adobe....
    best regards,
    Matthias Brand

    You don't need to be attached to the cloud constantly for the newer versions to work. They only have to connect once every four months or so. I believe they also offer enterprise/government versions that don't require a connection at all, but you would have to contact Adobe sales to find out about that. Also, you can pay in yearly increments instead of monthly (and there may be more options for government versions).
    The only perpetual licenses you can get are for CS6 and equivalent versions, but nothing newer.

  • Ni-daqmx stand-alone matlab

    Dear all,
    I am about to compile my matlab code into a stand-alone program, which works fine. However, as soon as I start the data acquisition the program fails to initialize the DAQ-board.
    I'm using the NI-9201 USB-ADC in combination with the NIDAQmx driver.
    I localized the problem: When trying to initialize the ADC the program fails, since the required dll's are not available. I also localized the dll's and copied them into reach for the stand-alone, but it doesnt work.
    As long as the MATLAB\toolbox\daq\daq\private folder is reachable for the programm/Windows, the software works. However, on the custumers computer I dont want to have MATLAB installed (what sense does it makes to have the option for distributing a stand alone version if the customer has to buy a MATLAB licence?). 
    Can anybody help me solving this problem?  Are there any dll's I may copy into reach of the stand-alone? 
    (Just as information:  The NI - Measurement and Automation was installed on the "customer-computer", In fact it was the exact same computer with the only difference that I renamed the MATLAB folder)
    I'm looking forward to your suggestions!
        Bastian

    The MTALAB toolbox of question is the dataacquisition toolbox, everything else works fine
    The Matlab run-time is not the problem in generell, since everything except of the NIdaqmx-dll's is linked in the program. Here a short description how it works in matlab. 
    - you write code, GUI's etc. and test the program in Matlab
    - then you compile the application into a stand-alone
    - if you hand it to a thrid person that has no Matlab licence, you also distribute the MATLAB-Runtime-Environment (MRE)
    - the person installes this freely-distributable MRE on his computer and then runs the compiled program
    All functions in the program are able to run, except of the NIdaqmx. As soon as I the program tries to communicate to the ADC (i.e. open a channel) the program fails. However, when I provide the dll's mentioned in the exact same directory as they were in Matlab, it works. So I'm not sure what tells the MRE that the dll's are in that folder, since it didn't work, when I just copied the dll's in the run-time directory of the stand alone. 
    Since the program that I would like to distribute is quite complex, re-writing the hole thing in LABView is not an option for me (also, I have no experience with LabView at all, which would require some time to get into it).
    The solution I aim for would be:
    1st (best solution)
    I just do something in the program to have the dll's compiled and linked to in the stand-alone
    2nd
    when installing the program I provide the dll's. (But I dont want to provide them in the folder ..\MATLAB\...\daq\daq\private\...)
     If you dont have the experience with matlab, do you know someone I could ask for this?  Maybe a Matlab forum that addresses NI-ADC questions?
    Thank you for your support!
       Sebastian

Maybe you are looking for

  • How can I deal with negative marking in a quiz marking scheme?

    I wonder if anyone can help me with a problem I have in developing the 'code' for a marking scheme for an exam in Captivate 8. I would be very grateful for pointers towards a viable solution. At the moment I am just thrashing around. My background is

  • Table with more than 1000 columns

    I need to store data from an equipment that logs 1500 parameters every minute. The natural approach would be to create a table where the first column stores the timestamp and the remaining columns the values sampled: CREATE TABLE parameters ( sample_

  • How to implement smart navigation in JSF or JSP

    hi,dear all: we design a jsp page with tiles,everything is ok. But we got a problem: when we design many input text or radio button or listbox on our page1.jsf,it will reload to itself when it got error with the component that user keyin and render t

  • Is the itunes store currently down for anyone else?

    I currently cannot activate my phone because the itunes store cannot be accessed.  Is anyone else having this problem?

  • Why does firefox jump to the front after i hide it in mac os x lion?

    Just installed Lion a week ago and ever since, when i have firefox open and i hide it to do something else, every 40 seconds or so Firefox automatically jumps to the front in finder no matter what i am doing. It is really annoying. Anyone know why th