There is a stream in which objects are formed, these objects need to be written to the JList. Something I am stupid for a day with this moment function ConnectAndReadLine () forms match objects. these objects need to be written in the jlist

public class VoddsBotApp { public static void main(String[] args) { final Task task = new Task(); new Thread(task).start(); DefaultListModel<String> listModel = new DefaultListModel(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setSize(600, 400); final String START_TEXT = "Запустить"; final String PAUSE_TEXT = "Остановить"; frame.getContentPane().setLayout(new BorderLayout(0, 0)); JList jListMatches = new JList(listModel); JButton btnStartStop = new JButton(START_TEXT); btnStartStop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { task.changeThreadState(); JButton button = (JButton) e.getSource(); if (task.isRunning()) { button.setText(PAUSE_TEXT); } else { button.setText(START_TEXT); } } }); JScrollPane skrollPanel = new JScrollPane(jListMatches); JPanel listPanel = new JPanel(); listPanel.setLayout(new BorderLayout(0, 0)); listPanel.add(skrollPanel); frame.getContentPane().add(listPanel, BorderLayout.SOUTH); frame.setSize(550, 250); frame.setVisible(true); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BorderLayout(0, 0)); buttonPanel.add(btnStartStop); buttonPanel.add(btnStartStop); frame.getContentPane().add(buttonPanel, BorderLayout.NORTH); frame.setVisible(true); } }); } 

}

 class Task implements Runnable { private boolean isRunning = false; public static String id0 = null; public static String book0 = null; public static String country0 = null; public static String league0 = null; public static String hostguest0 = null; public static BigDecimal optotal0 = null; public static BigDecimal optb0 = null; public static BigDecimal optm0 = null; public static int oddId0; public static Long date0; public static String ptype0 = null; public static String oddId0Str = null; public static float optb; //setup the configuration file public void run() { while (!Thread.currentThread().isInterrupted()) { try { Thread.sleep(1000); System.out.println("Поток выполняется"); ConnectAndReadLine(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); continue; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } synchronized (this) { if (!isRunning) { System.out.println("Поток приостановлен"); while (!isRunning) { try { wait(); } catch (InterruptedException ex) { ex.printStackTrace(); } } System.out.println("Поток возобновил работу"); } } } } public synchronized void changeThreadState() { isRunning = !isRunning; notifyAll(); } public synchronized boolean isRunning() { return isRunning; } 

Blunted at the level: where to put it all.

    0