codice:
package gestaule;
import java.awt.Dimension;
import java.lang.reflect.InvocationTargetException;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
/**
* @author Roberto
*
* TODO Per modificare il modello associato al commento di questo tipo generato, aprire
* Finestra - Preferenze - Java - Stile codice - Modelli codice
*/
public class TestInterface extends JFrame {
private javax.swing.JPanel jContentPane = null;
private JLabel cmdInsertPrenotazioni = null;
private JLabel cmdInsertAule = null;
private JLabel cmdSearchPrenotazioni = null;
private JLabel cmdViewAule = null;
private JLabel cmdDeletePrenotazioni = null;
private JLabel cmdConnetti = null;
private JLabel lblSpiegazione = null;
private JPanel panelConnetti = null;
private JPanel panelInsertAule = null;
private JPanel panelViewAule = null;
private JPanel panelInsertPrenotazioni = null;
private JPanel panelSearchPrenotazioni = null;
private JPanel panelDeletePrenotazioni = null;
private JDialog dialog=null;
private FormFunction ffunction=new FormFunction();
/**
* This is the default constructor
*/
public TestInterface() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
dialog=new JDialog(this,null);
dialog.setResizable(false);
dialog.setContentPane(getJContentPane());
dialog.setTitle("Menù Principale - GestAule");
dialog.pack();
dialog.setSize(515, 230);
centerScreen();
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private javax.swing.JPanel getJContentPane() {
if(jContentPane == null) {
lblSpiegazione = new JLabel();
cmdConnetti = new JLabel();
cmdDeletePrenotazioni = new JLabel();
cmdViewAule = new JLabel();
cmdSearchPrenotazioni = new JLabel();
cmdInsertAule = new JLabel();
cmdInsertPrenotazioni = new JLabel();
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
cmdInsertPrenotazioni.setText("JLabel");
cmdInsertPrenotazioni.setLocation(0, 0);
cmdInsertPrenotazioni.setSize(146, 56);
cmdInsertPrenotazioni.setIcon(new ImageIcon(getClass().getResource("/resources/InsertPrenotazioni.jpg")));
cmdInsertAule.setText("JLabel");
cmdInsertAule.setLocation(0, 0);
cmdInsertAule.setSize(146, 56);
cmdInsertAule.setIcon(new ImageIcon(getClass().getResource("/resources/InsertAule.jpg")));
cmdSearchPrenotazioni.setText("JLabel");
cmdSearchPrenotazioni.setLocation(0, 0);
cmdSearchPrenotazioni.setSize(146, 56);
cmdSearchPrenotazioni.setIcon(new ImageIcon(getClass().getResource("/resources/SearchPrenotazioni.jpg")));
cmdViewAule.setText("JLabel");
cmdViewAule.setLocation(0, 0);
cmdViewAule.setSize(146, 56);
cmdViewAule.setIcon(new ImageIcon(getClass().getResource("/resources/ViewAule.jpg")));
cmdDeletePrenotazioni.setText("JLabel");
cmdDeletePrenotazioni.setLocation(0, 0);
cmdDeletePrenotazioni.setSize(146, 56);
cmdDeletePrenotazioni.setIcon(new ImageIcon(getClass().getResource("/resources/DeletePrenotazioni.jpg")));
cmdConnetti.setText("JLabel");
cmdConnetti.setLocation(0, 0);
cmdConnetti.setSize(146, 56);
cmdConnetti.setIcon(new ImageIcon(getClass().getResource("/resources/LogIn.jpg")));
lblSpiegazione.setText("JLabel");
lblSpiegazione.setFont(new java.awt.Font("Tahoma", java.awt.Font.PLAIN, 12));
lblSpiegazione.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblSpiegazione.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
lblSpiegazione.setSize(475, 42);
lblSpiegazione.setLocation(15, 78);
jContentPane.add(lblSpiegazione, null);
jContentPane.add(getPanelConnetti(), null);
jContentPane.add(getPanelInsertAule(), null);
jContentPane.add(getPanelViewAule(), null);
jContentPane.add(getPanelInsertPrenotazioni(), null);
jContentPane.add(getPanelSearchPrenotazioni(), null);
jContentPane.add(getPanelDeletePrenotazioni(), null);
}
return jContentPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getPanelConnetti() {
if (panelConnetti == null) {
panelConnetti = new JPanel();
panelConnetti.setLayout(null);
panelConnetti.setLocation(15, 10);
panelConnetti.setSize(146, 56);
panelConnetti.add(cmdConnetti,null);
}
return panelConnetti;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getPanelInsertAule() {
if (panelInsertAule == null) {
panelInsertAule = new JPanel();
panelInsertAule.setLayout(null);
panelInsertAule.setLocation(180, 10);
panelInsertAule.setSize(146, 56);
panelInsertAule.setBorder(null);
panelInsertAule.add(cmdInsertAule,null);
}
return panelInsertAule;
}
private Runnable dialogHider = new Runnable(){public void run(){dialog.setVisible(false);}};
private Runnable dialogThrower = new Runnable(){public void run(){dialog.setVisible(true);}};
private void showDialog()
{
if (SwingUtilities.isEventDispatchThread())
dialog.setVisible(true);
else
{
try
{
SwingUtilities.invokeAndWait(dialogThrower);
}
catch (InvocationTargetException e)
{
System.out.println(e.getCause());
}
catch (InterruptedException e)
{
}
finally {
hideDialog();
}
}
}
public void centerScreen()
{
Dimension d=ffunction.centerScreen(dialog);
int x= (int)d.getWidth();
int y= (int)d.getHeight();
dialog.setLocation(x,y);
}
private void hideDialog()
{
if (SwingUtilities.isEventDispatchThread())
dialog.setVisible(false);
else
SwingUtilities.invokeLater(dialogHider);
}
public void show(){showDialog();}
public void showTestInterface(){showDialog();}
/**
* This method initializes jPanel2
*
* @return javax.swing.JPanel
*/
private JPanel getPanelViewAule() {
if (panelViewAule == null) {
panelViewAule = new JPanel();
panelViewAule.setLayout(null);
panelViewAule.setLocation(345, 10);
panelViewAule.setSize(146, 56);
}
return panelViewAule;
}
/**
* This method initializes jPanel3
*
* @return javax.swing.JPanel
*/
private JPanel getPanelInsertPrenotazioni() {
if (panelInsertPrenotazioni == null) {
panelInsertPrenotazioni = new JPanel();
panelInsertPrenotazioni.setLayout(null);
panelInsertPrenotazioni.setLocation(15, 130);
panelInsertPrenotazioni.setSize(146, 56);
panelInsertPrenotazioni.add(cmdInsertPrenotazioni);
}
return panelInsertPrenotazioni;
}
/**
* This method initializes jPanel4
*
* @return javax.swing.JPanel
*/
private JPanel getPanelSearchPrenotazioni() {
if (panelSearchPrenotazioni == null) {
panelSearchPrenotazioni = new JPanel();
panelSearchPrenotazioni.setLayout(null);
panelSearchPrenotazioni.setLocation(180, 130);
panelSearchPrenotazioni.setSize(146, 56);
panelSearchPrenotazioni.add(cmdSearchPrenotazioni);
}
return panelSearchPrenotazioni;
}
/**
* This method initializes jPanel5
*
* @return javax.swing.JPanel
*/
private JPanel getPanelDeletePrenotazioni() {
if (panelDeletePrenotazioni == null) {
panelDeletePrenotazioni = new JPanel();
panelDeletePrenotazioni.setLayout(null);
panelDeletePrenotazioni.setLocation(345, 130);
panelDeletePrenotazioni.setSize(146, 56);
panelDeletePrenotazioni.add(cmdDeletePrenotazioni);
}
return panelDeletePrenotazioni;
}
} // @jve:decl-index=0:visual-constraint="10,10"