How to dynamically assign jpeg file to a picture widget?

Hi..
I have a path of a image with me. I want to dynamically assign the image to the picture widget.
Anyone know how to do this??
thnaks,
natarak

Are you using Mail or a 3rd party email client? 

Similar Messages

  • How can I assign image file name from Main() class

    I am trying to create library class which will be accessed and used by different applications (with different image files to be assigned). So, what image file to call should be determined by and in the Main class.
    Here is the Main class
    import org.me.lib.MyJNIWindowClass;
    public class Main {
    public Main() {
    public static void main(String[] args) {
    MyJNIWindowClass mw = new MyJNIWindowClass();
    mw.s = "clock.gif";
    And here is the library class
    package org.me.lib;
    public class MyJNIWindowClass {
    public String s;
    ImageIcon image = new ImageIcon("C:/Documents and Settings/Administrator/Desktop/" + s);
    public MyJNIWindowClass() {
    JLabel jl = new JLabel(image);
    JFrame jf = new JFrame();
    jf.add(jl);
    jf.setVisible(true);
    jf.pack();
    I do understand that when I am making reference from main() method to MyJNIWindowClass() s first initialized to null and that is why clock could not be seen but how can I assign image file name from Main() class for library class without creating reference to Main() from MyJNIWindowClass()? As I said, I want this library class being accessed from different applications (means different Main() classes).
    Thank you.

    Your problem is one of timing. Consider this simple example.
    public class Example {
        public String s;
        private String message = "Hello, " + s;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example();
            ex.s = "world";
            System.out.println(ex.toString());
    }When this code is executed, the following happens in order:
    1. new Example() is executed, causing an object to constructed. In particular:
    2. field s is given value null (since no value is explicitly assigned.
    3. field message is given value "Hello, null"
    4. Back in method main, field s is now given value "world", but that
    doesn't change message.
    5. Finally, "Hello, null" is output.
    The following fixes the above example:
    public class Example {
        private String message;
        public Example(String name) {
            message = "Hello, " + name;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example("world");
            System.out.println(ex.toString());
    }

  • How to include assigned .as files in MXMLC ant task ?

    When i use mxmlc ant task, i found that
    the tag <include-sources/> doesn't support !
    ( described by http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7a63.html )
    neither SDK version 3.x nor 4.x
    Are they lying?!
    How to include assigned .as files ?
    Thank you !

    My understanding is that mxmlc will use all available resources in the source path, as needed. Instead of giving it individual resources to include, you simply need to give it the source-path that contains those resources. This is different from a library project, which may need to include individual classes that are never used in that library.

  • HOW do I copy jpeg files from my Windows PC to my iPad2?

    How do I copy jpeg files from my Windows PC, to my iPad2?

    If you are on iTunes 11 on your PC then you may want to enable the left-hand sidebar via View > Show Sidebar (or control-S), which might make it easier to navigate.
    To sync photos, connect and select your iPad on the left-hand sidebar of your computer's iTunes, and on the right-hand side there should be a series of tabs, one of which should be Photos - if you select that tab you can then select which photo folders to sync to the iPad's Photos app. There is a bit more info on this page. You will need to sync all the photos that you want on the iPad together in one go as only the most recent photo sync remains on the iPad - synced photos can't be deleted directly on the iPad, instead they are deleted by not including them in the next photo sync.

  • Ust purchase an iphone 4s and need to know how could i transfer all files including (contacts, pictures, music, notes and ect.... from sd card or any external card to iphone 4s, please advise thx

    ust purchase an iphone 4s and need to know how could i transfer all files including (contacts, pictures, music, notes and ect.... from sd card or any external card to iphone 4s, please advise thx.

    You need to put all of your info on your computer and then sync it to iphone.

  • Anyone know how to send a jpeg file to Windows via Mail without it being embedded into the receivers email

    The plain text feature in Mail application does not seem to be working. I noticed this when I send jpg attachments to Windows machines, the receiver gets the attached jpg file embedded in their email and they have no way to save the jpg image. This type of behaviour is normal when when sending rich text emails to Windows machines, but selecting plain text used to eliminate this problem in Snow Leopard.
    I have 'always send window-friendly attachemnts' selected.
    I spoke to Apple about this and they say it was designed this way.
    Can you tell me how I can send jpeg images from Lion to Windows machines so that they can save and reomve the file from their email application?

    Perhaps the boolean expression isn't working because it needs to be all caps: YES instead of yes
    In any case, a simple 1 or 0 works just fine for me without -bool:
    The command to disable in-line attachments (all attachments appear as icons)
    defaults write com.apple.mail DisableInlineAttachmentViewing 1
    To command to (re-)enable in-line attachments once disabled (all attachments appear as images or documents displayed in-line)
    defaults write com.apple.mail DisableInlineAttachmentViewing 0
    Also, when composing a new message with an attachment, be certain that 'Send Windows-Friendly Attachments' is checkmarked at the bottom of the new message screen:

  • How to dynamically assign Display Pattern using FormCalc in Adobe PDF Form

    I am using Adobe PDF Form Designer. I am trying to dynamically assign a display pattern like MM/DD/YYYY to the Field tab - Display Pattern property. May I know how to do that?
    I am using FormCalc scripting.

    hi,
    After placing the date field in layout from data view, u will get tabs like field,layout,border etc..
    In field tab under the edit pattern specify the pattern in which you want to display the date field.
    hope this works.
    Reward points if helpful.

  • How to convert a jpeg file into a 1-bit bmp file (2 colors image)

    Hi. I�m having serious problems to convert a jpeg file into a 1-bit bmp file (2 colors image).
    I�m using FileSaver.saveAsBmp(String t) but what i get is a bmp image, but with 16M colors, but what i want is a 2 colors bmp file. A black and white image.
    Does anybody know how to do this? I�m really getting crazy with ths problem.
    Thanks in advance

    Hi opalo,
    this code may help you...
    import java.awt.*;
    import java.io.*;
    import java.awt.image.*;
    import javax.imageio.ImageIO;
    class Write1 extends Component {
    //--- Private constants
    private final static int BITMAPFILEHEADER_SIZE = 14;
    private final static int BITMAPINFOHEADER_SIZE = 40;
    //--- Private variable declaration
    //--- Bitmap file header
    private byte bitmapFileHeader [] = new byte [14];
    private byte bfType [] = {'B', 'M'};
    private int bfSize = 0;
    private int bfReserved1 = 0;
    private int bfReserved2 = 0;
    private int bfOffBits = BITMAPFILEHEADER_SIZE + BITMAPINFOHEADER_SIZE;
    //--- Bitmap info header
    private byte bitmapInfoHeader [] = new byte [40];
    private int biSize = BITMAPINFOHEADER_SIZE;
    private int biWidth = 50;
    private int biHeight = 70;
    private int biPlanes = 1;
    //private int biBitCount = 24;
    private int biBitCount = 1;
    private int biCompression = 0;
    private int biSizeImage = 0x030000;
    private int biXPelsPerMeter = 0x0;
    private int biYPelsPerMeter = 0x0;
    private int biClrUsed = 0;
    private int biClrImportant = 0;
    //--- Bitmap raw data
    private int bitmap [];
    //--- File section
    private FileOutputStream fo;
    //--- Default constructor
    public Write1() {
    public void saveBitmap (String parFilename, Image parImage, int
    parWidth, int parHeight) {
    try {
    fo = new FileOutputStream (parFilename);
    save (parImage, parWidth, parHeight);
    fo.close ();
    catch (Exception saveEx) {
    saveEx.printStackTrace ();
    * The saveMethod is the main method of the process. This method
    * will call the convertImage method to convert the memory image to
    * a byte array; method writeBitmapFileHeader creates and writes
    * the bitmap file header; writeBitmapInfoHeader creates the
    * information header; and writeBitmap writes the image.
    private void save (Image parImage, int parWidth, int parHeight) {
    try {
    convertImage (parImage, parWidth, parHeight);
    writeBitmapFileHeader ();
    writeBitmapInfoHeader ();
    writeBitmap ();
    catch (Exception saveEx) {
    saveEx.printStackTrace ();
    * convertImage converts the memory image to the bitmap format (BRG).
    * It also computes some information for the bitmap info header.
    private boolean convertImage (Image parImage, int parWidth, int parHeight) {
    int pad;
    bitmap = new int [parWidth * parHeight];
    PixelGrabber pg = new PixelGrabber (parImage, 0, 0, parWidth, parHeight,
    bitmap, 0, parWidth);
    try {
    pg.grabPixels ();
    catch (InterruptedException e) {
    e.printStackTrace ();
    return (false);
    pad = (4 - ((parWidth * 3) % 4)) * parHeight;
    biSizeImage = ((parWidth * parHeight) * 3) + pad;
    bfSize = biSizeImage + BITMAPFILEHEADER_SIZE +
    BITMAPINFOHEADER_SIZE;
    biWidth = parWidth;
    biHeight = parHeight;
    return (true);
    * writeBitmap converts the image returned from the pixel grabber to
    * the format required. Remember: scan lines are inverted in
    * a bitmap file!
    * Each scan line must be padded to an even 4-byte boundary.
    private void writeBitmap () {
    int size;
    int value;
    int j;
    int i;
    int rowCount;
    int rowIndex;
    int lastRowIndex;
    int pad;
    int padCount;
    byte rgb [] = new byte [3];
    size = (biWidth * biHeight) - 1;
    pad = 4 - ((biWidth * 3) % 4);
    if (pad == 4) // <==== Bug correction
    pad = 0; // <==== Bug correction
    rowCount = 1;
    padCount = 0;
    rowIndex = size - biWidth;
    lastRowIndex = rowIndex;
    try {
    for (j = 0; j < size; j++) {
    value = bitmap [rowIndex];
    rgb [0] = (byte) (value & 0xFF);
    rgb [1] = (byte) ((value >> 8) & 0xFF);
    rgb [2] = (byte) ((value >> 16) & 0xFF);
    fo.write (rgb);
    if (rowCount == biWidth) {
    padCount += pad;
    for (i = 1; i <= pad; i++) {
    fo.write (0x00);
    int b = 1200;
    fo.write(b);
    rowCount = 1;
    rowIndex = lastRowIndex - biWidth;
    lastRowIndex = rowIndex;
    else
    rowCount++;
    rowIndex++;
    //--- Update the size of the file
    bfSize += padCount - pad;
    biSizeImage += padCount - pad;
    catch (Exception wb) {
    wb.printStackTrace ();
    * writeBitmapFileHeader writes the bitmap file header to the file.
    private void writeBitmapFileHeader () {
    try {
    fo.write (bfType);
    fo.write (intToDWord (bfSize));
    fo.write (intToWord (bfReserved1));
    fo.write (intToWord (bfReserved2));
    fo.write (intToDWord (bfOffBits));
    catch (Exception wbfh) {
    wbfh.printStackTrace ();
    * writeBitmapInfoHeader writes the bitmap information header
    * to the file.
    private void writeBitmapInfoHeader () {
    try {
    fo.write (intToDWord (biSize));
    fo.write (intToDWord (biWidth));
    fo.write (intToDWord (biHeight));
    fo.write (intToWord (biPlanes));
    fo.write (intToWord (biBitCount));
    fo.write (intToDWord (biCompression));
    fo.write (intToDWord (biSizeImage));
    fo.write (intToDWord (biXPelsPerMeter));
    fo.write (intToDWord (biYPelsPerMeter));
    fo.write (intToDWord (biClrUsed));
    fo.write (intToDWord (biClrImportant));
    // DataOutputStream temp = new DataOutputStream(fo);
    // int m = 32;
    // temp.writeInt(m);
    catch (Exception wbih) {
    wbih.printStackTrace ();
    * intToWord converts an int to a word, where the return
    * value is stored in a 2-byte array.
    private byte [] intToWord (int parValue) {
    byte retValue [] = new byte [2];
    retValue [0] = (byte) (parValue & 0x00FF);
    retValue [1] = (byte) ((parValue >> 8) & 0x00FF);
    return (retValue);
    * intToDWord converts an int to a double word, where the return
    * value is stored in a 4-byte array.
    private byte [] intToDWord (int parValue) {
    byte retValue [] = new byte [4];
    retValue [0] = (byte) (parValue & 0x00FF);
    retValue [1] = (byte) ((parValue >> 8) & 0x000000FF);
    retValue [2] = (byte) ((parValue >> 16) & 0x000000FF);
    retValue [3] = (byte) ((parValue >> 24) & 0x000000FF);
    return (retValue);
    class Writebmp
         public static void main(String args[])
              //Image img = Toolkit.getDefaultToolkit().getImage("jatin.bmp");
              try
              File filename = new File("jatin_test.bmp");
              BufferedImage image = ImageIO.read(filename);
              Graphics graphics = image.getGraphics();
              graphics.drawString("&#2313;&#2332;&#2327;&#2352;",10,30);
              Write1 w = new Write1();
              Image img = Toolkit.getDefaultToolkit().getImage("jatin_test.bmp");
              w.saveBitmap("jatin_test.bmp",img,200,200);
              catch (IOException e)
    System.err.println ("Unable to write to file");
    System.exit(-1);
    }

  • How to dynamically assign BP to territory

    Hi all,
         I want to dynamically assign business partner to territory only, if the business partner is created by the user assigned to the territory.
      How can we do this, If there is any function module please send. or can we do any  customization .
    Thanks
    Hemalatha

    Hi Hemalatha,
    What Ashish told is correct
    The Main use of Territory is
    Who is responsible for a particular territory or business partner
    Which territory or employee is responsible for a business transaction (for example, sales order)
    Which business partners belong to a particular territory
    Which products can be offered in a particular territory
    According to Levels in Territory Hierarchy like Area, Region etc the BP will comes to particular Territory U does not required to assign the BP to Territory,
    The system automatically takes the Responsible Employee etc according to the Area Region etc as u ve given the level in Territory Hierarchy
    Reward points if it helpful to u
    cheers
    Ranga

  • How can i store jpeg file in iCloud?

    I want to upload jpeg file in iCloud, so that I could insert it to my document later with Pages. but can't find how can i store this type of file in icloud....

    iCloud isn't really meant for that purpose, more for syncing across devices. Try something like dropbox.

  • How to dynamically load jar files - limiting scope to that thread

    Dynamically loading jar files has been discussed a lot. I have read a quite a few posts, articles, and demo code for doing just that. However, I have yet to find a solution to my problem. Most people modify their system class loader and are happy. I have done that and was happy for a time. Occasionally, you will see reference to an application server or tomcat or some other large project that have successfully been able to load and unload jar files, allow for dynamic deployment of code, etc. However, I have not been able to achieve similar success; And my problem is much less complicated.
    I have an application that executes a thread to send a given file/message to a standard JMS Server Queue. Depending on the parameters selected by the user, this thread may need to communicate with one of a number of JMS Servers, ie. JBoss, WebLogic, EAServer, Glassfish, etc. All of which can be done with the same code, but each needs to load their own flavor of JMS Client Jar files. In this instance, spawning a separate JVM for each communication would work from a classloader perspective. However, I need to keep it in the family and run under the same JVM, albeit each JMS Server Connection will be created and maintained in separate Threads.
    I am close, I am doing the following...
    1. Creating a new URLClassLoader in the run() method of each thread.
    2. Set this threads contextClassLoader to the new URLClassLoader.
    3. Load the javax.jms.JMSException class with the URLClassLoader.loadClass() method.
    4. Create an initialContext object within this thread.
    Note: I read that the initialContext and subsequent conext lookup calls would use the Thread�s
    contextClassLoader for finding/loading classes.
    5. Perform context.lookup calls for a connectionFactory and Queue name.
    6. Create JMS Connection, etc. Send Message.
    Most of this seems to work. However, I am still getting a NoClassDefFoundError exception for the javax.jms.JMSException class ( Note step #3 - tried to cure unsuccessfully).
    If I include one of the JMS Client jar files ( ie wljmsclient.jar for weblogic ) in the classpath then it works for all the different JMS Servers, but I do not have confidence that each of the providers implemented these classes that now resolve the same way. It may work for now, but, I believe I am just lucky.
    Can anyone shine some light on this for me and all the others who have wanted to dynamically load classes/jar files on a per Thread basis?

    Thanks to everyone - I got it working!
    First, BenSchulz' s dumpClassLoader() method helped me to visualize the classLoader hierarchy. I am still not completely sure I understand why my initial class was always found by the systemClassLoader, but knowning that - was the step I needed to find the solution.
    Second, kdgregory suggested that I use a "glue class". I thought that I already was using a "glue class" because I did not have any JMSClient specific classes exposed to the rest of the application. They were all handled by my QueueAdmin class. However...
    The real problem turned out to be that my two isolating classes (the parent "MessageSender", and the child "QueueAdmin") were contained within the same jar file that was included in the classpath. This meant that no matter what I did the classes were loaded by the systemClassLoader. Isolating them in classes was just the first step. I had to remove them from my jar file and create another jar file just for those JMSClient specific classes. Then this jar file was only included int custom classLoader that I created when I wanted to instantiate a JMSClient session.
    I had to create an interface in the primary jar file that could be loaded by the systemClassLoader to provide the stubs for the individual methods that I needed to call in the MessageSender/QueueAdmin Classes. These JMSClient specific classes had to implement the interface so as to provide a relationship between the systemClassLoader classes and the custom classLoader classes.
    Finally, when I loaded and instantiated the JMSClient specific classes with the custom classLoader I had to cast them to the interface class in order to make the method calls necessary to send the messages to the individual JMS Servers.
    psuedu code/concept ....
    Primary Jar File   -  Included in ClassPath                                                      
    Class<?> cls = ClassLoader.loadClass( "JMSClient.MessageSender" )
    JMSClientInterface jmsClient = (JMSClientInterface) cls.newInstance()                            
    jmsClient.sendMessage()                                                                      
    JMSClient Jar File  -  Loaded by Custom ClassLoader Only
    MessageSender impliments Primary.JMSClientInterface{
        sendMessage() {
            Class<?> cls=ClassLoader.loadClass( "JMSClient.QueueAdmin" )
            QueueAdmin queueAdmin=(QueueAdmin) cls.newInstance()
            queueAdmin.JMSClientSpecificMethod()
        }

  • How to open several jpeg files in Raw Converter ?

    Hello !
    With my PC/Windows7 and PhotoShop Elements 8, what is the way to open several jpeg files at the same time in Raw Converter ?
    In the Editor, File/Open As gives the possibility with only 1 file ?
    Thanks for your answers,
    JeanRoger

    c'est le deuxième menu de gauche

  • PDA example: Reading a jpeg file into a picture control

    Hi
    Does anybody have a simple PDA example of how to read a .jpg file and show it in a picture control. The jpg examples I've found does not compile for PDA.

    Evan wrote in message news:<[email protected]>...
    > In LabVIEW for windows there are VIs to read in JPEGs, however the PDA
    > module does not support those VIs, so I do not believe there is a way
    > to display JPEGs.
    The hard way would be to write your own JPEG -> Bitmap / Array
    de-compression routine. You will probably find example (C++) code at
    the JPEG web site.
    http://www.jpeg.org/jpeg_about.html

  • How to dynamically assign file to XMLDataSet?

    I have the following code and it works great:
    <script src="SpryAssets/xpath.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryData.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryNestedXMLDataSet.js" type="text/javascript"></script>
    <script type="text/javascript">
    var dsSESSION = new Spry.Data.XMLDataSet("../Classes/LINE DANCE - BEGINNER I.xml", "SUBPROGRAM/SESSION");
    var dsSCHED = new Spry.Data.NestedXMLDataSet(dsSESSION, "SCHED");
    </script>
    </head>
    <body>
      <div spry:region="dsSESSION dsSCHED">
        <ul>
          <li spry:repeat="dsSESSION">{@name}
            <ul>
              <li spry:repeat="dsSCHED">{SCHED}</li>
              <li spry="dsSCHED">{INST}</li>
              <li spry="dsSCHED">{NOTES}</li>
            </ul>
          </li>
        </ul>
      </div>
    </body>
    What I need is to be able to reassign the XMLDataSet to a different file from a menu onClick event. Have not been able to do this yet.

    You can set a new url using the methods of the Spry Data Set.
    See API reference: setURL
    Besure to do a ds.loadData(); after you have set a new URL.

  • Dynamically assign the file name for "on demand read"

    Hi.
    A quick question.
    I need to poll a directory using the on demand read function of the FB component, and change the file name in the BPEL process.
    Basically I need to dynamically overwrite the destination file name at runtime.
    These are the steps in my Process
    1. Pick up XML file,
    2. Assign a field in the xml file (fileName) to a variable (flatFileName)
    3. Poll a specific directory using onDemandRead and look for the fileName specified in the variable
    So obviously,
    I have tried to assign the variable flatFileName to the fileName property in the FB component of the readout variable. But it doesn't seem to work.
    Firstly I want to know if this is possible, and secondly, any idea on how to solve this issue.
    Thanks in advance

    I think it is not possible. becuase the date & time added at runtime. so if you check the table  PATH you can find filename and their definitions

Maybe you are looking for

  • Can someone please explain Voice Memos syncing?

    Hi All, I'm really, really, really confused about Voice Memos, and syncing them with iTunes. My setup is an iPhone 5, and a MacBook Pro Retina 13". My wife also has an iPhone, and we both sync them to iTunes on the Mac, including backing them up to t

  • 'page size' and OCR

    Is there any way to shrink the 'page size' of a PDF? I have a couple of very high-res PDF documents of 17th C books that I would like to run OCR on, but I get an error message that 'page size' is greater than 45 in.  The original documents would have

  • Frequent request to use more memory

    I often am asked for permission for the site to use more (Safari) memory.  It's annoying.  What can I do to elimintae this annoyance?  I've set "database storage" to 50 meg but the popup message thinks I have much less. Mac OS10.5.8  I believe I have

  • Cant accept shared scripts

    Every time I try to accept a shared script I get an error saying I already have the script in my projects, but I dont.  Anyone else have this problem or a way to fix this?

  • PO document

    Hi, I am able  change directly the Price in ME22 for document AA  and currency USD.but for the same document type for currency EUR i am unable to change on me22 directly,but by clicking header condition tab inside it is able to change. I have checked