1 34 package net.myvietnam.mvncore; 35 36 import java.awt.*; 37 import java.awt.image.BufferedImage ; 38 39 public class MVNCoreInfo { 40 41 private MVNCoreInfo() { 42 } 43 44 private static String PRODUCT_NAME = "MyVietnam WebApp Framework - Core Lib"; 45 46 private static String PRODUCT_DESC = "MyVietnam Web Application Framework - Core Library"; 47 48 private static String PRODUCT_VERSION = "2.0.1"; 49 50 private static String PRODUCT_RELEASE_DATE = "15 July 2006"; 51 52 private static String PRODUCT_HOMEPAGE = "http://www.MyVietnam.net"; 53 54 55 public static String getProductName() { 56 return PRODUCT_NAME; 57 } 58 59 public static String getProductDesc() { 60 return PRODUCT_DESC; 61 } 62 63 public static String getProductHomepage() { 64 return PRODUCT_HOMEPAGE; 65 } 66 67 public static String getProductReleaseDate() { 68 return PRODUCT_RELEASE_DATE; 69 } 70 71 public static String getProductVersion() { 72 return PRODUCT_VERSION; 73 } 74 75 public static BufferedImage getImage() { 76 77 String str = PRODUCT_VERSION + " on " + PRODUCT_RELEASE_DATE; 78 int IMAGE_WIDTH = 250; 79 int IMAGE_HEIGHT = 30; 80 81 BufferedImage bufferedImage = new BufferedImage (IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB); 82 Graphics2D g = bufferedImage.createGraphics(); 83 g.setBackground(Color.blue); 84 g.setColor(Color.white); 85 g.draw3DRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, false); 86 FontMetrics fontMetrics = g.getFontMetrics(); 87 int strWidth = fontMetrics.stringWidth(str); 88 int strHeight = fontMetrics.getAscent() + fontMetrics.getDescent(); 89 g.drawString(str, (IMAGE_WIDTH - strWidth) / 2, IMAGE_HEIGHT - ((IMAGE_HEIGHT - strHeight) / 2) - fontMetrics.getDescent()); 90 g.dispose(); return bufferedImage; 92 } 93 94 } 95 | Popular Tags |