JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Listeners and event interfaces

    JAVA 25 SELF
    50 level,0 lecture
    How the event model works in Java: a source generates an event, and subscribed listeners receive a notification and react. We will examine the key Swing listener interfaces — ActionListener, MouseListener, KeyListener, ChangeListener, DocumentListener — and show how to register handlers via addActionListener and implement the actionPerformed method. We will practice attaching listeners to JButton/ JFrame, compare anonymous classes and lambda expressions, and discuss common mistakes and practical tips.
    Open
  • Events in Swing and AWT: basics, examples

    JAVA 25 SELF
    50 level,1 lecture
    A brief hands-on introduction to the AWT/ Swing event model: we create a JButton, register a listener via addActionListener, and handle it in actionPerformed. We examine anonymous classes and lambda expressions, popular listeners ( MouseListener/ MouseAdapter, KeyAdapter, DocumentListener), build a mini application based on JFrame, JButton, JLabel, look at the call sequence and common mistakes (heavy work in a handler, variable finality in lambdas, a forgotten addActionListener, removing listeners, using SwingWorker).
    Open
  • Creating and handling custom events

    JAVA 25 SELF
    50 level,2 lecture
    In this lecture, we examine how to design custom events in Java: create an event class based on java.util.EventObject, define a listener interface via java.util.EventListener, add a subscribe/unsubscribe mechanism ( add...Listener/ remove...Listener) and notifications ( fire...). We’ll look at practical examples with DataLoader and a counter, discuss handlers with anonymous classes and lambda expressions, and also cover common mistakes (exceptions in listeners, memory leaks, ConcurrentModificationException).
    Open
  • Observer pattern

    JAVA 25 SELF
    50 level,3 lecture
    Behavioral pattern “Observer”: roles Subject and Observer, subscribe/unsubscribe via addObserver/ removeObserver, and notification broadcasting with notifyObservers. We examine its connection to Java’s event model: button. addActionListener( listener) ; → call to actionPerformed(). Hands-on examples (thermometer and air conditioner, mini counter and lambdas), and also why java.util.Observable/ Observer are deprecated and what modern approaches exist.
    Open
  • EDT thread and long-running operations in the UI

    JAVA 25 SELF
    50 level,4 lecture
    In this lecture, we break down what the UI event-processing thread — EDT in Swing and its counterpart JavaFX Application Thread — is, why UI components are not thread-safe, and why the window “freezes” during heavy tasks. We will show the correct techniques: offloading computations to the background via new Thread(...), updating the UI using SwingUtilities.invokeLater and Platform.runLater, as well as using high-level tools like SwingWorker<T, V> and Task<V>/ Service<V> for progress, cancellation, and error handling.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy