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.

Ausgabe formatieren

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe gerade voll Black-Out!

Ich habe einen Doublewert (1234.56) der in ein Textfeld geschrieben werden soll.

Bisher habe ich es so:

double wert1 = temp6*2;

d_tf10.setText(String.valueOf(wert1));

nun soll aber die Ausgabe formatiert erfolgen, d.h. als Währung im Format 1.234,56

Wie mache ich das konkret am Beispiel? Irgendwas mit DecialFormat? Mit Parsen??

Bitte um kurze Hilfestellung

Falls du JDK1.4 verwendest, kannst du u.U. das JFormattedTextField verwenden - Beispiele gibt es genügend unter java.sun.com

Gruß

Snowghost

Richtig, das verwende ich auch als JFormatedTextField.

Allerdings gilt die Formatierung NICHT wenn man per

setText() dieses Feld füllt, da kann man beliebige Sachen eintragen. Die Validierung geschieht nur beim Verlassen des TextFeldes, da wird eine lostFocus Methode aufgerufen und der Inhalt des Feldes neu formatiert.

Hi,

ist nur einer Vermutung. Ich habs mir nicht weiter angesehen ob das Funzt. Aber es müßte doch einfach reichen die Update-Funktion selber aufzurufen nachdem du den Text mit setText() eingefügt hast.

Gruß

StarPrinZ

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.