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.

jtextarea - wichtig!

Empfohlene Antworten

hallo,

meine jtextarea soll jedesmal wieder nach oben scrollen!

aber nachdem ich einmal ganz unten war, bleibt sie auch unten. ich muesste also ejdesmal wieder von hand nach oben.. dies soll automatisch passieren

danke :)

jta.setCaretPosition(0);

das geht aber nicht, der bleibt trotzdem ganz unten! ;(

Also folgender Code funktioniert einwandfrei:


public class Test {


  public static void main(String[] args) throws Exception {


    final JTextArea area      = new JTextArea("Beispieltext");


    final JButton button      = new JButton(new AbstractAction("Nach oben") {

      public void actionPerformed(ActionEvent e) {

        area.setCaretPosition(0);

      }

    });


    final JPanel panel        = new JPanel(new BorderLayout());

    panel.add(new JScrollPane(area), BorderLayout.CENTER);

    panel.add(button, BorderLayout.SOUTH);


    final JFrame frame        = new JFrame();

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setBounds(10, 10, 200, 200);

    frame.setContentPane(panel);

    frame.setVisible(true);


  }

Rufst du setCarePosition aus dem EventDispatcherThread oder einem eigenen Thread auf? Evtl. manuell im EventDispatcherThread ausführen lassen

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.