Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.smbarbour.mcu;
- import java.awt.BorderLayout;
- import java.awt.EventQueue;
- import java.awt.Graphics;
- import java.awt.image.BufferedImage;
- import java.io.File;
- import java.io.IOException;
- import java.net.URL;
- import javax.imageio.ImageIO;
- import javax.swing.Icon;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import org.smbarbour.mcu.util.MCUpdater;
- public class SplashForm extends JFrame {
- private MCUApp _mcu;
- /**
- * Create the frame.
- */
- public SplashForm(MCUApp mcu) {
- _mcu = mcu;
- this.setUndecorated(true);
- this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- JPanel pane = (JPanel)(this.getContentPane());
- pane.setLayout(new BorderLayout());
- this.setSize(320, 240);
- this.setLocationRelativeTo(null);
- pane.add(new JLabel("Loading..."), BorderLayout.SOUTH);
- getContentPane().add(new ImagePanel(SplashForm.class.getResource("/mcu-splash.png")), BorderLayout.CENTER);
- pane.invalidate();
- this.setVisible(true);
- }
- class ImagePanel extends JPanel{
- private BufferedImage image;
- public ImagePanel(URL resource) {
- try {
- image = ImageIO.read(resource);
- } catch (IOException ex) {
- }
- }
- @Override
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- g.drawImage(image, 0, 0, null);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement