public class Hauptfenster extends JFrame {
private static final long serialVersionUID = 1L;
HauptfensterGL hauptfensterGL = new HauptfensterGL();
private JMenuItem bearbeiten;
private JMenuItem datenbestand_löschen;
private JMenuItem Beenden;
private JMenuItem Pflege;
private JMenuItem importieren;
private JMenuItem exportieren;
private JMenuItem nach_Beziehung;
private JMenuItem Quernavigation;
private JMenuItem cfgBearbeiten;
private JMenuItem starten;
private JLabel neuesWort;
private JLabel grammTyp;
private JLabel geschlecht;
private JLabel wortFürBezh;
private JLabel wortZuBezh;
private JLabel bemerkungen;
private JLabel beziehung;
private JLabel beziehungCheckBox;
private JLabel beideRichtungCheckBox;
private JTextField neuesWortTF;
private JTextField bezhWort_1;
private JTextField bezhWort_2;
private JTextField gewählteBez;
private JTextField löschenTF;
private JTextArea bemerkungenTA;
private JButton wort1SucheButton;
private JButton bezSuchenButton;
private JButton wort2SucheButton;
private JButton wortSpeichernButton;
private JButton bezhSpeichernButton;
private JButton wortSucheButton;
private JButton löschenButton;
private JComboBox grammTypCB;
private JComboBox geschlechtCB;
private JCheckBox beziehungCB;
private JCheckBox beideRichtungCB;
private JList wort1Liste;
private JList beziehungsListe;
private JList wort2Liste;
private JList wortListe;
Dimension fieldDimension = new Dimension(150,20);
Dimension listDimension = new Dimension(150,100);
public Hauptfenster() {
setTitle("WöBe - Wörter-Beziehungen");
setLocationByPlatform(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setJMenuBar(HF_Menu());
this.add(mainPanel());
pack();
setVisible(true);
}
private JMenuBar HF_Menu() {...}
private JPanel mainPanel() {
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));
mainPanel.add(wörterPanel());
mainPanel.add(beziehungsPanel());
mainPanel.add(bezhSpeichernPanel());
mainPanel.add(wortLöschenPanel());
return mainPanel;
}
private JPanel wörterPanel() {...}
private JPanel beziehungsPanel() {
JPanel hauptPanel = new JPanel();
hauptPanel.setLayout(new BoxLayout(hauptPanel, BoxLayout.PAGE_AXIS));
hauptPanel.setBorder(BorderFactory.createTitledBorder("Beziehung erstellen"));
JPanel erstesWortPanel = new JPanel();
erstesWortPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 13, 0));
wortFürBezh = new JLabel("Wort eingeben:");
bezhWort_1 = new JTextField();
wort1SucheButton = new JButton("Suche");
wort1Liste = new JList();
wort1Liste.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
wort1Liste.setLayoutOrientation(JList.VERTICAL);
bezhWort_1.setPreferredSize(fieldDimension);
wort1Liste.setPreferredSize(listDimension);
erstesWortPanel.add(wortFürBezh);
erstesWortPanel.add(bezhWort_1);
erstesWortPanel.add(wort1SucheButton);
erstesWortPanel.add(wort1Liste);
wort1SucheButton.addActionListener(
hauptfensterGL.wort1SuchenButtonAction(bezhWort_1, wort1Liste));
JPanel bezhPanel = new JPanel();
bezhPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
beziehung = new JLabel("Beziehung eingeben:");
gewählteBez = new JTextField();
bezSuchenButton = new JButton("Suche");
beziehungsListe = new JList();
gewählteBez.setPreferredSize (fieldDimension);
beziehungsListe.setPreferredSize (listDimension);
bezhPanel.add(beziehung);
bezhPanel.add(gewählteBez);
bezhPanel.add(bezSuchenButton);
bezhPanel.add(beziehungsListe);
bezSuchenButton.addActionListener(
hauptfensterGL.bezhSuchenButtonAction(gewählteBez, beziehungsListe));
JPanel zweitesWortPanel = new JPanel();
zweitesWortPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 13, 0));
wortZuBezh = new JLabel("Wort eingeben:");
bezhWort_2 = new JTextField();
wort2SucheButton = new JButton("Suche");
wort2Liste = new JList();
wort2Liste.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
wort2Liste.setLayoutOrientation(JList.VERTICAL);
bezhWort_2.setPreferredSize(fieldDimension);
wort2Liste.setPreferredSize(listDimension);
zweitesWortPanel.add(wortZuBezh);
zweitesWortPanel.add(bezhWort_2);
zweitesWortPanel.add(wort2SucheButton);
zweitesWortPanel.add(wort2Liste);
wort2SucheButton.addActionListener(
hauptfensterGL.wort1SuchenButtonAction(bezhWort_2, wort2Liste));
hauptPanel.add(erstesWortPanel);
hauptPanel.add(bezhPanel);
hauptPanel.add(zweitesWortPanel);
return hauptPanel;
}
..........
}