Hei Leute,
bin grade dabei einen Terminplaner zu erstellen und bei mir haperts gerade an der Digitaluhr
kann mir jemand sagen wie ich die zum laufen kriege?
bin grade dabei einen Terminplaner zu erstellen und bei mir haperts gerade an der Digitaluhr
kann mir jemand sagen wie ich die zum laufen kriege?
Java:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.text.*;
public class Planer extends JFrame{
public static void main(String [] args){
Fenster = new Planer("Wochenplaner");
Fenster.pack();
Fenster.setVisible(true);
Fenster.setSize(1000,600);
Fenster.setResizable(false);
}
static Planer Fenster;
class MWindowLauscher extends WindowAdapter{
public void windowClosing(WindowEvent e){
System.exit(0);
}
}
class MActionListener implements ActionListener {
public void actionPerformed(ActionEvent e){
String Label;
Label = e.getActionCommand();
if(Label.equals("Programm beenden"))
System.exit(0);
}
}
Planer(String titel){
super(titel);
Calendar cal = Calendar.getInstance ();
// Datum
int Tag = cal.get( Calendar.DAY_OF_MONTH);
int Monat = cal.get( Calendar.MONTH)+1;
int Jahr = cal.get( Calendar.YEAR);
// Uhrzeit
int Stunde = cal.get(Calendar.HOUR_OF_DAY);
int Minute = cal.get(Calendar.MINUTE);
int Sekunde = cal.get(Calendar.SECOND);
int Wochentag = cal.get(Calendar.DAY_OF_WEEK);
ImageIcon icon = new ImageIcon("buttonImage.gif");
String hallo = "Zeit: "+Stunde +":"+Minute+":"+Sekunde;
JMenuBar Menuleiste = new JMenuBar();
JMenu Menu1 = new JMenu("Datei");
JMenuItem Item1 = new JMenuItem("Programm beenden");
Item1.addActionListener(new MActionListener());
Menu1.add(Item1);
JMenu Menu2 = new JMenu("Datei1");
JMenu Menu3 = new JMenu("Datei2");
JMenu Menu4 = new JMenu("Datei3");
JLabel text10 = new JLabel(hallo,icon, SwingConstants.LEFT);
text10.setFont(new Font("Monospaced", Font.PLAIN,12));
repaint();
Menuleiste.add(Menu1);
Menuleiste.add(Menu2);
Menuleiste.add(Menu3);
Menuleiste.add(Menu4);
Menuleiste.add(text10);
setJMenuBar(Menuleiste);
setLayout(new GridLayout(2,8,2,30));
JPanel zelle1 = new JPanel();
JPanel zelle2 = new JPanel();
JPanel zelle3 = new JPanel();
JPanel zelle4 = new JPanel();
JPanel zelle5 = new JPanel();
JPanel zelle6 = new JPanel();
JPanel zelle7 = new JPanel();
JPanel zelle8 = new JPanel();
JPanel zelle9 = new JPanel();
JPanel zelle10 = new JPanel();
JPanel zelle11 = new JPanel();
JPanel zelle12 = new JPanel();
JPanel zelle13 = new JPanel();
JPanel zelle14 = new JPanel();
JPanel zelle15 = new JPanel();
JPanel zelle16 = new JPanel();
JLabel text1 = new JLabel("Montag",icon, SwingConstants.LEFT);
text1.setFont(new Font("Monospaced", Font.PLAIN,12));
zelle1.add(text1);
JLabel text2 = new JLabel("Dienstag",icon, SwingConstants.LEFT);
text2.setFont(new Font("Monospaced", Font.PLAIN,12));
zelle2.add(text2);
JLabel text3 = new JLabel("Mittwoch",icon, SwingConstants.LEFT);
text3.setFont(new Font("Monospaced", Font.PLAIN,12));
zelle3.add(text3);
JLabel text4 = new JLabel("Donnerstag",icon, SwingConstants.LEFT);
text4.setFont(new Font("Monospaced", Font.PLAIN,12));
zelle4.add(text4);
JLabel text5 = new JLabel("Freitag",icon, SwingConstants.LEFT);
text5.setFont(new Font("Monospaced", Font.PLAIN,12));
zelle5.add(text5);
JLabel text6 = new JLabel("Samstag",icon, SwingConstants.LEFT);
text6.setFont(new Font("Monospaced", Font.PLAIN,12));
zelle6.add(text6);
JLabel text7 = new JLabel("Sonntag",icon, SwingConstants.LEFT);
text7.setFont(new Font("Monospaced", Font.PLAIN,12));
zelle7.add(text7);
JTextArea Montag = new JTextArea("Hello" ,50,10);
zelle9.add(Montag);
JTextArea Dienstag = new JTextArea("Hello", 5, 10);
zelle10.add(Dienstag);
JTextArea Mittwoch = new JTextArea("Hello", 5, 10);
zelle11.add(Mittwoch);
JTextArea Donnerstag = new JTextArea("Hello", 5, 10);
zelle12.add(Donnerstag);
JTextArea Freitag = new JTextArea("Hello", 5, 10);
zelle13.add(Freitag);
JTextArea Samstag = new JTextArea("Hello", 5, 10);
zelle14.add(Samstag);
JTextArea Sonntag = new JTextArea("Hello", 5, 10);
zelle15.add(Sonntag);
add(zelle1);
add(zelle2);
add(zelle3);
add(zelle4);
add(zelle5);
add(zelle6);
add(zelle7);
add(zelle8);
add(zelle9);
add(zelle10);
add(zelle11);
add(zelle12);
add(zelle13);
add(zelle14);
add(zelle15);
add(zelle16);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}