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?

Similar Messages

  • 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.

  • 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?

  • There is something wrong with the volumes buttons in my macbook pro, every time i pressed the one who raises the volume, it leads me to the screen where (i do not no what its called) the background is black with the date and time and a calculator.

    There is something wrong with the volumes buttons in my macbook pro, every time i pressed the one who raises the volume, it leads me to the screen where (i do not no what its called) the background is black with the date and time and a calculator. However, when i lower it, my safari tab goes out of the screen. What do you guys think i should do? I'm getting very nervous.

    hey HAbrakian!
    You may want to try using the information in this article to adjust the behavior of your function keys to see if that resolves the behavior:
    Mac OS X: How to change the behavior of function keys
    http://support.apple.com/kb/ht3399
    Take care, and thanks for visiting the Apple Support Communities.
    -Braden

  • How can I do that the background appears through the person who is on the pic

    how can I do that the background appears through the person who is on the pic

    Hi
    just decrease the opacity of the layer on which you have the person

  • Is apple going to come out with a iso that lets ppl who have the iphone 3g to put up backgrounds its bs that i cant do it when ever i see something about the iphones even befor the 4g that all ways had backgrounds so what the **** is with that

    is apple going to come out with a iso that lets ppl who have the iphone 3g to put up backgrounds its bs that i cant do it when ever i see something about the iphones even befor the 4g that all ways had backgrounds so what the **** is with that

    iPhone 3G has received its last iOS update. If wallpapers behind the homescreen icons is such an important feature for you, you'll need a newer model iPhone.

  • 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 problem of the Canvas and JInternalFrame

    I have some problem with the Canvas and JInternalFrame, my application contains serval internalframes and each has one canvas, but i found that canvas is at the top z-order of the window. so it result in that the canvas is at the same z-level, which confuse very much.
    who can help me with this problem, thanks.

    I think the problem stems from mixing AWT and Swing components (non-lightweight and lightweight)
    if the reason you are using a canvas is for the paint method; do away with them and just use a JPanel (which you can use the paint method within)
    hope this helps?!
    Simon

  • 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

  • HT1365 Hi can anyone help with this issue regarding my wireless magic mouse? When im on google chrome and scrolling down the page i always have youtube running in the background but the audio cuts/spits/pops can anyone help me with this?

    Hi can anyone help with this issue regarding my wireless magic mouse? When im on google chrome and scrolling down the page i always have youtube running in the background but the audio cuts/spits/pops can anyone help me with this?

    The figures you mention only make sense on your intranet.  Are you still using the same wireless router.  The verizon one is somewhat limited as far as max wireless-n performace.  For one thing it only has a 2.4 radio.   I like many people who wanted wireless-n performance before they even added a wireless-n gigabit router, have my own handling my wireless-n network.

  • I want to plot a waveform chart where I have a constant slope(defined by me) and new data is plotted over the chart with the defined slope already in the background.

    I want my chart to have a constant slope already plotted before it continues to start plotting the real time data.. so that I can compare my new data point to point with the ideal slope that i already have in the background
    Solved!
    Go to Solution.

    raza51 wrote:
    Hi,
    Thanks for help.. But this would work when i have one array and a constant "slope". What if I want to print 2 arrays of data.. means if there is an array of data instead of constant "slope"...
    Since your graph is refreshed every time you go through the loop anyway, just set up the constant/reference array before the loop and feed it into the graph. That way you'll also have a full X-axis (and a Y-axis which at least includes all the reference data) for the graph already set up.
    (That's twice in two days I've been scooped by a couple of minutes, I've got to get my typing speed up...)
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • 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.

  • Can a java program be run in the background?

    Hi all,
    Can a java program be run in the background without the user being aware of it? I need to make a program that continuosly monitors a pc at regular intervals and runs at all time. It should be hidden(shouldn't display on the screen while running) from the user, and also, can it be run as a system file so that even if a user checks he/she would think of it as a system file?

    I'm the administrator of all the computers. Then as I said there are commercial applications that do that.
    Presumably you expect a problem now. And implementing an acceptable solution is going to take you months. Because not only need to 'hide' the application, you also need to set up all the monitoring and logging capability. And the first will require quite a bit of JNI work along with testing (in particular as it could interfer with existing applications on the users computers.)
    I need to
    install the software in all the machines and i want
    that the users who use the machine should not be able
    to close the program through the task manager. If the users have admin rights then they can terminate a windows service.
    And if they don't have admin rights then you can simply turn off the ability to install anything.
    I want
    to know what the resources of the computers are and
    that if anyone has added a resource to it or
    not(attaching a flash usb thumbdrive etc). Lots of JNI.

Maybe you are looking for

  • Can't print in Windows XP with Java 1.4.1

    I can't print in Java 1.4.1. When I call printDialog() nothing happens. I'm using Windows XP and network printers. It works in 1.3.x. The wierd thing is, if I remove all printers in the Control Panel and then try printing from Java, I get asked if I

  • PS7 compatible with CS3? Can't open file in PS7

    Have a problem I'm hoping to get some help with. Have a client running PS7 with no option to upgrade. I've saved my PSD in CS3 with the preference to maximize compatibility set to "Always", removed all layer styles, layer sets, effects...everything.

  • Min/Max  Internal Orders 1 Requisition

    We are running Min/Max planning to replenish stock in an "Emergency Warehouse" organization. The requisition import kicks off internal orders to a replenishment organization. The planner in the replenishment organization would like one order for each

  • Filtering by current date

    HI I am attempting to filter data based on a "date" column compared to the current date, depending on certain criteria set by the client (example they select "please show all data within last day", or perhaps "Show all data previous 7 days").The curr

  • Browsing too slow on wifi on my iphone5

    I've had my iphone 5 for a week now, signal strength from my home wifi is excellent but when i surf the web (safari and the other apps) its just too slow,mediocre to say the least! most of the time webpages dont ever open! funny thing is my old iphon