Hallo Leute!
Ich habe heir ein kleiner Problem mit einer Java Software die ich grade schreibe.
Es geht um folgendes:
Die Software öffnet nach einem Druck auf einen Button einen JDialog. In diesem werden dann eine ganze Latte an Labels und Eingabefeldern Panels hinzugefügt und schlussendlich dann die panels dem Dialog. Soweit so gut. Klappt auch alles soweit. Es passiert aber ständig, dass das Dialog Fenster schwarz wird (siehe Screenshot). Komisch an der Sache ist aber besonders, dass sobald ich das Fenster von Hand resize, der Inhalt komplett da ist. Auch tauchen Teile (die, die durch das Objekt bedeckt sind) des Panels auf, sobald diese sich ändern (also Mouseover oder Klick auf Button oder ähnlichem).
Ich habe schon versucht, repaint(), validate() und pack() auszuführen, bringt aber nichts.
Woran kann das liegen?
Danke schonmal
Gruß
Borg
Ich habe heir ein kleiner Problem mit einer Java Software die ich grade schreibe.
Es geht um folgendes:
Die Software öffnet nach einem Druck auf einen Button einen JDialog. In diesem werden dann eine ganze Latte an Labels und Eingabefeldern Panels hinzugefügt und schlussendlich dann die panels dem Dialog. Soweit so gut. Klappt auch alles soweit. Es passiert aber ständig, dass das Dialog Fenster schwarz wird (siehe Screenshot). Komisch an der Sache ist aber besonders, dass sobald ich das Fenster von Hand resize, der Inhalt komplett da ist. Auch tauchen Teile (die, die durch das Objekt bedeckt sind) des Panels auf, sobald diese sich ändern (also Mouseover oder Klick auf Button oder ähnlichem).
Ich habe schon versucht, repaint(), validate() und pack() auszuführen, bringt aber nichts.
Woran kann das liegen?
Code:
Code Dialog-Erstellung:
AddNewCycleDay addNewCycleDay = new AddNewCycleDay(Const.window, "Zyklustag hinzufügen", true);
addNewCycleDay.setSize(550,450);
addNewCycleDay.setVisible(true);
Code:
Code Dialog:
public AddNewCycleDay(Frame owner, String title, boolean modal) {
super(owner, title, modal);
System.out.println("Generating AddNewCycleDay Window");
init(); //Hier werden nur ein paar benötigte Daten geladen.
GridBagLayout gbl = new GridBagLayout();
this.panel.setLayout(gbl);
//addComponent ist eine Statische Methode, die Objekte dem Panel hinzufügt.
//adding Labels
Const.addComponent(panel, gbl, date, 0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, temperature, 0, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, ignoreTemp, 0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, time, 0, 3, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, cervical, 0, 4, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, cervicalMucus, 0, 5, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, sex, 0, 6, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, disturbingFactors, 0, 7, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, prevention, 0, 8, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, bleeding, 0, 9, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, middlePain, 0, 10, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, breastsymptom, 0, 11, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, notes, 0, 12, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, medicine, 0, 13, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, pregnancyTest, 0, 14, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, ovuTest, 0, 15, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
//adding input fields
Const.addComponent(panel, gbl, dateField, 1, 0, 3, 1, 0.0, 0.0,
GridBagConstraints.WEST);
//TempField
Const.addComponent(panel, gbl, tempPreComma, 1, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, comma, 2, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, tempAfterComma, 3, 1, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
//End TempField
Const.addComponent(panel, gbl, ignoreTempField, 1, 2, 3, 1, 0.0, 0.0,
GridBagConstraints.WEST);
//TimeField
Const.addComponent(panel, gbl, timeHourField, 1, 3, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, doublePoint, 2, 3, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
Const.addComponent(panel, gbl, timeMinuteField, 3, 3, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST);
//End TimeField
//ButtonPanel
Const.addComponent(panel, gbl, buttonPanel, 0, 16, 4, 1, 0.0, 0.0,
GridBagConstraints.CENTER);
this.add(panel);
}
Danke schonmal
Gruß
Borg