Images on JText pane............

Hi,
In my (irc) software I want to add EMOTIONS those in MSN messenger.
Im using the JTextPane for writing and displaying the messages. As the JTextPane supports the pictures and components.
Now the problem im facing is.
On hitting the enter key the pane containing the text and emotion icons should be copied to the above pane. For this ive not found any method doing this thing.
The user types some text containing some text and Pictures. Now I want to search the pictures in the whole text and put the special characters in place of them as (:) for smiling face) so that I could send this thing to the server as a string.
On return from the server I do the same.Remember every thing is passing as a string between server and client.
Any help will be highly appreciated
Java adducted

Hello,
sasivarnan gives a good reply.
if you don't use HTML (and only if you don' use it) try:
javax.swing.text.MutableAttributeSet attr = new javax.swing.text.SimpleAttributeSet()
javax.swing.text.StyleConstants.setIcon(attr,new javax.swing.ImageIcon(fileNameOfImage));
yourJTextPane.getStyledDocument().insertString( offset, " ", attr);or
yourJTextPane.insertIcon(...)

Similar Messages

  • Removing of standard java image in JOption Pane

    anyone can help to remove image(standard java image in JOption Pane).
    Looking forward for early response :)
    i tried to use (setIcon) method but i ecountered this error:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at Sample.errorMsg(Sample.java:209)
    at Sample.check(Sample.java:177)
    at Sample.actionPerformed(Sample.java:124)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    just use JOptionPane.PLAIN_MESSAGE as a message type.

  • Standard java Image in JOption Pane

    Hello All!
    i am working on java application. i have to remove image(standard java image in JOption Pane).
    I'll be very thankfull if anybody can help me.
    Looking forward for early response :)

    i tried to use that method but i encountered this error:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at LoginGUI.errorMsg(LoginGUI.java:209)
    at LoginGUI.check(LoginGUI.java:177)
    at LoginGUI.actionPerformed(LoginGUI.java:124)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Sour
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

  • Using RHelp 9 - Compiled Help system missing book images on left pane? Any ideas on how to correct?

    Using RHelp 9 - Compiled Help system missing book images on left pane? Any ideas on how to correct?

    Hi there
    Colum seems to be making an assumption that you are producing Microsoft HTML Help, as the option he mentions only applies to the world of compiled CHM files.
    But this question was posted in the WebHelp forum category, so one might assume that you are producing WebHelp output.
    So the question we ask here is this:
    What *IS* the output type you are creating? WebHelp? Microsoft HTML Help? FlashHelp?
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • How can I set a filter to recalculate (per frame) on a imaging I am panning in a video track?

    Have an image larger than my canvas that I pan across over three seconds. Apply a tilt shift effect to a smart layer but I do not wish the tilt shift to pan with the image I want the 'camera' to be fixed on sticks and panning the image.
    Would try and approximate in AE but there's no tilt shift filter that I can see and this is a rush job. Guassian with a gradient mask doesn't give the bohek effects etc etc
    In fact a way to uncouple a mask (for a guassian blur filter effect) from the transformation of the image would be a good start on this process.

    I didn't realise one could make a smart object of a smart object, and yes that part works locking the movement away into a Smart Layer which itself is not animated. So it is a good first step.
    Unfortuately Tilt Shift effect (and Field Blur, Iris Blur and Lens Blue) cannot be applied to smart layers.
    Nice try, though!
    I did manage to apply a masked radial blur to a section of the image using your methodology and it seems to recalcualte that blur on a per frame basis.

  • Pan | Zoom: how to get image offsets when panning

    Hello,
    I am trying to use the Pan | Zoom control to show images, allowing zoom and pan. I haven't found yet a way to infer the X,Y offset of the part of the image that it's displayed in the imageviewer visible rectangle. I need these details in order to print objects and markers at the right place over the image.
    Is there some hidden or simple way to get these informations?
    Thanks,
       Mario

    Hello,
    I am trying to use the Pan | Zoom control to show images, allowing zoom and pan. I haven't found yet a way to infer the X,Y offset of the part of the image that it's displayed in the imageviewer visible rectangle. I need these details in order to print objects and markers at the right place over the image.
    Is there some hidden or simple way to get these informations?
    Thanks,
       Mario

  • Images with JTabbed Pane

    the panels that i am using in JtabbedPane load images in background at run time when i seperately run them images are loaded but when the panels are used in tabed pane images are not visible

    I have overriden the function . what i am using for my panels is the Image panel which is derived from panel class and i create an instance of that image panel on my panel that is to be added on jtabbed control but it is not showing

  • Selecting Multiple Images from Scroll Pane

    Hi,
    I am quite a newbie to Java GUI and can't find a good example on something I wish to do. I got a scroll pane which actually loaded images as a Label. I do this program to upload the images. I already manage to upload the images somehow. But now the problem is I wish to remove the images from the scroll pane. It will be something like this.
    1. Try to put a check box on each JLabel with the image.
    2. Select multiple JLabel images by selecting the check boxes.
    3. Click on the "Remove" button will remove those JLabel Images which has a check box "checked"
    What I am not too sure is,
    how can I be able to detect a group of checkboxes which is checked inside the scroll pane. So that I can actually removes them from the scroll pane. Can anyone show me a good example for it?

    Keep the check boxes in a Collection of some sort. Iterate through it, calling isSelected() on each box.
    Or, add a listener to the checkboxes so that a list of selected images is updated whenever a box is checked or unchecked.
    One of these may suit better than the other depending on circumstances.

  • Scrolling of images using scroll panes

    sir,
    i have a problem in laying the scroll bars in the frames using scrollpanes.
    i want to display the images having BIL format.
    so,plz help me

    I stand corrected, there's no mention of this on the user guide, odd. 
    http://blogs.sonymobile.com/press_release/xperia-z-1-compact-best-camera-in-compact-waterproof-smart...
    A clever design refinement is the new Glove Mode4 that lets you use your Xperia Z1 Compact even while wearing gloves, making it even easier to use your phone, no matter what the weather.
    4 Supports maximum 2mm thickness
    "I'd rather be hated for who I am, than loved for who I am not." Kurt Cobain (1967-1994)

  • PyGTK image widget with panning and optional scrollbars

    I couldn't find a widget that does this so I made an attemp to make one myself.
    Here's the code (click browse in the sidebar and view scrolledimage.py): http://hg.61924.nl/pygtk-extras/. There is an example in the file itself. After you changed the 2 paths to the images in the file, you can execute it with Python.
    It isn't perfect and it has some bugs, but I don't have any use for it at the moment. You can do anything you want with it.
    Last edited by FSX (2009-12-19 14:38:36)

    I couldn't find a widget that does this so I made an attemp to make one myself.
    Here's the code (click browse in the sidebar and view scrolledimage.py): http://hg.61924.nl/pygtk-extras/. There is an example in the file itself. After you changed the 2 paths to the images in the file, you can execute it with Python.
    It isn't perfect and it has some bugs, but I don't have any use for it at the moment. You can do anything you want with it.
    Last edited by FSX (2009-12-19 14:38:36)

  • Animation in illustrator cs4: pan & rotate across large image while animating text?

    Hi there -
    I have a fairly large circular starmap image - it's a fantasy piece simulating an ancient painted star map with stars, ancient constellation figures, and calligraphic text. Basically a bitmap background from PShop, vector layers with stars, constellations and text. I want to export from Illustrator to Flash a number of short 'movies' of different views of this artwork panning from one point to another with possible zoom and rotation around the image as it pans. I also want to animate one or more of the constellation shapes as the movie pans, as well as adding momentary effects to some of the text.
    I'm familiar with setting up a non-panning animation in illustrator using layers as animation 'cells' and exporting to Flash. But is it possible to do this while moving across a large piece of artwork? How can I capture and export a specific 'view' which moves across the larger image and/or zooms in or out, while also animating a shape or text glow for example? Would this be accomplished with a mask set to the aspect ratio of the final movie which is moved/resized/rotated from layer to layer?
    Is this even possible in Illustrator CS4? I'm not familiar with Premier or AE, hoping to stay within Illy and Flash.
    Thanks!

    Thanks Monica,
    After researching, it looks like Sony Vegas can be used to create a freeflowing video 'fly-over' of the artwork. And then at specific points I can import and animate the Illustrator vector pieces with After Effects - just a 'bit' of a learning curve now...

  • "Stuttering" when panning/zooming a still image...?

    Hello.
    I'm working on a small project which is basically a series of zooms/pans on still images. The pans/zooms are quite slow and take place over about 6-8 seconds. There's nothing too fancy going on here, but I notice that when I do a RAM preview or render out a comp, I get small "stutters" in some of them. Does anyone have any ideas why this would be happening and any suggestions on making these animations a little more "smooth". I mean, these things aren't complex at all, and overall they're quite smooth, but there's still times when I get these stutters and I can't figure out why they'd be happening? Would appreciate some advice!
    Thanks,
    Kristin.

    There are certain speeds that sync up with frame rates so that they cause judders, jitters, stuttering or whatever you want to call it. The slower the frame rate the more obvious the problem.
    If you've ever watched a western on TV or at the movies you've seen the stagecoach wheels turn backwards at various speeds. This is an example of the problem. It's actually called a stroboscopic effect. Mechanics, in the good old days when cars had carburetors and distributors, used to hook up a timing light to the #1 spark plug so that a light flashed on a timing mark on the crankshaft pulley. This light had the effect of stopping the rotation visually. That's exactly what's happening when you are moving your photograph across the frame at one of the critical speeds. Your eye is fooled and your brain can't process the movement smoothly.
    There are also other cases where the sub pixel interpolation between frames causes areas of detail to flicker between frames. The latter problem can be seen by viewing your comp a frame at a time while zoomed in to say 800% and observing the edge detail. This problem can be especially nasty when you're trying to do a smooth title or credit roll. The horizontal lines that make up fine type can almost completely vanish between fields or frames if the text is moving at the wrong speed. You can test this out by creating a single pixel high horizontal line in AE and animating it from bottom to top of the frame. The only speed where you'll get a nice solid line in every frame or field is one that is an exact multiple of the frame rate. IOW, 1 frame 1 pixel of movement, 1 frame 2 pixels of movement, and so on. Move at 1 frame and 1.33 pixels of movement and the line will appear to completely disappear then return.
    If you are working at 24fps progressive you'll find that the juddering caused by motion at critical speeds is much more problematic than projects at 29.97 fps. Interlacing, as was mentioned before, helps and gives you a wider range of motion, but interlacing can introduce more pronounced flickering in the detail if you are right at one of these critical speeds.
    This problem extends to shooting as well. Cinematography manuals contain critical panning speed charts that list the number of degrees per second you can pan with various lens (angle of view) and shutter speed combinations. There isn't a videographer out there that's tried shooting 24P video and not ended up with an unusable pan due to these critical speeds.
    The solution to successfully animating detailed images is to use the right speed (pixels per second) for your frame rate, add extra motion blur to hide the problem, or reduce the amount of detail in the image. These are the only solutions that I know of. They all limit design and timing, but what good is your design if it makes your eyes go buggy.
    The best way I know if to tell if the problem is a playback issue is to use a device or program that tells you when you're dropping frames. You can use QT (by looking at the playback rate) or in FC or PPro by having the program report dropped frames. If it's a data rate issue you need more horsepower or a better codec. 

  • Panning and scaling image stills - jerky playback

    when I render out a movie of my project that has still images that are
    panning and zooming the playback of those stills is a bit jerky
    How can get the motion so its smooth and does'nt stutter
    any help would be very helpfull

    Rick Gerard wrote:
    If your computer is up to the data rate required by the codec and frame size, and the image is still juddering then you're in the world of wrong panning...
    Unfortunately that is not always the case...
    Below a scenario that has been driving my nuts, nuts :
    On ANY Mac when viewing in quicktime the following applies:
    (Before anyone is tempted to say 'But my Mac will play back 1080p' - mine TOO.... But NOT when moving 1080x1920 pixels
    over an extended amount of time!!!)
    1) Boot up you Mac
    2) Prior to launching ANY others apps, launch the quicktime player with the 1080p pan
    3) Use the Plus-Minus keys to set the QT window to half size.
    4) Hit play. Shot play wonderfully.
    5) Open Premiere Pro or After Effects and do an hour's worth of intensive work.
    7) Close all the adobe apps.
    8) Open the QT player and try step 3 and 4 again.
    On my Mac which is about as fast as they come... THAT movies which used to playback VERY smooth now looks as if
    someone is having an epileptic seizure !
    Do a restart and it all looks smooth again. Work an hour in the two a.m. apps or other apps for that matter and your are back
    epileptic seizures....
    No matter how much one would like his movies to playback on a computer..... As of today, I have yet to come accross
    a CPU capable of moving 1080x1920 pixels SMOOTHLY over an extended period of time.
    Hopefully, the future holds more for CPU-viewing of Video !!!

  • How can I create a single background image for a BorderLayout?

    I can create a background with an image file for the individual panel (North, West, Center, East and South) in a BorderLayout, but I've been spinning my wheel for a long while now trying to figure out how to create just one background with a single image file for all of these panels?
    In my application, a panel may contain various buttons, a listbox, a group of checkboxes, a combo box, or a canvas. Even if I used the same image file, when the panels are finally put together, one can clearly see that the end product is the result of a lot of patch works.
    Hope someone has an answer for this. BTW, I'm using AWT because it works with existing browsers without the need for a separate Java plug-in.
    Regards,
    V.V.

    Look at this :
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.awt.image.BufferedImage;
    public class PanI extends Frame
         Image map;
         Panel pan;
         myPan p8,p4,p6,p2,p5;
         BufferedImage I;
    public PanI() 
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);}});
         map = getToolkit().getImage("map2.gif");
         MediaTracker tracker = new MediaTracker(this);
         tracker.addImage(map,0);
         try   {tracker.waitForID(0);}
         catch (InterruptedException e){}
         I = new BufferedImage(1,1,BufferedImage.TYPE_INT_ARGB);
         setBounds(10,10,map.getWidth(null)+8,map.getHeight(null)+27);
         setLayout(new BorderLayout());
         pan = new Panel();
         add(pan,BorderLayout.CENTER);
         pan.setLayout(new BorderLayout());
         pan.setSize(map.getWidth(null),map.getHeight(null));
         p5 = new myPan(5);
         p5.setBackground(Color.red);
         pan.add(p5,BorderLayout.CENTER);
         p8 = new myPan(8);
         p8.setBackground(Color.orange);
         pan.add(p8,BorderLayout.NORTH);
         p4 = new myPan(4);
         p4.setBackground(Color.blue);
         pan.add(p4,BorderLayout.WEST);
         p6 = new myPan(6);
         p6.setBackground(Color.green);
         pan.add(p6,BorderLayout.EAST);
         p2 = new myPan(2);
         p2.setBackground(Color.pink);
         pan.add(p2,BorderLayout.SOUTH);
         setVisible(true);
    public class myPan extends Panel
         int where;
    public myPan(int i)
         super();
         where = i;
    public void paint(Graphics g)
         if (I.getWidth(null) != pan.getWidth() || I.getHeight(null) != pan.getHeight())
              I = new BufferedImage(pan.getWidth(),pan.getHeight(),BufferedImage.TYPE_INT_ARGB);
              Graphics      G = I.getGraphics();
              G.drawImage(map,0,0,pan.getWidth(),pan.getHeight(),null);     
              G.dispose();
         int x1=0;
         int x2=getWidth();
         int y1=0;
         int y2=getHeight();
         if (where == 8)
         if (where == 2)
              y1 =  p8.getHeight()+p5.getHeight();
              y2 =  getHeight()+y1;
         if (where == 4)
              y1 =  p8.getHeight();
              y2 =  y1+getHeight();
         if (where == 5)
              x1 =  p4.getWidth();
              x2 =  x1+getWidth();
              y1 =  p8.getHeight();
              y2 =  y1+getHeight();
         if (where == 6)
              x1 =  p4.getWidth()+p5.getWidth();;
              x2 =  x1+getWidth();
              y1 =  p8.getHeight();
              y2 =  y1+getHeight();
         g.drawImage(I,0,0,getWidth(),getHeight(),x1,y1,x2,y2,null);
    public void update(Graphics g)
         paint(g);
    public static void main (String[] args) 
         new PanI();
    Noah

  • Pan & Zoom multilayered PSDs. Help needed

    Hi All,
    I've got an edit I need to finish pronto then another one this coming monday and need to get some questions answered before then or in serious trouble!
    Additional details: Running FCP 5
    We have a client that wants to do an animatic (motion graphic add)
    He want's to be able to import a multilayered photoshop image WHILST keeping the original image quality, if the dimensions are above 720x576 (I edit in UK therefore PAL pixel dimensions), so you can pan and zoom across the image while simultaneous fading up and down and moving certain layers.
    I was originally going to edit it on an Avid Adrenalin but found out that you can do some but not all of these things without great difficulty. SO am therefore going to edit on my FCP suite.
    I tried last night to import a multilayered photoshop image and made it double the normal 16x9 PAL pixel dimentions (which are 1204x576) making it 2048x1152.
    Doing this I hoped it would let me try and achieve a pan & zoom effect, but I found that it distorted the aspect ratio of the clip.
    Making it squashed, even though my new project that I had set up was Pal DV Anamorphic (16x9). It dispalayed the newly created large psd as eveen more anamorphic - more like cinema scope!!
    I looked it the motion tap and the distort aspect ratio in the motion tab was zero.
    I then did a test:
    flattened the psd, changed the image size to 1024x576.
    I then imported that and all was fine, it imported it at the correct ratio.
    Also major question.
    Is FCP able to handle these graphics easily.
    When I import them and insert them into the new seq I can set that seq to Unlimited RT low playback to see the move easily.
    But when I open the nest that has all the layers it wont let me set RT settings, it only displays a few options, none that allow me to view in low res.
    The client wants to edit in DV not lower so cant do motion jpg offline res.
    He also needs the large images, eg we pan across a models hair only to fade up a layer of a product appearing in her hand.
    I don't know After Effects well enough to attempt the edit on that, and I don't know motion at all.
    The photographer/ client says he's done all his previous edits in FCP.
    Is there an article I could read or is there any advise anyone can give me about approaching this project?
    Minimizing render time, work flow etc
    Has anyone used Lyric Media's Pan Zoom Pro?? (Or was that used by people with FCP 4 and now FCHD can acheive Pan & Zooms really well???)
    Thanks anyone for the help!!!!
    d

    Tom/ anyone else who can help,
    (note: also posted on 2pop erlier, just incase Tom/anyone else read that one, saving you the trouble of reading twice!)
    Sorry back again,
    very nearly sorted after breakthrough last night.
    Just need to clear up one more thing:
    An FCP editor mate says he keeps the graphics he's given high res i.e. 300dpi, he says you can zoom in and keep the quality.
    Can fcp handle bigger image resolutions? I know it can only go up to 4000 pixels squared but what dpi can it go up to. I always thought it would only work in 72 dpi.
    Before finding about about fcp being able to handle higher than 72dpi, after numerous tests and conversations with you, I'd come to the conclusion that:
    If designing in Photoshop for Final Cut Pro
    If you don't use photoshop's PAL DV presets take this into consideration:
    In graphics for 4:3 FCP projects:
    768x576 convert to 720x576
    1536x1152 convert to 1440x1152
    always divide graphics width in photoshop by:
    1.06666666667
    In graphics for 16:9 FCP projects:
    1024x576 convert to 720x576
    2048x1152 convert to 1440x1152
    always divide graphics width in photoshop by:
    1.42222222222
    I'm not sure of the actual size of the images the client is going to give me & I desperately don't want to get into the problem I had yesterday of distorted aspect ratios when importing to FCP.
    The only question is
    If he gives me a photo that's 300dpi I'm going to have a problem with knowing exactly what size the image will be in photoshop regarding rescaling etc.
    When he gives me the graphics, I'll check the dimetions in photoshop.
    I should check if it's a rectangular or suare pixel doc first correct?
    My thinking is that it'll be square pixel coming from a digital camera, and we'll prob work in 4:3 (i've just been given video rushes to combine with the edit at 4:3 res)
    Regarding the graphics,
    Should I work in a high res and keep the pixel dimentions as high as I need up to 4000pix squared or should I keep it at 720x576 and keep the res high?
    FCP works better with images at 720x576 they don't need rendering regardless of the dpi?? ANd also when you step into the PSD nest it gives you an option of Unlimited RT, it even has a dark green line in Safe RT.
    Whereas when I work in images over 720x576, (say double that at 1440x1152) the PSD seq FCP creates when importing the multi-layered graphic has a red render line and won't let me work in Unlimited RT or Safe RT, it just gives the option of: 'use playback settings' or 'full quality'.
    would it be good to create a photoshop template, so that I can drop the graphics I'm given into that, then manipulate it accordingly??
    All advice welcome!!
    Sorry finding if still finding it slightly confusing!
    Almost there!!!!
    thanks for reading
    d

Maybe you are looking for