GithubHelp home page GithubHelp logo

Comments (3)

weisJ avatar weisJ commented on August 21, 2024

What listeners exactly are you installing?

from darklaf.

Gegenbauer avatar Gegenbauer commented on August 21, 2024

All listeners will not work after ui changed, because the editorComponent you interact with was a new instance.

For example, add focus listener on ComboBoxDemo in darklaf
image

And after new theme applied, the focusListener will not work. I added new listener after theme changed as a work around, but it's not elegant.

from darklaf.

weisJ avatar weisJ commented on August 21, 2024

Applying existing listeners to the new component cannot be done easily as there are also several other listeners installed by swing itself, which cannot be discerned from user provided listeners. I see two possible options here:

  • If you don't want the component to change provide your own ComboBoxEditor, which doesn't implement UIResource, which results in it being reinstalled after the laf changes. Any objects which are UIResources are allowed to be pulled away from you by the LaF at any point. Don't depend on them to preserve any state between LaF changes.
    Though I recommend the following:
  • Any visual related listeners should be installed in JComponent#updateUI and be contained in a custom class. This ensures that they are installed after the LaF changes.

from darklaf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.