/*
* Copyright (C) 2011-2014 GeoForge Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.geoforge.guillc.panel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import org.geoforge.guillc.scrollpane.GfrScr;
/**
*
* @author bill
*/
public class GfrPnlContentsOptionIconPdf extends PnlAbs
{
final static private int _INT_WIDTH_ = 500;
final static private int _INT_HEIGHT_ = 200;
// ---
private GfrScr _scr_ = null;
private JLabel _lbl_ = null;
public GfrPnlContentsOptionIconPdf(ImageIcon iin)
{
super();
super.setLayout(new BorderLayout());
this._lbl_ = new JLabel();
if (iin != null)
this._lbl_.setIcon(iin);
this._scr_ = new GfrScr();
this._scr_.setViewportView(this._lbl_);
}
public void set(ImageIcon iin)
{
this._lbl_ = new JLabel();
if (iin != null)
this._lbl_.setIcon(iin);
this._scr_.setViewportView(this._lbl_);
this._scr_.invalidate();
this._scr_.repaint();
}
@Override
public void destroy()
{
if (this._scr_ != null)
{
this._scr_.destroy();
this._scr_ = null;
}
super.destroy();
}
@Override
public boolean init()
{
if(!super.init())
return false;
if (! this._scr_.init())
return false;
Dimension dim = new Dimension(_INT_WIDTH_, _INT_HEIGHT_);
_scr_.setPreferredSize(dim);
_scr_.setMaximumSize(dim);
_scr_.setMinimumSize(dim);
// -------
//Container cntContentPane = getContentPane();
//cntContentPane.setLayout(new BorderLayout());
super.add(this._scr_, BorderLayout.CENTER);
return true;
}
@Override
public void loadTransient() throws Exception
{
}
@Override
public void releaseTransient() throws Exception
{
}
}