Painting the background

Hi everyone. I have a little question.
I'm trying to make my application draw some background images (in the HBackground) And everything seems to be ok except when the image is drawed. It appears but distorted. I first put the background and then reduce the video playing so te background could be seen. Maybe I have to reduce the video first? For reducing it I use the AWTVideoSizeControls and ServiceContext way
This is the little piece of code for painting the background
public void cambiar_fondo_imagen(String imagen) {
        HBackgroundConfigTemplate plantilla = new HBackgroundConfigTemplate();
        plantilla.setPreference(HBackgroundConfigTemplate.FLICKER_FILTERING, HBackgroundConfigTemplate.REQUIRED);
        plantilla.setPreference(HBackgroundConfigTemplate.STILL_IMAGE, HBackgroundConfigTemplate.REQUIRED);
        HBackgroundConfiguration config = planoBackground.getBestConfiguration(plantilla);
        HStillImageBackgroundConfiguration configStill = null;
        if (config instanceof HStillImageBackgroundConfiguration) {
            configStill = (HStillImageBackgroundConfiguration)config;
        planoBackground.reserveDevice(this);
        try {planoBackground.setBackgroundConfiguration(configStill);}
        catch (Exception e) {System.out.println("Excepcion: " + e);}
        if (config != null) {
            HBackgroundImage imagenFondo = new HBackgroundImage(imagen);
            try {configStill.displayImage(imagenFondo);}
            catch (Exception e) {System.out.println("Excepcion: " + e);}  
     }Maybe I may change some HBackgroundConfigTemplate options? (I'm using an i-frame of a mpg as the background image)

right-click (or command-click) in the outer canvas, and watch for the pop-up menu options.

Similar Messages

  • Who paints the background of JInternalFrame

    Hello all,
    Im new to Swing / plaf, and I have a probably simple question.
    Im trying to make an internal frame that has rounded corners. Therefore I do not want the background color to fill the entire background. Actually I'd like to paint the background myself.
    I have extended and installed my own BasicInternalFrameUI. In installUI(JComponent c) I call c.setOpaque(false). And would now expect to be able to control the painting of the background by overriding BasicInternalFrameUI.paint :
    public void paint(Graphics g, JComponent c) {
    g.setColor(Color.black);
    g.fillRoundRect(0,0, c.getWidth(),c.getHeight(),10,10);
    (Disregard the fact that I paint on top of the title too - this example is only to keep it simple)
    But the JInternalFrame shows it's background color, and not my rect.
    It seems like the only way I can change the painting of the JInternalFrame is by overriding JInternalFrame.paint :
    public void paint(Graphics g) {
    super.paint(g);
    g.setColor(Color.blue);
    g.fillRoundRect(0,0, getWidth(), getHeight(),10,10);
    But that's not really look&feel...
    Could someone please enlighten me? How do I paint the background of an JInternalFrame the proper way?

    Hello all,
    Im new to Swing / plaf, and I have a probably simple question.
    Im trying to make an internal frame that has rounded corners. Therefore I do not want the background color to fill the entire background. Actually I'd like to paint the background myself.
    I have extended and installed my own BasicInternalFrameUI. In installUI(JComponent c) I call c.setOpaque(false). And would now expect to be able to control the painting of the background by overriding BasicInternalFrameUI.paint :
    public void paint(Graphics g, JComponent c) {
    g.setColor(Color.black);
    g.fillRoundRect(0,0, c.getWidth(),c.getHeight(),10,10);
    (Disregard the fact that I paint on top of the title too - this example is only to keep it simple)
    But the JInternalFrame shows it's background color, and not my rect.
    It seems like the only way I can change the painting of the JInternalFrame is by overriding JInternalFrame.paint :
    public void paint(Graphics g) {
    super.paint(g);
    g.setColor(Color.blue);
    g.fillRoundRect(0,0, getWidth(), getHeight(),10,10);
    But that's not really look&feel...
    Could someone please enlighten me? How do I paint the background of an JInternalFrame the proper way?

  • Can I not paint the background of an image?

    I can draw an image just fine (I use JFrame), but I am having a big problem
    I draw the image, but the image's background color gets drawn over the GUI's. for instance if I have an airplane sprite (.gif or .png), the airplane could be black but the background color of the sprite itself is white. when I g.drawImage(airplane, 200,200,this);, it displays the black airplane along with the rest of the white surrounding that is part of the sprite. I have been able to make up for this so far by doing things like painting the entire GUI white so that you cant tell, but its getting out of hand and unworkable on this new project of mine
    how do I get java to ignore the background color of the sprite itself, and just draw the pixels that are NOT the background color?
    if the image is a black airplane on a white background, I want to be able to just paint the black of the airplane, so it doesn't look like a retarded white square over a blue background (the GUI's background is blue)
    any help is extremely appreciated :-/

    Modify your sprite so it has transparent pixels rather than a background?

  • How do I keep the paint and clone tools from removing the background on the composition?

    I am trying to remove handling  wires from a Muppet video.  I double click on the composition (mov file) and  open the layer panel.  I can get the brush, clone and eraser to work  just fine and everything looks great until I play the preview.  I can  see all my strokes on the original movie composition. For example, the white showing in the frame below.
    Since I  am very new to AE, I would imagine that I am missing a setting, but it  seems like I have tried all of them and nothing is working.
    I am  using CS5, version 10.  Using the normal mode and the RGBA channel on  single frame. I appreciate any help you can provide.  Thanks!

    Hi Rick,
    I am trying to remove handler wires that can be seen on Elmo.  This is an
    assignment for an online class.  Unfortunately, I asked this question early
    last week of the instructor and he has not responded.  We are required to use
    the clone, paint or eraser for the exercise.  Thanks for the tip regarding the
    CC Simple Wire Removal tool.  That will come in handy in the future.  The
    original clip of the Muppets does have a black transparent background. I
    changed the composition settings so that I could better see the wires.  Some
    of the wires are just over the background and some are over a part of his
    clothes.  I can see my strokes when I toggle the transparency grid.  I will
    try the clone tool on the alpha channel and see if that works.  If that is not
    what I should be doing, please let me know.  Thanks for your help.
    I'm not really clear on what you are trying to do. If you're painting on RGBA
    and you paint with a white brush you will end up with a white stroke on the
    layer. All channels will be white.
     
    If you're painting with a white stroke using Alpha then you will paint white
    on the alpha channel so there will be nothing changed on the layer.
     
    If you are painting with a black stroke using Alpha then you will paint a hole
    in the layer which will allow the layer below to show through, but if you're
    painting on RGB or RGBA then you'll end up with a black stroke on the image.
     
    If you want to paint out the wires then you must either use the clone tool or
    make the brush the same color as your background. It looks like you have a
    cream colored background so your paint tool must be the same color. If you
    have wires over any other color, say over the body of one of the Muppets, then
    you must carefully use the clone tool. Your screenshot looks like you're just
    painting with a white brush. I'm assuming that your Comp BC color is white
    (not usually a good idea) and that there is really no hole in your footage.
    You can check that out by clicking on the Toggle Transparency Grid or by
    dropping another layer below your footage.
     
    Another option to remove the wires would be to use the CC Simple Wire Removal
    tool. It works amazingly well on some shots.
    >

  • Paint an image in the background of the JDesktopPane?

    I need to show an image in the background of an multidocument Java application (Swing based). It's not possible overwritting the method "paint" of the class "JDesktopPane" (appear some problems). Can anybody help me, please? Thanks a lot.

    You have to override the painComponent method not paint.
    JDesktopPane desktop = new JDesktopPane(){
        Image im = (new ImageIcon("background.jpg")).getImage();
        public void paintComponent(Graphics g){
            g.drawImage(im,0,0,this);
    };I hope this helps,
    Denis

  • The application does not use the  screen and run in the background

    Hi
    I have downloaded a package of j2me Midlet
    from [link] here [link]
    and try to reuse the code
    but I get the following error when running the code:-
    The application does not use the screen and run in the background
    I think the error into one of these two classes
    package main;
    import javax.microedition.midlet.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    import java.io.IOException;
    import java.io.InputStream;
    public class MainMidlet extends MIDlet implements CommandListener {
        private SSGameCanvas gameCanvas ;
        private Command exitCommand ;
        private Player player = null;
        public void startApp() {
      try {
           //   create new game thread
              gameCanvas = new SSGameCanvas();
              gameCanvas.start(); // start game thread
              exitCommand = new Command("Exit",Command.EXIT,1);
              gameCanvas.addCommand(exitCommand);
              gameCanvas.setCommandListener(this);
                Display.getDisplay(this).setCurrent(gameCanvas);
       catch (java.io.IOException e)
                e.printStackTrace();
            try {
                // start sounds
                InputStream in = getClass().getResourceAsStream("/resource/startfly.wav");
                player = Manager.createPlayer(in,"audio/x-wav");
                player.setLoopCount(1);
                player.start();
            catch (MediaException ex)
                ex.printStackTrace();
             catch (IOException ex)
                ex.printStackTrace();
        public void pauseApp() {
        public void destroyApp(boolean unconditional) {
            if (player != null) {
                player.close();
            System.gc();
      public void commandAction(Command command, Displayable displayable) {
           if (command == exitCommand)
                 destroyApp(true);
                 notifyDestroyed();
    package main;
    import java.io.IOException;
    import javax.microedition.lcdui.*;
    import javax.microedition.lcdui.game.*;
    public class SSGameCanvas extends GameCanvas implements Runnable {
        protected GameManager gameManager;
        protected boolean running;
        private int tick=0;
        private static int WIDTH;
        private static int HEIGHT;
        private int mDelay = 20;
        Form mainForm;
        Display display;
        //private int MaxTime;
        public SSGameCanvas() throws IOException{
            super(true);
            gameManager = new GameManager(5,5,getHeight()-10,getWidth()-10,this);
        public void start() {
                this.running = true;
                Thread t = new Thread(this);
                t.start();
        public void stop() {
            running = false;
        public void render(Graphics g) {
            WIDTH = getWidth();
            HEIGHT = getHeight();
            // Clear the Canvas.
            g.setColor(0, 0, 50);
            g.fillRect(0,0,WIDTH-1,HEIGHT-1);
            // draw border
            g.setColor(200,0,0);
            g.drawRect(0,0,WIDTH-1,HEIGHT-1);
            // draw game canvas
            gameManager.paint(g);
        public void run() {
            while (running) {
                // draw graphics
                render(getGraphics());
                // advance to next graphics
                advance(tick++);
                // display
                flushGraphics();
                try { Thread.sleep(mDelay); }
                catch (InterruptedException ie) {}
        public void advance(int ticks) {
            // advance to next game canvas
            gameManager.advance(ticks);
            this.paint(getGraphics());
    }Edited by: VANPERSIE on Jul 10, 2012 12:26 PM

    Hi Andi,
    Thanks for your reply.
    Yes, I have waited for a while and the result doesn't change.
    The Porblem here is the application is seen started in visual administrator.Only restart brings up the page back.
    Can you please suggest anything.
    Thanks and regards
    Nagaraj

  • How do I change the background color of a BufferedImage?

    I have a program and basically what I am doing is drawing on a BufferedImage object and then painting that BufferedImage object onto the panel. By default, the background is black and it draws in white. I am easily able to change the colour for drawing by doing g2.setColor(Color.RED) for example where g2 is the Graphics2D object created by image.createGraphics(). I tried g2.setBackground(Color.WHITE) and that did not work.
    If more information is needed, just ask.
    Any help in changing the background colour of the BufferedImage would be greatly appreciated!
    Thanks in advance!

    Here is a mini-code with comments explaining my trouble:
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class TestBuff extends JPanel
        Graphics2D g2;
        BufferedImage image;
        public TestBuff()
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setLocationRelativeTo(null);
            frame.setSize(800,800);
            frame.add(this);
            frame.setVisible(true);
            image = new BufferedImage(800,800,BufferedImage.TYPE_INT_RGB);
            g2 = image.createGraphics();
            g2.setBackground(Color.RED); // I am setting the background colour here
        protected void paintComponent(Graphics g)
            g.drawImage(image, 0, 0, g2.getBackground(), this); // Why is this black instead of red?
        public static void main(String[] args)
            new TestBuff();
    }

  • Can i change the background color of a file from white?

    i want to change file backgrounds from bright white, to a more soothing color.

    Each program is different and do not always have controls to change the background colors.
    For jpg files view this:
    https://www.youtube.com/watch?v=u5-WmuLFHys
    or this for jpeg
    http://www.wikihow.com/Change-an-Image-Background-in-MS-Paint-(Green-Screen)
    or this for pdf
    http://sodapdf.com/blog/sodapdf-tutorials/how-to-edit-a-pdf-file/pages/how-to-add-or-replace-a-backg...
    or of a folder
    http://www.sevenforums.com/customization/336693-how-change-background-color-folders-windows-7-a.html
    Anything else, I can't help you.
    Please mark my post as SOLVED if it has resolved your problem. It helps others with similar situations.

  • I have imported a color picture and trying to use the adjustment brush to turn the background black and white and it isn't working.  I have Lightroom 5.  Any suggestions?

    Hello - I have Lightroom 5.  I have imported a color photo.  I am trying to use the Adjustment Brush to change the background to Black and White and leave a portion of the photo in color.  When I begin painting the photo with the Saturation at -100 I don't see any changes to the photo.  I push the "O" key and still nothing.  I have tried to reset the photo, restarted Lightroom and still nothing.  Please help.

    Set Flow and Density of the brush to 100
    Reduce it where you want the effect to blend.
    Bruce

  • How to change the background of a JPanel when printing?

    I have a JPanel that has a background color of gray when displayed on the screen. I would like to change the background to white when printing but leave it gray on the screen. I am calling setBackground(), clearRect() and fillRect() but it still prints out with the gray background. Any thoughts on what method I could call to change this?
    public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
    if (pageIndex >= 1) {
    return Printable.NO_SUCH_PAGE;
    double pageHeight = pf.getImageableHeight();
    double pageWidth = pf.getImageableWidth();          
    Graphics2D g2 = (Graphics2D) g;
    g2.setBackground(Color.white);
    g2.clearRect((int)pageWidth/2, (int)pageHeight/2, (int)pageWidth, (int)pageHeight);
    g2.fillRect((int)pageWidth/2, (int)pageHeight/2, (int)pageWidth, (int)pageHeight);
    paint(g2);

    From reading the doc, it appears that you have to change the background color of the Component:
    setBackground
    public abstract void setBackground(Color color)
    Sets the background color for the Graphics2D context. The background color is used for clearing a region. When a Graphics2D is constructed for a Component, the background color is inherited from the Component. Setting the background color in the Graphics2D context only affects the subsequent clearRect calls and not the background color of the Component. To change the background of the Component, use appropriate methods of the Component.
    Parameters:
    color - the background color that isused in subsequent calls to clearRect
    See Also:
    getBackground(), Graphics.clearRect(int, int, int, int)
    V.V.

  • How do i set the background of the table( not of cell / row / column).

    How do i set the background of the table( not of cell / row / column).
    What happens when i load the applet the table is blank and displays the background color is gray which we want to be white.
    We tried using the setBackGround but it is not working maybe we are not using it properly. Any help would be gr8.
    Thanks in advance.

    I don't understand very well, but i guess that the background is gray when the table content's empty, isn't it?
    When the table model is empty, the JTable doesn't paint, so its container displays its background (often gray).
    In this case, what you must do is force the table to paint, even if the model is empty. So, you have to create your own table and override three methods :
    public class MyTable extends JTable
    //specify the preferred and minum size when empty
    myPreferredWidth = 200;
    myPreferredHeigth =200;
    myMinimunWidth = ...;
    myMinimunHeigth = ...;
    public Dimension getPreferredSize()
    if(getModel().getRowCount() < 1)
    return new Dimension(myPreferredWidth, myPreferredHeigth);
    else
    return super.getPreferredSize();
    public Dimension getMinimumSize()
    if( getModel().getRowCount() > 0)
    return new Dimension(myMinimunWidth, myMinimunHeigth);
    else
    return super.getMinimumSize();
    protected void paintComponent(Graphics g)
    if (getModel().getRowCount<1 && isOpaque()) { //paint background
    g.setColor(Color.white);
    g.fillRect(0, 0, getWidth(), getHeight());
    else super.paintComponent(g);
    }

  • Making the background white

    Can someone help me make the background of my application white ?
    All it does is display a simple curve in a window.
    Here's the structure:
    public class Curve
    public static void main(String[] args)
    JFrame window = new JFrame();
    CurvePane pane = new CurvePane();
    pane.setBackground(Color.white);
    window.add(pane);
    window.setVisible(true);
    class CurvePane extends JComponent
    public void paint(Graphics g)
    //Draw curve here
    It's a really simple program. But I just can't seem to get the background white. Any help at all would be greatly appreciated.
    --Patrick                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The setOpaque(true) statement worked except it created a few wierd errors.
    I forgot to tell you that I programmed my curve to be able to be moved by the user. Using mouse listeners and so on. But now, after setting opaque to be true, it won't refresh the screen after the user moves it. The old line stays and is not erased.

  • Report Painter in Background??

    How do you pass parameters or a variant to this FM (crif_rw_web_call_report)?
    I want to run a nightly job that executes a custom report painter report (with a selected variant or parameters) and dumps that data to a file.
    Edited by: Daniel Simpson on Nov 24, 2008 7:39 PM

    I realized that I can run report painter in background & export to file on the app server by going to the report selection screen and selecting the "output parameters" button & configuring the report from there. 
    I would however, still like to learn how to execute the FM ( CRIF_RW_WEB_CALL_REPORT ) to bring the report painter data into internal tables.

  • Why does the Background Layer unlock itself?

    When I open a picture in PS the first layer is a locked background layer. If I start working in PS it changes automatically to an unlocked Layer 0. I want it to stay as an locked background layer. I have used PS for a few years, and just started happening.

    With the new version of Photoshop if you work on the background layer and do something like click on the add layer mask icon in the layer palette. Since the background layer does not support transparency Photoshop knows you need to convert the background layer to a normal layer so Photoshop automatically does that for you.  If you just paint on the background layer or clear or fill an area, stroke a selection it will remain a background layer  with its transparency locked.  The Background layer is only partially locked so you can work on it as shown by the un-filled in lock icon on the background layer in the layer palette.  If you look here you see layer 2 is unlocked, Layer 1 is fully locked and the background layer is partly locked and has been worked on.

  • The colour picker is selecting the background colour instead of the foreground colour.

    You know how when you're painting, you can hold ALT and it will pick a colour from the canvas? Well, for some reason, mine still picks up the colour but it sets it to the background colour instead of the foreground colour. And when I actually select the colour picker tool, it will only select the background colour but when I hold Alt, it selects the foreground colour. Basically it's flipped where it's supposed to select. Do you know how to flip it back? It's driving me mad. Thanks.

    In the Color Palette (Window>Color) click on the foreground swatch. A "focus ring" will appear around it.

Maybe you are looking for

  • How send a Print Form as attachment PDF?

    Hi everybody, I have created an Interactive Forms where I can input any new data. When I click on the button for save the new data, I must also convert my Interactive Form in PDF for send it as attachment to email. When I have groped to convert the i

  • FIFO price -- OINM.Calcprice is not always correct

    Hi All, I know the topic of getting FIFO cost layer has been posted here many times. And until today I've been using a query to get OINM.CalcPrice as the fifo cost for a certain item and warehouse. It is somewhat like: SELECT calcprice FROM OINM WHER

  • No picture in MotoGP live video

    I'm having an issue when watching MotoGP live on motogp.com. On both my Mac Mini and Macbook Pro with 9400m graphics i have audio but no picture when using 10.1.82.76. There is no issue with 10.1.53.64 I haven't tested other sites, except youtube whe

  • Building blocks or config guides for configuring self service procurement -

    hello all, can some one send me/point me in a direction where i can get some documents to configure self-service procurement and service procurement scenario for a classic scenario? we are using SRM 5.5 and 1 OLTP system: ECC 6.0 will award points im

  • Plan order table

    Hi PP Gurus, I am developing MRP report for a client in which we are calculating the delay in plan opening period means difference between   plan opening date of plan order and actual production order creation date . For this we are getting productio