Package de.kunysch.tvbrowser.localimdb

Source Code of de.kunysch.tvbrowser.localimdb.HelpDialog$Listener

/* $Id: HelpDialog.java 124 2008-03-06 07:19:25Z bananeweizen $
* GNU GPL Version 2, Copyright (C) 2005 Paul C. Kunysch */
package de.kunysch.tvbrowser.localimdb;

import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.net.URL;
import javax.swing.SwingUtilities;

import util.ui.Localizer;
import de.kunysch.minibrowser.MiniBrowser;
import de.kunysch.tvbrowser.Settings;

public class HelpDialog extends MiniBrowser {
  private static Localizer mLocalizer = util.ui.Localizer.getLocalizerFor(MiniBrowser.class);

  private static final long serialVersionUID = 1L;

  private static class Listener extends WindowAdapter {
    @Override
    public void windowClosing(WindowEvent e) {
      super.windowClosing(e);
      final Settings settings = SettingsKeys.getSettings();
      final Point location = e.getComponent().getLocationOnScreen();
      settings.setInt(SettingsKeys.HELP_X, location.x);
      settings.setInt(SettingsKeys.HELP_Y, location.y);
      final Dimension size = e.getComponent().getSize();
      settings.setInt(SettingsKeys.HELP_W, size.width);
      settings.setInt(SettingsKeys.HELP_H, size.height);
    }
  }

  public HelpDialog(Dialog parent, URL startingUrl) {
    super(parent, mLocalizer.msg("title", "Viewer - LocalImdb"), startingUrl); //$NON-NLS-1$
    addWindowListener(new Listener());
    final Settings settings = SettingsKeys.getSettings();
    final Point location = new Point(settings.getInt(SettingsKeys.HELP_X), settings.getInt(SettingsKeys.HELP_Y));
    SwingUtilities.convertPointToScreen(location, this);
    setLocation(location);
    setSize(new Dimension(settings.getInt(SettingsKeys.HELP_W), settings.getInt(SettingsKeys.HELP_H)));
  }
}
TOP

Related Classes of de.kunysch.tvbrowser.localimdb.HelpDialog$Listener

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.