KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > myvietnam > mvncore > MVNCoreInfo


1 /*
2  * $Header: /cvsroot/mvnforum/myvietnam/src/net/myvietnam/mvncore/MVNCoreInfo.java,v 1.72.2.1 2006/07/15 10:04:37 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.72.2.1 $
5  * $Date: 2006/07/15 10:04:37 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding MyVietnam and MyVietnam CoreLib
12  * MUST remain intact in the scripts and source code.
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2.1 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this library; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27  *
28  * Correspondence and Marketing Questions can be sent to:
29  * info at MyVietnam net
30  *
31  * @author: Minh Nguyen
32  * @author: Mai Nguyen
33  */

34 package net.myvietnam.mvncore;
35
36 import java.awt.*;
37 import java.awt.image.BufferedImage JavaDoc;
38
39 public class MVNCoreInfo {
40
41     private MVNCoreInfo() {
42     }
43
44     private static String JavaDoc PRODUCT_NAME = "MyVietnam WebApp Framework - Core Lib";
45
46     private static String JavaDoc PRODUCT_DESC = "MyVietnam Web Application Framework - Core Library";
47
48     private static String JavaDoc PRODUCT_VERSION = "2.0.1";
49
50     private static String JavaDoc PRODUCT_RELEASE_DATE = "15 July 2006";
51
52     private static String JavaDoc PRODUCT_HOMEPAGE = "http://www.MyVietnam.net";
53
54
55     public static String JavaDoc getProductName() {
56         return PRODUCT_NAME;
57     }
58
59     public static String JavaDoc getProductDesc() {
60         return PRODUCT_DESC;
61     }
62
63     public static String JavaDoc getProductHomepage() {
64         return PRODUCT_HOMEPAGE;
65     }
66
67     public static String JavaDoc getProductReleaseDate() {
68         return PRODUCT_RELEASE_DATE;
69     }
70
71     public static String JavaDoc getProductVersion() {
72         return PRODUCT_VERSION;
73     }
74
75     public static BufferedImage JavaDoc getImage() {
76
77         String JavaDoc str = PRODUCT_VERSION + " on " + PRODUCT_RELEASE_DATE;
78         int IMAGE_WIDTH = 250;
79         int IMAGE_HEIGHT = 30;
80
81         BufferedImage JavaDoc bufferedImage = new BufferedImage JavaDoc(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(); // free resource
91
return bufferedImage;
92     }
93
94 }
95
Popular Tags