/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package getfacts.full;
import getfacts.ColorSet;
import getfacts.ConfigurationSafe;
import getfacts.toolkit.ImagePanel;
import getfacts.toolkit.MiscToolkit;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
/**
*
* @author jmc15
*/
public class LogoPanel
extends JPanel
implements ComponentListener
{
private OneTwoThirdsLayoutManager layout;
private ImagePanel imagePanel;
private JLabel getFactsLabel;
private Graphics2D graphics;
private ColorSet colorSet = ConfigurationSafe.getColorSet();
public LogoPanel()
{
this.setBackground(colorSet.get(ColorSet.SIDE_BACKGROUND_COLOR_KEY));
this.setForeground(colorSet.get(ColorSet.SIDE_FOREGROUND_COLOR_KEY));
initComponent();
}
private void initComponent()
{
layout = new OneTwoThirdsLayoutManager(OneTwoThirdsLayoutManager.RIGHT);
this.setLayout(layout);
imagePanel = new ImagePanel(new javax.swing.ImageIcon(getClass().getResource("/getfacts/full/Logo.png")));
imagePanel.setOpaque(false);
this.add(imagePanel, OneTwoThirdsLayoutManager.ONE_THIRD);
getFactsLabel = new JLabel("GetFacts");
getFactsLabel.setForeground(this.getForeground());
getFactsLabel.setHorizontalAlignment(SwingConstants.RIGHT);
getFactsLabel.addComponentListener(this);
this.add(getFactsLabel, OneTwoThirdsLayoutManager.TWO_THIRDS);
}
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
graphics=(Graphics2D)g;
/*if( isOpaque() )
{
//GradientPaint backgroundGradient = new GradientPaint(0,0,Color.WHITE, 0, getHeight(), Color.GRAY);
graphics.setPaint(backgroundGradient);
graphics.fillRect(0, 0, getWidth(), getHeight());
}*/
}
public void componentResized(ComponentEvent ce)
{
if( ce.getComponent()==getFactsLabel)
{
MiscToolkit.ResizeLabel(graphics, getFactsLabel, FullScreenFrame.MIN_FONT_SIZE, FullScreenFrame.MAX_FONT_SIZE);
repaint();
}
}
public void componentMoved(ComponentEvent ce) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public void componentShown(ComponentEvent ce) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public void componentHidden(ComponentEvent ce) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}