nl.cloudfarming.client.util.swing.ASPanel Maven / Gradle / Ivy
/**
* Copyright (C) 2010-2012 Agrosense [email protected]
*
* Licensed under the Eclipse Public License - v 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.cloudfarming.client.util.swing;
import java.awt.*;
import org.openide.util.ImageUtilities;
/**
*
* @author monezz
*/
public class ASPanel extends javax.swing.JPanel {
private Image background = ImageUtilities.loadImage("nl/cloudfarming/client/util/swing/background-base-600x400.png");
// private Image background = new ImageIcon("nl/cloudfarming/client/util/swing/background-base.png").getImage();
/**
* Creates new form ASPanel
*/
public ASPanel() {
initComponents();
setBackground(Color.white);
Dimension size = new Dimension(background.getWidth(null), background.getHeight(null));
setPreferredSize(size);
setMinimumSize(size);
setMaximumSize(size);
setSize(size);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
private void initComponents() {
setLayout(null);
}// //GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(getBackground());
g2d.fillRect(0, 0, getWidth(), getHeight());
g.drawImage(background, 0, 0, getWidth(), background.getHeight(this),null);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy