2b68ef7be4ef778b8cdbc663fd03ee07ac1db941
[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 java.awt.BorderLayout;
13
14 import javax.swing.SwingUtilities;
15 import javax.swing.WindowConstants;
16
17 public class ImageFrame extends javax.swing.JFrame {
18         private ImagePanel imagePanel1;
19
20         public ImageFrame(final String title) {
21                 super();
22                 setTitle(title);
23                 initGUI();
24         }
25
26         public ImagePanel getImagePanel() {
27                 return imagePanel1;
28         }
29
30         private void initGUI() {
31                 try {
32                         final BorderLayout thisLayout = new BorderLayout();
33                         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
34                         getContentPane().setLayout(thisLayout);
35                         {
36                                 imagePanel1 = new ImagePanel();
37                                 getContentPane().add(getImagePanel(), BorderLayout.CENTER);
38                         }
39                         pack();
40                 } catch (final Exception e) {
41                         e.printStackTrace();
42                 }
43         }
44
45         /**
46          * Auto-generated main method to display this JFrame
47          */
48         public static void main(final String[] args) {
49                 SwingUtilities.invokeLater(new Runnable() {
50                         @Override
51                         public void run() {
52                                 final ImageFrame inst = new ImageFrame("test");
53                                 inst.setLocationRelativeTo(null);
54                                 inst.setVisible(true);
55                         }
56                 });
57         }
58
59 }