Habe insgesamt 7 java Dateien, die voneinander erben. Hierarchie (Von Superklasse bis Subklasse): IZBPanel, AmountPanel, ShowPanel, PrintPanel, DecisionPanel. Außerdem habe ich noch eine Testclass, um die ganzen Konstruktoren aufzurufen und eine Actionclass, in denen 2 ActionListener stehen.
Der eine Listener des IZBPanels wird leider nicht ausgeführt, wieso weiß ich allerdings nicht.
Kennt Ihr denn mein Problem? Danke für eure Hilfe....
IZBPanel.java
ShowPanel.java
ActionClass.java
TestClass.java
Der eine Listener des IZBPanels wird leider nicht ausgeführt, wieso weiß ich allerdings nicht.
Kennt Ihr denn mein Problem? Danke für eure Hilfe....
IZBPanel.java
Code:
public class IZBPanel extends JPanel
{
//Deklaration
ButtonGroup group=new ButtonGroup();
static JRadioButton blager;
static JRadioButton blinie;
static JRadioButton breserve;
static boolean lager=false;
static boolean linie=false;
static boolean reserve=false;
public IZBPanel()
{
setLayout(null);
JLabel abfrizbart = new JLabel ("Welche Art von IZB´s soll ausgedruckt werden?");
abfrizbart.setBounds(10,5,300,20);
add(abfrizbart);
blager = new JRadioButton("Lager");
blager.setBounds(50,40,80,20);
group.add(blager);
blinie = new JRadioButton("Linie");
blinie.setBounds(150,40,80,20);
group.add(blinie);
JRadioButton breserve = new JRadioButton("Reserve");
breserve.setBounds(250,40,80,20);
group.add(breserve);
add(blager);
add(blinie);
add(breserve);
JSeparator trennzeichen=new JSeparator(SwingConstants.HORIZONTAL);
trennzeichen.setBounds(0, 80, 400, 30);
add(trennzeichen);
//Listener
blager.addActionListener(new ActionClass());
blinie.addActionListener(new ActionClass());
breserve.addActionListener(new ActionClass());
}//end Konstruktor
}//endclass
ShowPanel.java
Code:
public class ShowPanel extends AmountPanel
{
ButtonGroup group2=new ButtonGroup();
static JRadioButton ja;
static JRadioButton nein;
static boolean abfrageja=false;
static boolean abfragenein=false;
public ShowPanel()
{
//setLayout(null);
JLabel abfrizbanzeige = new JLabel ("Sollen die IZB´s vor dem Ausdruck angezeigt werden?");
abfrizbanzeige.setBounds(10,195,350,20);
add(abfrizbanzeige);
ja = new JRadioButton("ja");
ja.setBounds(50,230,80,20);
group2.add(ja);
nein = new JRadioButton("nein");
nein.setBounds(250,230,80,20);
group2.add(nein);
add(ja);
add(nein);
JSeparator trennzeichen=new JSeparator(SwingConstants.HORIZONTAL);
trennzeichen.setBounds(0, 270, 400, 30);
add(trennzeichen);
//Listener
ja.addActionListener(new ActionClass());
nein.addActionListener(new ActionClass());
}//endKonstruktor
}//end class
ActionClass.java
Code:
public class ActionClass implements ActionListener
{
public void actionPerformed (ActionEvent me)
{
if (me.getSource()==IZBPanel.blager)
{
IZBPanel.lager=true;
//System.out.print(IZBPanel.lager);
}
if (me.getSource()==IZBPanel.blinie)
{
IZBPanel.linie=true;
}
if (me.getSource()==IZBPanel.breserve)
{
IZBPanel.reserve=true;
}
if (me.getSource()==ShowPanel.ja)
{
ShowPanel.abfrageja=true;
}
if (me.getSource()==ShowPanel.nein)
{
ShowPanel.abfragenein=true;
}
}
}
TestClass.java
Code:
public class Testclass {
public static void main(String[] args)
{
JFrame f = new JFrame("Einstellungen für das Drucken der IZB´s");
f.setBounds(0, 0, 400, 600);
f.setResizable(false);
f.setLocation(350, 70);
IZBPanel i = new IZBPanel();
AmountPanel a=new AmountPanel();
ShowPanel s=new ShowPanel();
PrinterPanel p=new PrinterPanel();
DecisionPanel d=new DecisionPanel();
f.getContentPane().add(i);
f.getContentPane().add(a);
f.getContentPane().add(s);
f.getContentPane().add(p);
f.getContentPane().add(d);
f.setVisible(true);
}
}