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.

frage zu object.setOpaque(boolean b)

Empfohlene Antworten

Veröffentlicht

was bewirkt eigentlich diese .setOpaque(...) genau ????

Also java.lang.Object.setOpaque(boolean B) bewirkt eigentlich nur eins: eine Compiler-Error - die gibt es nämlich nicht ;) .

Die Klasse java.awt.Component hat eine Methode isOpaque() die in der API folgendermaßen beschrieben ist:

isOpaque

public boolean isOpaque()Returns true if this component is completely opaque, returns false by default.

An opaque component paints every pixel within its rectangular region. A non-opaque component paints only some of its pixels, allowing the pixels underneath it to "show through". A component that does not fully paint its pixels therefore provides a degree of transparency. Only lightweight components can be transparent.

Subclasses that guarantee to always completely paint their contents should override this method and return true. All of the "heavyweight" AWT components are opaque.

Returns:

true if this component is completely opaque

Since:

1.2

Viele Subclasses von java.awt.Component bieten die Methode setOpaque(boolean), um diese Eigenschaft zu Manipulieren. Eine Subclass wäre zum Beispiel die javax.swing.JComponent deren Api Beschreibung so aussieht

setOpaque

public void setOpaque(boolean isOpaque)If true the component paints every pixel within its bounds. Otherwise, the component may not paint some or all of its pixels, allowing the underlying pixels to show through.

The default value of this property is false for JComponent. However, the default value for this property on most standard JComponent subclasses (such as JButton and JTree) is look-and-feel dependent.

Parameters:

isOpaque - true if this component should be opaque

Die gesamte Api-Dokumentation ALLER SUN-Java Klassen und deren Methoden findest du unter http://java.sun.com/j2se/1.4.1/docs/api/

Gruß

Mirko

die Java-docs habe ich auch.

sie sagen mir aber in diesem speziellen fall irgendwie nichts.

ok. Kurz gesagt: der Hintergrund schimmert durch, oder eben nicht.

Ausprobieren kannst du es zum Beispiel, in dem du mal zwei JLabels auf ein Panel setzt. Dem Panel gibst du irgendeine andere Hintergrundfarbe. Das eine Label setzt du setOpaque(true) und beim anderen setOpaque(false).

Gruß

Mirko

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.