Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TinyTowerOrganizerInterface extends javax.swing.JFrame {
- /** Creates new form TinyTowerOrganizerInterface */
- Image backgroundImage = Toolkit.getDefaultToolkit().getImage("D:/Java/TinyTowerOrganizer/Images/Background.jpg");
- public TinyTowerOrganizerInterface() throws IOException {
- initComponents();
- class BackgroundPanel extends javax.swing.JPanel{
- private Image image;
- public BackgroundPanel(Image image){
- this.image = image;
- }
- @Override
- public void paintComponent(Graphics g){
- super.paintComponent(g);
- g.drawImage(image, 0, 0, null);
- }
- }
- }
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- setTitle("Tiny Tower Organizer");
- setFont(new java.awt.Font("Pixelated", 0, 18)); // NOI18N
- setMinimumSize(new java.awt.Dimension(900, 500));
- setName("frame"); // NOI18N
- setResizable(false);
- setUndecorated(true);
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 900, Short.MAX_VALUE)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 500, Short.MAX_VALUE)
- );
- pack();
- }
- public static void main(String args[]) {
- java.awt.EventQueue.invokeLater(new Runnable() {
- @Override
- public void run() {
- try {
- new TinyTowerOrganizerInterface().setVisible(true);
- } catch (IOException ex) {
- Logger.getLogger(TinyTowerOrganizerInterface.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- });
- }
- import java.awt.*;
- import javax.swing.*;
- import java.io.*;
- import javax.imageio.*;
- public class MyApplication extends javax.swing.JFrame
- {
- /** Creates new form MyApplication */
- Image backgroundImage = Toolkit.getDefaultToolkit().getImage("mong.jpg");
- public MyApplication() throws IOException
- {
- this.setContentPane(new JPanel()
- {
- @Override
- public void paintComponent(Graphics g)
- {
- super.paintComponent(g);
- g.drawImage(backgroundImage, 0, 0, null);
- }
- });
- pack();
- setVisible(true);
- }
- public static void main(String[] args)
- throws Exception
- {
- new MyApplication();
- }
- }
Add Comment
Please, Sign In to add comment