Se ho capito cosa mi hai detto, ho modificato come segue:
Sembra che funzioni, ma non visualizzo la progressBar.codice:public ProgressBar_JFrame() { initComponents(); progressBar.setMinimum(0); progressBar.setMaximum(100); progressBar.setValue(0); updateContactsJTable(); progressBar.setValue(100); //Call setStringPainted now so that the progress bar height //stays the same whether or not the string is shown. progressBar.setStringPainted(true); task = new Task(); task.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { int progress = (Integer) evt.getNewValue(); progressBar.setIndeterminate(false); progressBar.setValue(progress); } } }); task.execute(); }
Infatti nella classe dove c'è il bottone, da cui parte tutto, ho scritto questo:
Cosa manca?codice:private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) { setCursor(new Cursor(Cursor.WAIT_CURSOR)); ProgressBar_JFrame progressBar1 = new ProgressBar_JFrame(); refreshContactsJTable(); if (progressBar1.updateContactsJTable() == false){ .... } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }

Rispondi quotando