package mhapsea042003;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
/**
*
Title: </p>
*
Description: </p>
*
Copyright: Copyright (c) 2004</p>
*
Company: </p>
* @author not attributable
* @version 1.0
*/
public class mhapsea042003 extends Applet implements ActionListener, ItemListener {
Panel fixedPa;
Panel fixedBtn;
Panel cardsPa;
Panel card0, card1, card2, card3, card4, card5;
Panel card0Left, card0Right;
Button btnHptMenue;
Checkbox cb1, cb2, cb3, cb4, cb5;
private CardLayout cl;
private CheckboxGroup cbg;
final static String btnTitle = "Hauptmenü";
final static String lblÜ1 = "Softwareentwicklungsaufgabe";
final static String lblÜ2 = "mhap-sea04-2003";
final static String lblÜ3 = "Bitte wählen sie einen der folgenden Punkte aus:";
final static String lblP1 = "(1)Anzahl der Erwerbstätigen in den Bundesländern und";
final static String lblP11 = " deren Anetil an der Bevölkerung Deutschlands.";
final static String lblP2 = "(2)Anzahl der Arbeitslosen in den Ländern und der Anteil";
final static String lblP22 = " an den Erwerbswilligen in % zur Bevölkerung.";
final static String lblP3 = "(3)Anzahl der Industriebeschäftigten in den Ländern und";
final static String lblP33 = " der Anteil in % an der Anzahl der Erwerbstätigen.";
final static String lblP4 = "(4)Vergleich der Anteile der Arbeitslosen an der Anzahl";
final static String lblP44 = " der Erwerbswilligen zwischen den östlichen Bundesländern,";
final static String lblP444 = " westlichen Bundesländern und in Deutschland.";
final static String lblP5 = "(5)Balkengrafik für (4), in der die Unteschiede";
final static String lblP55 = " deutlich sichtbar sind.";
public void init(){
setBackground (new Color(0x800000));
setForeground(new Color(0xDDDDDD));
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints();
Panel gr= new Panel();
gr.setLayout(gridbag);
constraints.gridx=1;
constraints.gridy=1;
//-------------------------------------------------------------------
fixedPa = new Panel();
fixedPa.setLayout(new GridLayout(3,0));
fixedPa.add(new Label (lblÜ1, Label.CENTER));
fixedPa.add(new Label (lblÜ2, Label.CENTER));
fixedPa.add(new Label (lblÜ3, Label.CENTER));
gridbag.setConstraints(fixedPa, constraints);
gr.add (fixedPa);
//------------------------------------------------------------------------
fixedBtn = new Panel();
fixedBtn.setLayout(new FlowLayout());
btnHptMenue = new Button (btnTitle);
btnHptMenue.setForeground(new Color(0x000000));
btnHptMenue.addActionListener(this);
fixedBtn.add(btnHptMenue);
constraints.gridx=1;
constraints.gridy=2;
gridbag.setConstraints(fixedBtn, constraints);
gr.add (fixedBtn);
//------------------------------------------------------------------------
cardsPa = new Panel();
cl= new CardLayout();
cardsPa.setLayout(cl);
card0 = new Panel();
card0.setLayout (new GridLayout(11,0));
card0.setBackground(new Color(0x000000));
//-----------------------
cbg = new CheckboxGroup();
cb1 = new Checkbox (lblP1,cbg,true);
cb1.addItemListener(this);
cb2 = new Checkbox (lblP2,cbg,false);
cb2.addItemListener(this);
cb3 = new Checkbox (lblP3,cbg,false);
cb3.addItemListener(this);
cb4 = new Checkbox (lblP4,cbg,false);
cb4.addItemListener(this);
cb5 = new Checkbox (lblP5,cbg,false);
cb5.addItemListener(this);
card0.add (cb1);
card0.add(new Label (lblP11));
card0.add (cb2);
card0.add(new Label (lblP22));
card0.add (cb3);
card0.add(new Label (lblP33));
card0.add (cb4);
card0.add(new Label (lblP44));
card0.add(new Label (lblP444));
card0.add (cb5);
card0.add(new Label (lblP55));
// cardsPa.add(card0,BorderLayout.CENTER);
cardsPa.add(btnTitle, card0);
//----------------------------------------------------------------
card1 = new Panel();
String[] colNames1 = {"Land1","Fläche","Einwohner","Erwerbstätige"};
Object[][] data1 = {
{"Baden-Württemberg", new Integer (35752),
new Integer(10480), new Integer(5259)},
{"Bayern", new Integer (70548),
new Integer(12164), new Integer(6242)},
{"Brandenburg", new Integer(29476),
new Integer (2600), new Integer (1045)},
{"Hessen", new Integer(21115),
new Integer(6052), new Integer(2986)}
};
final JTable tbl1 = new JTable(data1, colNames1);
tbl1.setPreferredScrollableViewportSize(new Dimension(350, 70));
JScrollPane scrPane = new JScrollPane(tbl1);
tbl1.setEnabled(false);
// cardsPa.add(scrPane,BorderLayout.CENTER);
cardsPa.add(lblP1, scrPane);
//----------------------------------------------------------------
card2 = new Panel();
String[] colNames2 = {"Land2","Fläche","Einwohner","Erwerbstätige"};
Object[][] data2 = {
{"Baden-Württemberg", new Integer (35752),
new Integer(10480), new Integer(5259)},
{"Bayern", new Integer (70548),
new Integer(12164), new Integer(6242)},
{"Brandenburg", new Integer(29476),
new Integer (2600), new Integer (1045)},
{"Hessen", new Integer(21115),
new Integer(6052), new Integer(2986)}
};
final JTable tbl2 = new JTable(data2, colNames2);
tbl2.setPreferredScrollableViewportSize(new Dimension(350, 70));
JScrollPane scrPane2 = new JScrollPane(tbl2);
tbl2.setEnabled(false);
// cardsPa.add(scrPane2,BorderLayout.CENTER);
cardsPa.add(lblP2, scrPane2);
//----------------------------------------------------------------
card3 = new Panel();
String[] colNames3 = {"Land3","Fläche","Einwohner","Erwerbstätige"};
Object[][] data3 = {
{"Baden-Württemberg", new Integer (35752),
new Integer(10480), new Integer(5259)},
{"Bayern", new Integer (70548),
new Integer(12164), new Integer(6242)},
{"Brandenburg", new Integer(29476),
new Integer (2600), new Integer (1045)},
{"Hessen", new Integer(21115),
new Integer(6052), new Integer(2986)}
};
final JTable tbl3 = new JTable(data3, colNames3);
tbl3.setPreferredScrollableViewportSize(new Dimension(350, 70));
JScrollPane scrPane3 = new JScrollPane(tbl3);
tbl3.setEnabled(false);
// cardsPa.add(scrPane3,BorderLayout.CENTER);
cardsPa.add(lblP3, scrPane3);
//----------------------------------------------------------------
card4 = new Panel();
String[] colNames4 = {"Land4","Fläche","Einwohner","Erwerbstätige"};
Object[][] data4 = {
{"Baden-Württemberg", new Integer (35752),
new Integer(10480), new Integer(5259)},
{"Bayern", new Integer (70548),
new Integer(12164), new Integer(6242)},
{"Brandenburg", new Integer(29476),
new Integer (2600), new Integer (1045)},
{"Hessen", new Integer(21115),
new Integer(6052), new Integer(2986)}
};
final JTable tbl4 = new JTable(data4, colNames4);
tbl4.setPreferredScrollableViewportSize(new Dimension(350, 70));
JScrollPane scrPane4 = new JScrollPane(tbl4);
tbl4.setEnabled(false);
// cardsPa.add(scrPane4, BorderLayout.CENTER);
cardsPa.add(lblP4, scrPane4);
//----------------------------------------------------------------
card5 = new Panel();
card5.add(DrawPanel());
// ??????????????????????-----> ich muß jetzt eine Karte entwickeln, mit
// der ich eine balkengrafik darstellen soll...am besten mit paint()
// hat jemand von euch klugen köpfen ne idee wie ich das anstellen kann,
// in ein panel mit der paint)(methode zu malen?
cardsPa.add(lblP5, card5);
constraints.gridx=1;
constraints.gridy=3;
cardsPa.setBackground(new Color(0x00DD00));
gridbag.setConstraints(cardsPa, constraints);
gr.add (cardsPa);
add(gr);
}
public void actionPerformed (ActionEvent e) {
cl.show(cardsPa, btnTitle);
} // actionPerformed
public void itemStateChanged(ItemEvent e) {
// cl.show(cardsPa, lblP1);
cl.show(cardsPa, (String)e.getItem());
} // itemStateChanged
public void paint(Graphics g){
g.drawString("hallo",50,50);
}
}