Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hi hi

Mal ne Frage, die mich schon seit längeremn beschäftigt.

Wenn ich 2 JFrames habe, ein Main und eines welches ich bei Auswahl einer bestimmten Option, im Main, aufrufe.

Das Main stellt Daten dar, in dem neu aufgetauchten Fenster sollen nun aber Änderungen am Main Fenster getätigt werden können. Sone Art "Option fürs MainFenster"

Mein Problem: Ich hab das zweite Fenster nun innerhalb des MainFensters instanziiert, wie kann ich nun auf die Attribute des Main fensters zugreifen ? Kann ja nur auf static Methoden zugreifen, aber das hilft mir ja nicht wirklich weiter, weil ich damit ja schlecht die Attribute eines bestimmten Objektes ändern kann.

Kurzform meines Problems:

Main ---> instanziiert GUI --> instanziiert Fenster

Fenster ---> soll GUI verändern

Dann übergibst du als Parameter einfach nen Verweis auf dein Main Fenster an dein zweites Fenster, und schon dann kann dein zweites Fenster auf dein Main Fenster zugreifen.

Beispiel:


public class Main extends JFrame {


	...


	public void showOptionGUI() {

		new OptionGUI(this);

	}


}



class OptionGUI  extends JFrame {

	private JFrame main = null;


	public OptionGUI (JFrame parent) {

		this.main = parent;

	}


	...


}

omg ich könnte mich selbst ohrfeigen :-O

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.