Results 1 to 2 of 2
  1. #1
    samson is offline Member
    Join Date
    Mar 2007
    Posts
    16
    Rep Power
    0

    Default Why this image background is black ?

    Java Code:
    public void drawShape(int w, int h){
        Graphics2D graphics2D ; 
        
       
        BufferedImage bufferedImage = new BufferedImage( 45, 56, BufferedImage.TYPE_INT_ARGB ); 
        File imgFile = new File("C:\\test.jpg");
       
        graphics2D = bufferedImage .createGraphics();
        graphics2D .setBackground(Color.WHITE);
        graphics2D .setColor( Color.WHITE );
       
        try {
        ImageIO.write( bufferedImage , "jpg", imgFile );
        } catch ( IOException e ) {
                e.printStackTrace();
        } 
    }

  2. #2
    samson is offline Member
    Join Date
    Mar 2007
    Posts
    16
    Rep Power
    0

    Default

    Java Code:
    graphics2D .setColor( Color.WHITE );
    graphics2D .fillRect(0,0,45,56);

Similar Threads

  1. Center background image
    By Floetic in forum AWT / Swing
    Replies: 1
    Last Post: 04-24-2008, 06:50 PM
  2. Replies: 2
    Last Post: 03-24-2008, 06:29 AM
  3. Replies: 0
    Last Post: 01-08-2008, 06:29 PM
  4. Background image in java
    By toby in forum AWT / Swing
    Replies: 1
    Last Post: 07-29-2007, 08:15 AM
  5. Implementing a red-black tree in java
    By baltazar in forum New To Java
    Replies: 1
    Last Post: 07-13-2007, 09:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •