package heskSystem.zauberperlen.dialogs;
import heskSystem.zauberperlen.objects.GridBagLayoutEditor;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JFrame;
import javax.swing.JLabel;
import org.jdesktop.application.Application;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
@SuppressWarnings("serial")
public class WaitingDialog extends JFrame
{
// GridBagConstraints
@SuppressWarnings("unused")
private int gridx, gridy, gridwidth, gridheight, fill, anchor, ipadx, ipady;
private double weightx, weighty;
@SuppressWarnings("unused")
private Insets defaultInsets;
private ResourceMap resourceMap;
/**
* Konstruktor Creates the reusable dialog.
*/
public WaitingDialog( String text )
{
resourceMap = Application.getInstance().getContext().getResourceMap(getClass());
initComponent(((SingleFrameApplication)Application.getInstance()).getMainFrame(), text);
}
/**
* Initialisiert die Komponenten
*
* @throws Exception
*/
public void initComponent( Frame parentFrame, String text )
{
// setDefaultCloseOperation( JFrame.DO_NOTHING_ON_CLOSE );
// setUndecorated(true);
//setResizable(false);
setLayout(new GridBagLayout());
// Bild
GridBagLayoutEditor.setDefaultValuesGB(this);
JLabel bild = new JLabel(resourceMap.getImageIcon("waiting.icon"));
GridBagLayoutEditor.addGB(this, bild, gridx = 0, gridy = 0,
gridwidth, gridheight, fill = GridBagConstraints.BOTH,
weightx, weighty, anchor,
new Insets(20, 20, 20, 20));
// Text
GridBagLayoutEditor.setDefaultValuesGB(this);
JLabel labelText = new JLabel(text);
labelText.setFont(new Font("Calibri", Font.PLAIN, 15));
GridBagLayoutEditor.addGB(this, labelText, gridx = 0, gridy = 1,
gridwidth, gridheight, fill,
weightx = 1, weighty, anchor,
new Insets(5, 20, 5, 20));
pack();
setLocationRelativeTo(parentFrame);
}
public void showIt()
{
setVisible(true);
}
public void hideIt()
{
setVisible(false);
}
}