Package com.talixa.steganos.frames

Source Code of com.talixa.steganos.frames.FrameAbout

package com.talixa.steganos.frames;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

import com.talixa.steganos.listeners.ExitActionListener;
import com.talixa.steganos.shared.SteganosConstants;

public class FrameAbout {
 
  private static final int WIDTH = 250;
  private static final int HEIGHT = 200;
 
  private static final String ABOUT_CONTENTS =
      "<html><center>A simple program to create and view messages within image files." +
      "<br><br>Version: " + SteganosConstants.VERSION +
      "<br>Copyright 2014, Talixa Software</center></html>";
 
  public static void createAndShowGUI() {
    // Create frame
    JFrame frame = new JFrame(SteganosConstants.TITLE_ABOUT);
    frame.setLayout(new BorderLayout());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 
    // create components
    JLabel text = new JLabel(ABOUT_CONTENTS)
    JButton ok = new JButton(SteganosConstants.LABEL_OK);
    ok.addActionListener(new ExitActionListener(frame));
       
    // Add to frame
    frame.add(text, BorderLayout.CENTER);
    frame.add(ok, BorderLayout.SOUTH);
       
    // Set location and display
    Dimension screenSize = new Dimension(Toolkit.getDefaultToolkit().getScreenSize());
    frame.setPreferredSize(new Dimension(WIDTH,HEIGHT));
    int left = (screenSize.width/2) - (WIDTH/2);
    int top  = (screenSize.height/2) - (HEIGHT/2);
    frame.pack();
    frame.setLocation(left,top);
    frame.setVisible(true);           
 
}
TOP

Related Classes of com.talixa.steganos.frames.FrameAbout

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.