Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //buat class baru bernama BackgroundDekstop dan sesuaikan script dengan yang di bawah
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package image;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import javax.swing.ImageIcon;
- import javax.swing.JDesktopPane;
- /**
- *
- * @author root
- */
- public class BackgroundDekstop extends JDesktopPane{
- @Override
- protected void paintComponent(Graphics g) {
- Graphics2D graphics = (Graphics2D) g.create();
- Image img = new ImageIcon(getClass().getResource("background.jpg")).getImage();
- graphics.drawImage(img, 0, 0, getWidth(), getHeight(), null);
- graphics.dispose();
- }
- }
- //untuk mengaplikasikan script diatas, klik kanan jdekstop pane -> customize code -> ubah line pertama menjadi Main_Desktop = new BackgroundDekstop(); , jangan lupa setting combo box di kiri menjadi customize code
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement