1 19 20 package org.netbeans.modules.welcome.ui; 21 22 import java.awt.Graphics ; 23 import java.awt.Graphics2D ; 24 import javax.swing.ImageIcon ; 25 import javax.swing.JComponent ; 26 import org.netbeans.modules.welcome.content.BackgroundPainter; 27 import org.netbeans.modules.welcome.content.Constants; 28 import org.netbeans.modules.welcome.content.Utils; 29 import org.openide.util.Utilities; 30 31 35 public class DefaultBackgroundPainter implements BackgroundPainter, Constants { 36 37 private ImageIcon top = new ImageIcon (Utilities.loadImage(BACKGROUND_TOP_IMAGE, true)); 39 private ImageIcon bottom = new ImageIcon (Utilities.loadImage(BACKGROUND_BOTTOM_IMAGE, true)); 40 41 42 public DefaultBackgroundPainter() { 43 } 44 45 public void paintComponent( JComponent c, Graphics g ) { 46 Graphics2D g2 = Utils.prepareGraphics( g ); 47 48 g2.setColor( Utils.getColor(SCREEN_BACKGROUND_COLOR) ); 49 g2.fillRect(0, 0, c.getWidth(), c.getHeight()); 50 51 g2.drawImage( top.getImage(), 0, 0, c.getWidth(), top.getIconHeight(), null ); 56 g2.drawImage( bottom.getImage(), 0, c.getHeight()-bottom.getIconHeight(), 57 c.getWidth(), bottom.getIconHeight(), null ); 58 } 59 } 60 | Popular Tags |