1 19 package org.netbeans.modules.refactoring.spi.impl; 20 21 import java.awt.*; 22 import java.awt.event.*; 23 import java.io.IOException ; 24 import java.util.ArrayList ; 25 import java.util.Iterator ; 26 import javax.swing.*; 27 import javax.swing.border.EmptyBorder ; 28 import javax.swing.event.ChangeEvent ; 29 import javax.swing.event.ChangeListener ; 30 import org.netbeans.api.javahelp.Help; 31 import org.netbeans.api.progress.ProgressHandle; 32 import org.netbeans.api.progress.ProgressHandleFactory; 33 import org.netbeans.modules.refactoring.api.AbstractRefactoring; 34 import org.netbeans.modules.refactoring.api.Problem; 35 import org.netbeans.modules.refactoring.api.ProblemDetails; 36 import org.netbeans.modules.refactoring.api.RefactoringSession; 37 import org.netbeans.modules.refactoring.spi.impl.UndoWatcher; 38 import org.netbeans.modules.refactoring.spi.ui.*; 39 import org.openide.DialogDescriptor; 40 import org.openide.DialogDisplayer; 41 import org.openide.ErrorManager; 42 import org.openide.util.*; 43 import org.netbeans.modules.refactoring.api.ProgressListener; 44 import org.netbeans.modules.refactoring.api.ProgressEvent; 45 import org.netbeans.modules.refactoring.spi.impl.ProblemComponent.CallbackAction; 46 import org.openide.awt.Mnemonics; 47 48 49 60 public class ParametersPanel extends JPanel implements ProgressListener, ChangeListener , InvalidationListener { 61 private RefactoringSession result; 63 64 private final RefactoringUI rui; 66 private final JPanel customPanel; 68 private final CustomRefactoringPanel customComponent; 69 70 private transient JDialog dialog = null; 72 private ArrayList components = null; 74 75 private Problem problem; 76 77 private ErrorPanel errorPanel; 78 79 private final int PRE_CHECK = 0; 80 private final int INPUT_PARAMETERS = 1; 81 private final int POST_CHECK = 2; 82 private final int PROBLEM = 3; 83 private final int CHECK_PARAMETERS = 4; 84 85 private transient int currentState = INPUT_PARAMETERS; 86 87 private boolean cancelRequest = false; 88 89 96 public void setPreviewEnabled(boolean enabled) { 97 RefactoringPanel.checkEventThread(); 98 next.setEnabled(enabled); 99 } 100 101 104 public ParametersPanel(RefactoringUI rui) { 105 RefactoringPanel.checkEventThread(); 106 this.rui = rui; 107 initComponents(); 108 innerPanel.setBorder(null); 109 label.setText(" "); this.customComponent = rui.getPanel(this); 111 if (this.customComponent!=null) { 112 this.customPanel = (JPanel) this.customComponent.getComponent(); 113 } else { 114 customPanel = null; 115 } 116 errorPanel = new ErrorPanel(rui); 117 calculatePrefferedSize(); 118 setButtonsEnabled(false); 119 } 121 122 123 private void calculatePrefferedSize() { 124 Dimension cpDim = new Dimension(0,0); 125 Dimension ppDim = progressPanel.getPreferredSize(); 126 Dimension epDim = new Dimension(0,0); 127 if (customPanel != null) { 128 cpDim = customPanel.getPreferredSize(); 129 } 130 if (errorPanel != null) { 131 epDim = errorPanel.getPreferredSize(); 132 } 133 134 setPreferredSize(new Dimension(Math.max(Math.max(cpDim.width, ppDim.width),epDim.width) , Math.max(cpDim.height, epDim.height) + ppDim.height)); 135 if (dialog != null && rui.isQuery()) { 137 dialog.setSize(getPreferredSize()); 138 } 139 } 140 141 146 private void initComponents() { 148 149 progressPanel = new javax.swing.JPanel (); 150 innerPanel = new javax.swing.JPanel (); 151 label = new javax.swing.JLabel (); 152 controlsPanel = new javax.swing.JPanel (); 153 buttonsPanel = new javax.swing.JPanel (); 154 back = new javax.swing.JButton (); 155 previewButton = new javax.swing.JButton (); 156 previewButton.setVisible(false); 157 next = new javax.swing.JButton (); 158 cancel = new javax.swing.JButton (); 159 help = new javax.swing.JButton (); 160 containerPanel = new javax.swing.JPanel (); 161 pleaseWait = new javax.swing.JLabel (); 162 163 setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 164 java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/refactoring/spi/impl/Bundle"); setName(bundle.getString("LBL_FindUsagesDialog")); setLayout(new java.awt.BorderLayout ()); 167 168 progressPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 12, 0, 11)); 169 progressPanel.setOpaque(false); 170 progressPanel.setLayout(new java.awt.BorderLayout ()); 171 172 innerPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color (128, 128, 128))); 173 innerPanel.setLayout(new java.awt.BorderLayout ()); 174 175 label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); 176 innerPanel.add(label, java.awt.BorderLayout.WEST); 177 178 progressPanel.add(innerPanel, java.awt.BorderLayout.CENTER); 179 180 controlsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 0, 5, 0)); 181 controlsPanel.setLayout(new java.awt.BorderLayout ()); 182 183 buttonsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 184 buttonsPanel.setLayout(new java.awt.GridLayout (1, 0, 4, 0)); 185 186 back.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/refactoring/spi/impl/Bundle").getString("MNEM_Back").charAt(0)); 187 org.openide.awt.Mnemonics.setLocalizedText(back, org.openide.util.NbBundle.getBundle("org/netbeans/modules/refactoring/spi/impl/Bundle").getString("CTL_Back")); back.addActionListener(new java.awt.event.ActionListener () { 189 public void actionPerformed(java.awt.event.ActionEvent evt) { 190 backActionPerformed(evt); 191 } 192 }); 193 buttonsPanel.add(back); 194 back.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Back")); 196 previewButton.setMnemonic(org.openide.util.NbBundle.getMessage(ParametersPanel.class, "MNEM_Preview").charAt(0)); 197 previewButton.setLabel(org.openide.util.NbBundle.getMessage(ParametersPanel.class, "CTL_PreviewAll")); previewButton.addActionListener(new java.awt.event.ActionListener () { 199 public void actionPerformed(java.awt.event.ActionEvent evt) { 200 preview(evt); 201 } 202 }); 203 buttonsPanel.add(previewButton); 204 205 org.openide.awt.Mnemonics.setLocalizedText(next, org.openide.util.NbBundle.getBundle("org/netbeans/modules/refactoring/spi/impl/Bundle").getString("CTL_Finish")); next.addActionListener(new java.awt.event.ActionListener () { 207 public void actionPerformed(java.awt.event.ActionEvent evt) { 208 refactor(evt); 209 } 210 }); 211 buttonsPanel.add(next); 212 next.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_finish")); 214 org.openide.awt.Mnemonics.setLocalizedText(cancel, org.openide.util.NbBundle.getBundle("org/netbeans/modules/refactoring/spi/impl/Bundle").getString("CTL_Cancel")); cancel.addActionListener(new java.awt.event.ActionListener () { 216 public void actionPerformed(java.awt.event.ActionEvent evt) { 217 cancelActionPerformed(evt); 218 } 219 }); 220 buttonsPanel.add(cancel); 221 cancel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_cancel")); 223 org.openide.awt.Mnemonics.setLocalizedText(help, org.openide.util.NbBundle.getBundle("org/netbeans/modules/refactoring/spi/impl/Bundle").getString("CTL_Help")); help.addActionListener(new java.awt.event.ActionListener () { 225 public void actionPerformed(java.awt.event.ActionEvent evt) { 226 helpActionPerformed(evt); 227 } 228 }); 229 buttonsPanel.add(help); 230 help.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_help")); 232 controlsPanel.add(buttonsPanel, java.awt.BorderLayout.EAST); 233 234 progressPanel.add(controlsPanel, java.awt.BorderLayout.SOUTH); 235 236 add(progressPanel, java.awt.BorderLayout.SOUTH); 237 238 containerPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 239 containerPanel.setLayout(new java.awt.BorderLayout ()); 240 241 pleaseWait.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); 242 org.openide.awt.Mnemonics.setLocalizedText(pleaseWait, org.openide.util.NbBundle.getBundle("org/netbeans/modules/refactoring/spi/impl/Bundle").getString("LBL_PleaseWait")); containerPanel.add(pleaseWait, java.awt.BorderLayout.CENTER); 244 pleaseWait.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(ParametersPanel.class, "LBL_PleaseWait")); 246 add(containerPanel, java.awt.BorderLayout.CENTER); 247 248 getAccessibleContext().setAccessibleName(bundle.getString("LBL_FindUsagesDialog")); getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_FindUsagesDialog")); } 252 private void preview(java.awt.event.ActionEvent evt) { refactor(true); 254 } 256 private void helpActionPerformed(java.awt.event.ActionEvent evt) { Help help = (Help) Lookup.getDefault().lookup(Help.class); 258 help.showHelp(getHelpCtx()); 259 } 261 private void backActionPerformed(java.awt.event.ActionEvent evt) { placeCustomPanel(); 263 } 265 private void cancelActionPerformed(java.awt.event.ActionEvent evt) { synchronized (this) { 267 rui.getRefactoring().cancelRequest(); 268 result = null; 269 dialog.setVisible(false); 270 cancelRequest = true; 271 } 272 } private void refactor(final boolean previewAll) { 274 if (currentState == PRE_CHECK) { 275 placeCustomPanel(); 277 return; 278 } 279 280 if (currentState == PROBLEM && previewAll) { 281 Cancellable doCloseParent = new Cancellable() { 282 public boolean cancel() { 283 cancelActionPerformed(null); 284 return true; 285 } 286 }; 287 currentProblemAction.showDetails(new CallbackAction(rui), doCloseParent); 288 return; 289 } 290 291 293 setPanelEnabled(false); 294 cancel.setEnabled(true); 295 296 RequestProcessor rp = new RequestProcessor(); 297 final int inputState = currentState; 298 299 if (currentState != PRE_CHECK) { 300 if (rui instanceof RefactoringUIBypass && ((RefactoringUIBypass) rui).isRefactoringBypassRequired()) { 301 try{ 302 ((RefactoringUIBypass)rui).doRefactoringBypass(); 303 } catch (final IOException ioe) { 304 currentState = POST_CHECK; 305 SwingUtilities.invokeLater(new Runnable () { 306 public void run() { 307 placeErrorPanel(new Problem(true, ioe.getMessage())); 308 }}); 309 } finally { 310 if (inputState == currentState) { 311 setVisibleLater(false); 312 } 313 return; 314 } 315 } else if (currentState != POST_CHECK && currentState != CHECK_PARAMETERS) { 316 result = RefactoringSession.create(rui.getName()); 317 rp.post(new Prepare()); 319 } else if(currentState == CHECK_PARAMETERS) { 320 rp.post(new Prepare()); 321 } 322 } 323 324 326 rp.post(new Runnable () { 327 public void run() { 328 if (inputState == currentState) { 330 try { 331 if (!previewAll) { 332 UndoWatcher.watch(result, ParametersPanel.this); 333 result.addProgressListener(ParametersPanel.this); 334 result.doRefactoring(true); 335 UndoWatcher.stopWatching(ParametersPanel.this); 336 } 337 } finally { 338 if (!previewAll) { 339 result = null; 340 } 341 if (inputState == currentState) { 342 setVisibleLater(false); 343 } 344 } 345 } 346 } 347 }); 348 } 349 350 private void refactor(java.awt.event.ActionEvent evt) { refactor(rui.isQuery()); 352 } 354 355 private javax.swing.JButton back; 357 private javax.swing.JPanel buttonsPanel; 358 public javax.swing.JButton cancel; 359 private javax.swing.JPanel containerPanel; 360 private javax.swing.JPanel controlsPanel; 361 private javax.swing.JButton help; 362 private javax.swing.JPanel innerPanel; 363 private javax.swing.JLabel label; 364 private javax.swing.JButton next; 365 private javax.swing.JLabel pleaseWait; 366 private javax.swing.JButton previewButton; 367 private javax.swing.JPanel progressPanel; 368 370 373 private void setVisibleLater(final boolean visible) { 374 SwingUtilities.invokeLater(new Runnable () { 375 public void run() { 376 dialog.setVisible(visible); 377 } 378 }); 379 } 380 381 private void setPanelEnabled(boolean enabled) { 383 RefactoringPanel.checkEventThread(); 384 setButtonsEnabled(enabled); 385 if (enabled) { 386 if (components == null) return; 387 for (Iterator it = components.iterator(); it.hasNext();) { 388 ((Component) it.next()).setEnabled(true); 389 } 390 components = null; 391 } else { 392 if (components != null) return; 393 components = new ArrayList (); 394 disableComponents(customPanel); 395 } 396 } 397 398 private void disableComponents(Container c) { 400 RefactoringPanel.checkEventThread(); 401 Component children[] = c.getComponents(); 402 for (int i = 0; i < children.length; i++) { 403 if (children[i].isEnabled()) { 404 children[i].setEnabled(false); 405 components.add(children[i]); 406 } 407 if (children[i] instanceof Container) { 408 disableComponents((Container) children[i]); 409 } 410 } 411 } 412 413 419 public synchronized RefactoringSession showDialog() { 420 RefactoringPanel.checkEventThread(); 421 if (rui != null) { 422 rui.getRefactoring().addProgressListener(this); 423 } 424 String title = (customPanel != null && customPanel.getName()!=null && !"".equals(customPanel.getName()))?customPanel.getName() : rui.getName(); 425 DialogDescriptor descriptor = new DialogDescriptor(this, title, true, new Object []{}, null, 0, null, null); 426 427 dialog = (JDialog) DialogDisplayer.getDefault().createDialog(descriptor); 428 dialog.validate(); 429 if (customPanel!=null) { 430 dialog.getAccessibleContext().setAccessibleName(rui.getName()); 431 dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ParametersPanel.class, "ACSD_FindUsagesDialog")); 432 } 433 434 setCancelStuff(); 435 436 dialog.pack(); 437 438 RequestProcessor.Task task = RequestProcessor.getDefault().post(new Runnable () { 439 public void run() { 440 try { 441 problem = rui.getRefactoring().preCheck(); 442 } catch (RuntimeException e) { 443 setVisibleLater(false); 444 throw e; 445 } 446 if (problem != null) { 447 currentState = PRE_CHECK; 448 if (!problem.isFatal()) { 449 customComponent.initialize(); 450 } 451 SwingUtilities.invokeLater(new Runnable () { 452 public void run() { 453 placeErrorPanel(problem); 454 dialog.setVisible(true); 455 } 456 }); 457 } else { 458 if (customPanel != null) 459 customComponent.initialize(); 460 SwingUtilities.invokeLater(new Runnable () { 461 public void run() { 462 placeCustomPanel(); 463 } 464 }); 465 if (!rui.hasParameters()) { 466 result = RefactoringSession.create(rui.getName()); 467 try { 468 rui.getRefactoring().prepare(result); 469 } finally { 470 setVisibleLater(false); 471 } 472 } 473 474 } 475 } 476 }); 477 478 dialog.setVisible(true); 479 dialog.dispose(); 480 481 if (rui != null) { 482 rui.getRefactoring().removeProgressListener(this); 483 } 484 if (!cancelRequest) 485 task.waitFinished(); 486 return result; 487 } 488 489 private final void setCancelStuff() { 490 KeyStroke k = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); 491 Object actionKey = "cancel"; getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(k, actionKey); 493 Action cancelAction = new AbstractAction() { 494 public void actionPerformed(ActionEvent ev) { 495 if (cancel.isEnabled()) 496 cancelActionPerformed(ev); 497 } 498 }; 499 500 getRootPane().getActionMap().put(actionKey, cancelAction); 501 502 dialog.addWindowListener(new WindowAdapter() { 503 public void windowClosing(WindowEvent evt) { 504 if (cancel.isEnabled()) 505 cancelActionPerformed(null); 506 } 507 }); 508 } 509 510 private ProblemDetails getDetails(Problem problem) { 511 if (problem.getNext()==null) { 512 return problem.getDetails(); 513 } 514 return null; 515 } 516 private ProblemDetails currentProblemAction; 517 private void placeErrorPanel(Problem problem) { 518 containerPanel.removeAll(); 519 errorPanel = new ErrorPanel(problem, rui); 520 errorPanel.setBorder(new EmptyBorder (new Insets(12, 12, 11, 11))); 521 containerPanel.add(errorPanel, BorderLayout.CENTER); 522 523 next.setEnabled(!problem.isFatal()); 524 dialog.getRootPane().setDefaultButton(next); 525 if (currentState == PRE_CHECK ) { 526 Mnemonics.setLocalizedText(next, NbBundle.getMessage(ParametersPanel.class,"CTL_Next")); 528 back.setVisible(false); 529 } else { 530 ProblemDetails details = getDetails(problem); 531 if (details!=null) { 532 currentState=PROBLEM; 533 Mnemonics.setLocalizedText(previewButton, details.getDetailsHint()); 534 previewButton.setVisible(true); 535 previewButton.setEnabled(true); 536 currentProblemAction = details; 537 } 538 back.setVisible(true); 539 back.setEnabled(true); 540 dialog.getRootPane().setDefaultButton(back); 541 } 542 cancel.setEnabled(true); 543 previewButton.setEnabled(!problem.isFatal()); 544 repaint(); 545 } 546 547 private void placeCustomPanel() { 548 if (customPanel == null) return; 549 Mnemonics.setLocalizedText(next, NbBundle.getMessage(ParametersPanel.class, rui.isQuery()?"CTL_Find": "CTL_Finish")); 550 Mnemonics.setLocalizedText(previewButton, NbBundle.getMessage(ParametersPanel.class, "CTL_PreviewAll")); 551 customPanel.setBorder(new EmptyBorder (new Insets(12, 12, 11, 11))); 552 containerPanel.removeAll(); 553 containerPanel.add(customPanel, BorderLayout.CENTER); 554 back.setVisible(false); 555 previewButton.setVisible(!rui.isQuery()); 556 currentState = INPUT_PARAMETERS; 557 setPanelEnabled(true); 558 cancel.setEnabled(true); 559 dialog.getRootPane().setDefaultButton(next); 560 customPanel.requestFocus(); 563 repaint(); 564 } 565 566 private ProgressBar progressBar; 567 private ProgressHandle progressHandle; 568 private boolean isIndeterminate; 569 570 574 public void start(final ProgressEvent event) { 575 SwingUtilities.invokeLater(new Runnable () { 576 public void run() { 577 progressPanel.remove(innerPanel); 578 progressBar = ProgressBar.create(progressHandle = ProgressHandleFactory.createHandle("")); progressPanel.add(progressBar, BorderLayout.CENTER); 580 if (event.getCount()==-1) { 582 isIndeterminate = true; 583 progressHandle.start(); 584 progressHandle.switchToIndeterminate(); 585 } else { 586 isIndeterminate = false; 587 progressHandle.start(event.getCount()); 588 } 589 590 String text; 591 switch (event.getOperationType()) { 592 case AbstractRefactoring.PARAMETERS_CHECK: 593 text = NbBundle.getMessage(ParametersPanel.class, "LBL_ParametersCheck"); 594 break; 595 case AbstractRefactoring.PREPARE: 596 text = NbBundle.getMessage(ParametersPanel.class, "LBL_Prepare"); 597 break; 598 case AbstractRefactoring.PRE_CHECK: 599 text = NbBundle.getMessage(ParametersPanel.class, "LBL_PreCheck"); 600 break; 601 default: 602 text = NbBundle.getMessage(ParametersPanel.class, "LBL_Usages"); 603 break; 604 } 605 progressBar.setString(text); 607 progressPanel.setVisible(true); 608 609 setButtonsEnabled(false); 610 } 611 }); 612 } 613 614 618 public void step(final ProgressEvent event) { 619 SwingUtilities.invokeLater(new Runnable () { 620 public void run() { 621 try { 622 progressHandle.progress(isIndeterminate ? -2 : event.getCount()); 623 } catch (Throwable e) { 624 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); 625 } 626 } 627 }); 628 } 629 630 634 public void stop(ProgressEvent event) { 635 SwingUtilities.invokeLater(new Runnable () { 636 public void run() { 637 progressHandle.finish(); 638 progressPanel.remove(progressBar); 639 progressPanel.add(innerPanel, BorderLayout.CENTER); 640 } 644 }); 645 } 646 647 public void stateChanged(ChangeEvent e) { 648 showProblem(rui.checkParameters()); 649 } 650 651 private void showProblem(Problem problem) { 652 if (problem == null) { 653 label.setText(" "); innerPanel.setBorder(null); 655 next.setEnabled(true); 656 previewButton.setEnabled(true); 657 return; 658 } 659 innerPanel.setBorder(new javax.swing.border.LineBorder (java.awt.Color.gray)); 660 progressPanel.setVisible(true); 661 if (problem.isFatal()) { 662 displayError(problem.getMessage()); 663 } else { 664 displayWarning(problem.getMessage()); 665 } 666 } 667 668 private void displayError(String error) { 669 next.setEnabled(false); 670 previewButton.setEnabled(false); 671 label.setText("<html><font color=\"red\">" + NbBundle.getMessage(ParametersPanel.class, "LBL_Error") + ": </font>" + error + "</html>"); } 673 674 private void displayWarning(String warning) { 675 next.setEnabled(true); 676 previewButton.setEnabled(true); 677 label.setText("<html><font color=\"red\">" + NbBundle.getMessage(ParametersPanel.class, "LBL_Warning") + ": </font>" + warning + "</html>"); } 679 680 private class Prepare implements Runnable { 681 public void run() { 682 if (currentState != POST_CHECK && currentState != CHECK_PARAMETERS) { 683 problem = rui.setParameters(); 684 if (problem != null) { 685 currentState = CHECK_PARAMETERS; 686 try { 687 SwingUtilities.invokeAndWait(new Runnable () { 688 public void run() { 689 placeErrorPanel(problem); 690 }}); 691 } catch (Exception ie) { 692 throw (RuntimeException ) new RuntimeException ().initCause(ie); 693 } 694 return; 695 } 696 } 697 698 try { 699 problem = rui.getRefactoring().prepare(result); 700 } catch (RuntimeException e) { 701 setVisibleLater(false); 702 throw e; 703 } 704 705 if (problem != null) { 706 currentState = POST_CHECK; 707 SwingUtilities.invokeLater(new Runnable () { 708 public void run() { 709 placeErrorPanel(problem); 710 }}); 711 } 712 } 713 } 714 715 private void setButtonsEnabled(boolean enabled) { 716 next.setEnabled(enabled); 717 back.setEnabled(enabled); 719 previewButton.setEnabled(enabled); 720 } 721 722 public HelpCtx getHelpCtx() { 723 return rui.getHelpCtx(); 724 } 725 726 public void invalidateObject() { 727 } 728 729 private static class ProgressBar extends JPanel { 730 731 private JLabel label; 732 733 private static ProgressBar create(ProgressHandle handle) { 734 ProgressBar instance = new ProgressBar(); 735 instance.setLayout(new BorderLayout()); 736 instance.label = new JLabel(); 737 instance.label.setBorder(new EmptyBorder (0, 0, 2, 0)); 738 instance.add(instance.label, BorderLayout.NORTH); 739 JComponent progress = ProgressHandleFactory.createProgressComponent(handle); 740 instance.add(progress, BorderLayout.CENTER); 741 return instance; 742 } 743 744 public void setString(String value) { 745 label.setText(value); 746 } 747 748 private ProgressBar() { 749 } 750 751 } 752 753 } 754 | Popular Tags |