Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jPanel1 = new javax.swing.JPanel(){
- @Override
- public void paintComponent(Graphics g)
- {
- g.drawImage(src, 0, 0, null);
- }
- };
- // Code of sub-components and layout - not shown here
- add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 400, 300));
- //Aaand Image:
- try {
- src = ImageIO.read(new File("splash.png"));
- } catch (IOException ex) {
- Logger.getLogger(Boot.class.getName()).log(Level.SEVERE, null, ex);
- }
- /////////////////////////////////FULL CODE://////
- package taban;
- import java.awt.Frame;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Toolkit;
- import javax.swing.ImageIcon;
- /**
- *
- * @author erkanmdr
- */
- public class Boot extends java.awt.Frame {
- Image src;
- /**
- * Creates new form Boot
- */
- public Boot() {
- src = Toolkit.getDefaultToolkit().createImage("/home/erkanmdr/splash.png");
- initComponents();
- }
- /**
- * 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.
- */
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- jPanel1 = new javax.swing.JPanel(){
- @Override
- public void paintComponent(Graphics g)
- {
- g.drawImage(src, 0, 0, null);
- }
- };
- setUndecorated(true);
- setPreferredSize(new java.awt.Dimension(400, 300));
- setResizable(false);
- setSize(new java.awt.Dimension(400, 300));
- addWindowListener(new java.awt.event.WindowAdapter() {
- public void windowClosing(java.awt.event.WindowEvent evt) {
- exitForm(evt);
- }
- });
- setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 400, 300));
- pack();
- setLocationRelativeTo(null);
- }// </editor-fold>
- /**
- * Exit the Application
- */
- private void exitForm(java.awt.event.WindowEvent evt) {
- System.exit(0);
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- Frame f = new Boot();
- f.setVisible(true);
- // this.add(kanvas);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.JPanel jPanel1;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement