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