package gui; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * @author Louis Royer * @author Flavien Haas * @author JS Auge * @version 1.0 */ public class ErrorFrame extends javax.swing.JFrame { private javax.swing.JLabel jLabel1; private javax.swing.JToggleButton jToggleButton1; private String message; private static final long serialVersionUID = 13L; /** * @param message error message that will be displayed * Create new Errorframe, used to display an error and stop the program when needed */ public ErrorFrame(String message) { this.message = message; initComponents(); this.setVisible(true); } /** * This method is called from within the constructor to initialize the form. */ @SuppressWarnings("unchecked") // private void initComponents() { jToggleButton1 = new javax.swing.JToggleButton(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jToggleButton1.setText("Close"); jToggleButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton1ActionPerformed(evt); } }); jLabel1.setText(message); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1)) .addGroup(layout.createSequentialGroup() .addGap(253, 253, 253) .addComponent(jToggleButton1))) .addContainerGap(205, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(30, 30, 30) .addComponent(jToggleButton1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); this.setLocationRelativeTo(null); this.setAlwaysOnTop(true); pack(); }// /**force exit the program when the button "Close" is pressed*/ private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(1); } }