d87b7369240faf6aaf5d0c46028bb7372f23d72b
[imagesqueeze.git] / src / main / java / eu / svjatoslav / imagesqueeze / sampleApplication / ImageFrame.java
1 /*
2  * Imagesqueeze - Image codec optimized for photos.
3  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public License
7  * as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.imagesqueeze.sampleApplication;
11
12 import javax.swing.*;
13 import java.awt.*;
14
15 public class ImageFrame extends javax.swing.JFrame {
16     private ImagePanel imagePanel1;
17
18     public ImageFrame(final String title) {
19         super();
20         setTitle(title);
21         initGUI();
22     }
23
24     /**
25      * Auto-generated main method to display this JFrame
26      */
27     public static void main(final String[] args) {
28         SwingUtilities.invokeLater(() -> {
29             final ImageFrame inst = new ImageFrame("test");
30             inst.setLocationRelativeTo(null);
31             inst.setVisible(true);
32         });
33     }
34
35     public ImagePanel getImagePanel() {
36         return imagePanel1;
37     }
38
39     private void initGUI() {
40         try {
41             final BorderLayout thisLayout = new BorderLayout();
42             setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
43             getContentPane().setLayout(thisLayout);
44             {
45                 imagePanel1 = new ImagePanel();
46                 getContentPane().add(getImagePanel(), BorderLayout.CENTER);
47             }
48             pack();
49         } catch (final Exception e) {
50             e.printStackTrace();
51         }
52     }
53
54 }