There is an archive in which there are about two thousand svg-files. My task is to create a format list [ΠΠΊΠΎΠ½ΠΊΠ°] ΠΠΌΡ svg Π² Π°ΡΡ
ΠΈΠ²Π΅ . I use the Apache Batik library to work with svg. When decoding only one icon in the main stream, the interface noticeably hangs (and generally working with files in the main stream is bad practice), so I decided to decode asynchronously, but after executing the code, the icon in the list does not appear. Please tell me where I was wrong and what needs to be fixed for the icon to appear? The code contains crutches (the result of the transition from Java for Android to Java for PC), but, nevertheless, I tried to comment it well. Thanks in advance for your help!
Everything starts here, in UserInterface.class , where the list is populated:
// ΠΠ±Π½ΠΎΠ²Π»ΡΠ΅Ρ ΡΠΏΠΈΡΠΎΠΊ ΠΈΠΊΠΎΠ½ΠΎΠΊ. private void reloadIcons() { // ... // ΠΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° ΠΈΠΊΠΎΠ½ΠΎΠΊ Π² ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΈ. DefaultListModel<String> mGetNewIconsListModel = new DefaultListModel<String>(); try { // ΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° ΡΠ°ΠΉΠ»ΠΎΠ² Π² Π°ΡΡ
ΠΈΠ²Π΅. ZipFile mRepository = new ZipFile(new File(Constants.FILE_DATABASE)); Main.mRepositoryIcons = Utilities.getRepositoryIcons(mRepository); for (String mSvg : Main.mRepositoryIcons) mGetNewIconsListModel.addElement(mSvg); } catch (IOException mException) { mException.printStackTrace(); } // Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° ΠΎΡΡΠΈΡΠΎΠ²ΡΠΈΠΊΠ° ΡΠ»Π΅ΠΌΠ΅Π½ΡΠΎΠ² ΡΠΏΠΈΡΠΊΠ°. mGetNewIconsList.setCellRenderer(new GetNewIconsListRenderer()); // Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Π·Π½Π°ΡΠ΅Π½ΠΈΠΉ Π² ΡΠΏΠΈΡΠΎΠΊ. mGetNewIconsList.setModel(mGetNewIconsListModel); } GetNewIconsListRenderer.class list item renderer : Pastebin
Asynchronous loader SvgDecoder.class : Pastebin