Package de.axxeed.animosy.gui

Source Code of de.axxeed.animosy.gui.SimpleWaitDialog

/**
*
*/
package de.axxeed.animosy.gui;

import java.awt.Color;
import java.awt.Font;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.Spring;
import javax.swing.SpringLayout;

import org.apache.log4j.Logger;

/**
* OptionsDialog.java
* Created 12.12.2007 11:13:23
* @author Markus J. Luzius
*
*/
public class SimpleWaitDialog extends JDialog {
  private static final long  serialVersionUID  = -1574694043263550395L;
  private static final Logger log = Logger.getLogger(SimpleWaitDialog.class);
  private JLabel message = new JLabel("Bitte warten...");
 
  public SimpleWaitDialog() {
   
    // log.debug("new simple wait dialog, root pane width="+this.getRootPane().getWidth());
    log.debug("WaitDialog constrcutor");
    this.setSize(200,80);
    this.setResizable(false);
    this.setUndecorated(true);
    Rectangle virtualBounds = new Rectangle();
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gs = ge.getScreenDevices();
    for (int j = 0; j < gs.length; j++) {
        GraphicsDevice gd = gs[j];
        GraphicsConfiguration[] gc = gd.getConfigurations();
        for (int i=0; i < gc.length; i++) {
            virtualBounds = virtualBounds.union(gc[i].getBounds());
        }
    }
    this.setLocation( (virtualBounds.width-440)/2, (virtualBounds.height-320)/2);
    this.getContentPane().setBackground(new Color(180,180,255));

    SpringLayout layout = new SpringLayout();
    this.setLayout(layout);
   
    Spring x = Spring.constant(20);
    Spring y = Spring.constant(40);
    Spring width = Spring.constant(150);
    Spring height = Spring.constant(40);

    message.setFont(new Font("SansSerif", Font.BOLD, 16));
    message.setForeground(Color.RED);
    this.add( message, new SpringLayout.Constraints(x,y,width,height) );

  }
 
}
TOP

Related Classes of de.axxeed.animosy.gui.SimpleWaitDialog

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.