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.

Anwendung auf Bildschirm zentrieren?

Empfohlene Antworten

Veröffentlicht

Hi,

ich habe eine Anwendung programmiert. Wenn ich diese nun starte, erscheint mein GUI-Fenster immer in der linken oberen Ecke. Wie kann ich sagen, daß das Fenster immer in der Mitte des Bildschirms geöffnet werden soll??

Gruß Snopsy

Mit setLocation(int x, int y) kannst du die Linke Obere Ecke deines Fensters definieren.

Ich habe es wie folgt gelöst

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

setSize(dim.width / 3, dim.height / 3);

setLocation(dim.width / 3, dim.height / 3);

dim ist also die BildschirmGröße mit deren Hilfe ich das Fenster 1/3 des Fenster groß mache (mit setSize(...)) und dann das Fenster an 1/3 des Bildschirms plaziere (mit setLocation(...)).

Vermutlich ist dein Fenster nicht genau 1/3 so gross wie der Bildschirm ... mit public Dimension getSize() bekommst du die aktuelle Größe deines Fensters.

Ich hoffe, dass hilft dir weiter...

MfG

Dalton

Hi,

ja, das war genau das was ich wollte. HAt mir seh weitergeholfen. :)

Cu SNopsy

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.