KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mvnforum > MVNForumInfo


1 /*
2  * $Header: /cvsroot/mvnforum/mvnforum/src/com/mvnforum/MVNForumInfo.java,v 1.49.2.3 2006/07/15 10:00:07 minhnn Exp $
3  * $Author: minhnn $
4  * $Revision: 1.49.2.3 $
5  * $Date: 2006/07/15 10:00:07 $
6  *
7  * ====================================================================
8  *
9  * Copyright (C) 2002-2006 by MyVietnam.net
10  *
11  * All copyright notices regarding mvnForum MUST remain
12  * intact in the scripts and in the outputted HTML.
13  * The "powered by" text/logo with a link back to
14  * http://www.mvnForum.com and http://www.MyVietnam.net in
15  * the footer of the pages MUST remain visible when the pages
16  * are viewed on the internet or intranet.
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31  *
32  * Support can be obtained from support forums at:
33  * http://www.mvnForum.com/mvnforum/index
34  *
35  * Correspondence and Marketing Questions can be sent to:
36  * info at MyVietnam net
37  *
38  * @author: Minh Nguyen
39  * @author: Mai Nguyen
40  */

41 package com.mvnforum;
42
43 import java.awt.*;
44 import java.awt.image.BufferedImage JavaDoc;
45
46 public class MVNForumInfo {
47
48     private MVNForumInfo() {
49     }
50
51     private static String JavaDoc PRODUCT_NAME = "mvnForum";
52
53     private static String JavaDoc PRODUCT_DESC = "mvnForum 1.0.2 GA";
54
55     private static String JavaDoc PRODUCT_VERSION = "1.0.2-GA";
56
57     private static String JavaDoc PRODUCT_RELEASE_DATE = "15 July 2006";
58
59     private static String JavaDoc PRODUCT_HOMEPAGE = "http://www.mvnForum.com";
60
61     public static String JavaDoc getProductName() {
62         return PRODUCT_NAME;
63     }
64
65     public static String JavaDoc getProductDesc() {
66         return PRODUCT_DESC;
67     }
68
69     public static String JavaDoc getProductVersion() {
70         return PRODUCT_VERSION;
71     }
72
73     public static String JavaDoc getProductReleaseDate() {
74         return PRODUCT_RELEASE_DATE;
75     }
76
77     public static String JavaDoc getProductHomepage() {
78         return PRODUCT_HOMEPAGE;
79     }
80
81     public static BufferedImage JavaDoc getImage() {
82
83         String JavaDoc str = PRODUCT_VERSION + " on " + PRODUCT_RELEASE_DATE;
84         int IMAGE_WIDTH = 250;
85         int IMAGE_HEIGHT = 30;
86
87         BufferedImage JavaDoc bufferedImage = new BufferedImage JavaDoc(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
88         Graphics2D g = bufferedImage.createGraphics();
89         g.setBackground(Color.blue);
90         g.setColor(Color.white);
91         g.draw3DRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, false);
92         FontMetrics fontMetrics = g.getFontMetrics();
93         int strWidth = fontMetrics.stringWidth(str);
94         int strHeight = fontMetrics.getAscent() + fontMetrics.getDescent();
95         g.drawString(str, (IMAGE_WIDTH - strWidth) / 2, IMAGE_HEIGHT - ((IMAGE_HEIGHT - strHeight) / 2) - fontMetrics.getDescent());
96         g.dispose(); // free resource
97
return bufferedImage;
98     }
99
100 }
101
Popular Tags