package visual;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.TextField;
import javax.swing.JCheckBox;
import java.awt.Dimension;
import java.awt.Color;
import javax.swing.SwingConstants;
import java.awt.Toolkit;
import javax.swing.JRadioButton;
import javax.swing.JComboBox;
import java.awt.GridBagLayout;
import java.awt.Choice;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JMenuBar;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
import javax.swing.JPasswordField;
import java.awt.GridBagConstraints;
import javax.swing.JButton;
import javax.swing.JSplitPane;
import javax.swing.JToggleButton;
import java.awt.ComponentOrientation;
import java.io.File;
import javax.swing.JWindow;
import javax.swing.JList;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.TextField;
import javax.swing.JCheckBox;
import java.awt.Dimension;
import java.awt.Color;
import javax.swing.SwingConstants;
import java.awt.Toolkit;
import javax.swing.JRadioButton;
import javax.swing.JComboBox;
import java.awt.GridBagLayout;
import java.awt.Choice;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JMenuBar;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
import javax.swing.JPasswordField;
import java.awt.GridBagConstraints;
import javax.swing.JButton;
import javax.swing.JSplitPane;
import javax.swing.JToggleButton;
import java.awt.ComponentOrientation;
import java.io.File;
import javax.swing.JWindow;
import javax.swing.JList;
public class Visual1 extends JFrame {
public static void main(String[] args) {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JButton jButton3 = null;
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="299,60"
private JPanel jContentPane1 = null;
private JButton jButton4 = null;
private JToggleButton jToggleButton = null;
private JButton jButton41 = null;
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setText("Shutdown Timer");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
int Ergebnis = 0;
String Eingabe = JOptionPane.showInputDialog("Stunden?");
int Zahl = Integer.parseInt(Eingabe);
Ergebnis = 3600 * Zahl;
int Ergebnis1 = 0;
String Eingabe1 = JOptionPane.showInputDialog("Minuten?");
int Zahl1 = Integer.parseInt(Eingabe1);
Ergebnis1 = 60 * Zahl1;
int Ergebnis2 = 0;
String Eingabe2 = JOptionPane.showInputDialog("Sekunden?");
int Zahl2 = Integer.parseInt(Eingabe2);
Ergebnis2 = Zahl2;
final int ErgebnisF = Ergebnis + Ergebnis1 + Ergebnis2;
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -s -t " + ErgebnisF + " -c " + "Tschüss!=]");
}
catch (Exception x) {
JOptionPane.showMessageDialog(null, "Ein Fehler ist aufgetreten!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setText("Jetzt Shutdown");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -s -t 0");
}
catch(Exception x) {
JOptionPane.showMessageDialog(null, "Ein Fehler ist aufgetreten!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jButton1;
}
/**
* This method initializes jButton2
*
* @return javax.swing.JButton
*/
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton();
jButton2.setText("Restart Timer");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
int Ergebnis = 0;
String Eingabe = JOptionPane.showInputDialog("Stunden?");
int Zahl = Integer.parseInt(Eingabe);
Ergebnis = 3600 * Zahl;
int Ergebnis1 = 0;
String Eingabe1 = JOptionPane.showInputDialog("Minuten?");
int Zahl1 = Integer.parseInt(Eingabe1);
Ergebnis1 = 60 * Zahl1;
int Ergebnis2 = 0;
String Eingabe2 = JOptionPane.showInputDialog("Sekunden?");
int Zahl2 = Integer.parseInt(Eingabe2);
Ergebnis2 = Zahl2;
int ErgebnisF = Ergebnis + Ergebnis1 + Ergebnis2;
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -r -t " + ErgebnisF + " -c " + "Tschüss!=]");
}
catch (Exception x) {
JOptionPane.showMessageDialog(null, "Ein Fehler ist aufgetreten!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jButton2;
}
/**
* This method initializes jButton3
*
* @return javax.swing.JButton
*/
private JButton getJButton3() {
if (jButton3 == null) {
jButton3 = new JButton();
jButton3.setText("Jetzt Restart");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -r -t 0");
}
catch (Exception x) {
JOptionPane.showMessageDialog(null, "Ein Fehler ist aufgetreten!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jButton3;
}
/**
* This is the default constructor
*/
public Visual1() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(402, 160);
this.setResizable(false);
this.setIconImage(Toolkit.getDefaultToolkit().getImage("D:/Programmieren/Java/MeineJava- Files/VisualEd/visual/Bild2.png"));
this.setBackground(new Color(204, 51, 0));
this.setContentPane(getJContentPane());
this.setTitle("Shutdown");
this.setVisible(true);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new GridLayout(2,2));
jContentPane.setForeground(Color.red);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJButton3(), null);
jContentPane.add(getJToggleButton(), null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton2(), null);
jContentPane.add(getJButton41(), null);
}
return jContentPane;
}
/**
* This method initializes jToggleButton
*
* @return javax.swing.JToggleButton
*/
private JToggleButton getJToggleButton() {
if (jToggleButton == null) {
jToggleButton = new JToggleButton();
jToggleButton.setHorizontalTextPosition(SwingConstants.CENTER);
jToggleButton.setForeground(new Color(153, 0, 0));
jToggleButton.setBackground(new Color(238, 238, 238));
jToggleButton.setText("Abbrechen!");
jToggleButton.setRolloverEnabled(true);
jToggleButton.setComponentOrientation(ComponentOrientation.UNKNOWN);
jToggleButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -a");
}
catch(Exception c) {
JOptionPane.showMessageDialog(null, "Fehler!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jToggleButton;
}
/**
* This method initializes jButton41
*
* @return javax.swing.JButton
*/
private JButton getJButton41() {
if (jButton41 == null) {
jButton41 = new JButton();
jButton41.setText("EXIT");
jButton41.setForeground(new Color(204, 51, 0));
jButton41.setBackground(new Color(238, 238, 238));
jButton41.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
System.exit(0);
}
});
}
return jButton41;
}
} // @jve:decl-index=0:visual-constraint="207,96"
public class Visual1 extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JButton jButton3 = null;
private JFrame jFrame = null; // @jve:decl-index=0:visual-constraint="299,60"
private JPanel jContentPane1 = null;
private JButton jButton4 = null;
private JToggleButton jToggleButton = null;
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setText("Shutdown Timer");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
int Ergebnis = 0;
String Eingabe = JOptionPane.showInputDialog("Stunden?");
int Zahl = Integer.parseInt(Eingabe);
Ergebnis = 3600 * Zahl;
int Ergebnis1 = 0;
String Eingabe1 = JOptionPane.showInputDialog("Minuten?");
int Zahl1 = Integer.parseInt(Eingabe1);
Ergebnis1 = 60 * Zahl1;
int Ergebnis2 = 0;
String Eingabe2 = JOptionPane.showInputDialog("Sekunden?");
int Zahl2 = Integer.parseInt(Eingabe2);
Ergebnis2 = Zahl2;
final int ErgebnisF = Ergebnis + Ergebnis1 + Ergebnis2;
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -s -t " + ErgebnisF + " -c " + "Tschüss!=]");
}
catch (Exception x) {
JOptionPane.showMessageDialog(null, "Ein Fehler ist aufgetreten!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jButton;
}
/**
* This method initializes jButton1
*
* @return javax.swing.JButton
*/
private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setText("Jetzt Shutdown");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -s -t 0");
}
catch(Exception x) {
JOptionPane.showMessageDialog(null, "Ein Fehler ist aufgetreten!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jButton1;
}
/**
* This method initializes jButton2
*
* @return javax.swing.JButton
*/
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton();
jButton2.setText("Restart Timer");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
int Ergebnis = 0;
String Eingabe = JOptionPane.showInputDialog("Stunden?");
int Zahl = Integer.parseInt(Eingabe);
Ergebnis = 3600 * Zahl;
int Ergebnis1 = 0;
String Eingabe1 = JOptionPane.showInputDialog("Minuten?");
int Zahl1 = Integer.parseInt(Eingabe1);
Ergebnis1 = 60 * Zahl1;
int Ergebnis2 = 0;
String Eingabe2 = JOptionPane.showInputDialog("Sekunden?");
int Zahl2 = Integer.parseInt(Eingabe2);
Ergebnis2 = Zahl2;
int ErgebnisF = Ergebnis + Ergebnis1 + Ergebnis2;
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -r -t " + ErgebnisF + " -c " + "Tschüss!=]");
}
catch (Exception x) {
JOptionPane.showMessageDialog(null, "Ein Fehler ist aufgetreten!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jButton2;
}
/**
* This method initializes jButton3
*
* @return javax.swing.JButton
*/
private JButton getJButton3() {
if (jButton3 == null) {
jButton3 = new JButton();
jButton3.setText("Jetzt Restart");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -r -t 0");
}
catch (Exception x) {
JOptionPane.showMessageDialog(null, "Ein Fehler ist aufgetreten!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jButton3;
}
/**
* This is the default constructor
*/
public Visual1() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(402, 160);
this.setResizable(false);
this.setIconImage(Toolkit.getDefaultToolkit().getImage("D:/Programmieren/Java/MeineJava-Files/VisualEd/visual/Bild2.png"));
this.setBackground(new Color(204, 51, 0));
this.setContentPane(getJContentPane());
this.setTitle("Shutdown");
this.setVisible(true);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new GridLayout(2,2));
jContentPane.setForeground(Color.red);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJButton3(), null);
jContentPane.add(getJToggleButton(), null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton2(), null);
jContentPane.add(getJButton41(), null);
}
return jContentPane;
}
/**
* This method initializes jToggleButton
*
* @return javax.swing.JToggleButton
*/
private JToggleButton getJToggleButton() {
if (jToggleButton == null) {
jToggleButton = new JToggleButton();
jToggleButton.setHorizontalTextPosition(SwingConstants.CENTER);
jToggleButton.setForeground(new Color(153, 0, 0));
jToggleButton.setBackground(new Color(238, 238, 238));
jToggleButton.setText("Abbrechen!");
jToggleButton.setRolloverEnabled(true);
jToggleButton.setComponentOrientation(ComponentOrientation.UNKNOWN);
jToggleButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
try {
Runtime.getRuntime().exec("cmd.exe /c shutdown -a");
}
catch(Exception c) {
JOptionPane.showMessageDialog(null, "Fehler!", "Fehler!", JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jToggleButton;
}
/**
* This method initializes jButton41
*
* @return javax.swing.JButton
*/
private JButton getJButton41() {
if (jButton41 == null) {
jButton41 = new JButton();
jButton41.setText("EXIT");
jButton41.setForeground(new Color(204, 51, 0));
jButton41.setBackground(new Color(238, 238, 238));
jButton41.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()");
System.exit(0);
}
});
}
return jButton41;
}
}
} // @jve:decl-index=0:visual-constraint="207,96"