|
/******************************************************************************
Copyright (C) 2005 MakeLogic
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Date : 14th December 2005
Authors : MakeLogic
Design : Ujjwal
Developer : Dharma
********************************************************************************/
package com.makeLogic;
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;
import javax.swing.*;
public class MakeLogicDesktopPane extends JDesktopPane
{
Image backgroundImage;
Image blankBackgroundImage;
Image waterMarkImage;
ImageIcon img;
ImageIcon imgBlank;
//ImageIcon waterMark;
int blankImgWidth;
int blankImgHeight;
int imageWidth;
int imageHeight;
//int wmWidth;
//int wmHeight;
public MakeLogicDesktopPane()
{
ClassLoader cl = this.getClass().getClassLoader();
img = new ImageIcon(cl.getResource("background.gif"));
imgBlank = new ImageIcon(cl.getResource("blankbg.gif"));
//waterMark = new ImageIcon(cl.getResource("TailIconwm.gif"));
backgroundImage = img.getImage();
blankBackgroundImage = imgBlank.getImage();
//waterMarkImage = waterMark.getImage();
blankImgWidth = imgBlank.getIconWidth();
blankImgHeight = imgBlank.getIconHeight();
//wmWidth = waterMark.getIconWidth();
//wmHeight = waterMark.getIconHeight();
imageWidth = img.getIconWidth();
imageHeight = img.getIconHeight();
}
//..paint method
public void paint(Graphics g1)
{
Graphics2D g = (Graphics2D)g1;
//..Standard Paint Step 1
paintComponent(g);
//..Paint Theme
//..MakeLogicThemes.paintBlueSquareTheme(g,this,"DEMO",true);
//..set color values : R,G,B,A. A=0 means fully transparten and A=255 means fully opaque
Color tempColor = g.getColor();
//..Fill background with color
g.setColor(new Color(0x00,0x4E,0x98,0));
g.fillRect(0,0,this.getWidth(),this.getHeight());
for(int x=0; x < this.getWidth(); x+=blankImgWidth)
{
for(int y=0; y < this.getHeight(); y+=blankImgHeight)
{
g.drawImage(blankBackgroundImage, x,y,this);
}
}
//g.drawImage(waterMarkImage, (int)(this.getWidth()/2.0-imageWidth/2.0), (int)(this.getHeight()/2.0-imageHeight/2.0-wmHeight),this);
g.drawImage(backgroundImage, (int)(this.getWidth()/2.0-imageWidth/2.0), (int)(this.getHeight()/2.0-imageHeight/2.0),this);
//..Standard Paint Step 2
//..Important call
//..This method draws the borders for the toolbar
paintBorder(g);
//..Standard Paint Step 3
//..A very important call
//..The tool bar buttons will be drawn using this method
//..if this is not called an emtpy tool bar will be drawn
paintChildren(g);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Founder of MakeLogic - A Mobile Solutions and XML Web Services Company. B-Tech engineer from India's reputed IITs.
Designed and Authored products like MicroGraphs, MakeLogic VersionManager and MakeLogic Device Broker. Pls see http://www.makelogic.com
MakeLogic is a strategic business partner of Microsoft, Sun, IBM, HP and Citrix.
Contact : madanuuk@makelogic.com OR +91 - 40 - 55322433