View:
wind = modell
getAuthor() liefert ein String[] zurück.
Wird das Fenster per Menu erstellt passiert folgendes:
Also irgendwie passt Java das nicht Wie benutzt man MVC im zusammenhand mit dem einmaligen aufbau des Fensters richtig?
Code:
public void init()
{
....
panelauthor = new JPanel();
controller.updateAuthor(); // ruft die db Abfrage auf die die Authoren im modell speichert
panelauthor.add(jcomboboxauthor);
getContentPane().add(panelauthor);
...
}
public void update(Observable arg0, Object arg1)
{
Library wind = (Library) arg1;
jcomboboxauthor = new JComboBox(wind.getAuthor());
}
wind = modell
getAuthor() liefert ein String[] zurück.
Wird das Fenster per Menu erstellt passiert folgendes:
Code:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.awt.Container.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at test.view.NewEntry.init(NewEntry.java:114)
at test.view.NewEntry.<init>(NewEntry.java:60)
at test.controll.LibraryController.newEntry(LibraryController.java:23)
at test.view.LibraryViewer.actionPerformed(LibraryViewer.java:139)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Also irgendwie passt Java das nicht Wie benutzt man MVC im zusammenhand mit dem einmaligen aufbau des Fensters richtig?