Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

StepInstall.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (c) 2006-2011 Chris Smith, Shane Mc Cormack, Gregory Holmes
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package com.dmdirc.installer.ui;
  23. import com.dmdirc.installer.TextStep;
  24. import java.awt.BorderLayout;
  25. import java.awt.Image;
  26. import java.awt.Insets;
  27. import javax.swing.JScrollPane;
  28. import javax.swing.SwingUtilities;
  29. /**
  30. * This confirms the settings chosen in the previous step
  31. */
  32. public final class StepInstall extends SwingStep implements TextStep {
  33. /**
  34. * A version number for this class. It should be changed whenever the class
  35. * structure is changed (or anything else that would prevent serialized
  36. * objects being unserialized with the new class).
  37. */
  38. private static final long serialVersionUID = 2;
  39. /** Text area showing the install information */
  40. private final TextLabel infoLabel = new TextLabel("Beginning Install");
  41. /** Scroll pane holding text area */
  42. final JScrollPane scrollPane;
  43. /**
  44. * Creates a new instance of StepInstall.
  45. */
  46. public StepInstall() {
  47. super();
  48. setLayout(new BorderLayout());
  49. scrollPane = new JScrollPane(infoLabel,
  50. JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
  51. JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  52. infoLabel.setMargin(new Insets(5, 5, 5, 5));
  53. add(scrollPane, BorderLayout.CENTER);
  54. }
  55. /** {@inheritDoc} */
  56. @Override
  57. public String getStepName() {
  58. return "Install";
  59. }
  60. /** {@inheritDoc} */
  61. @Override
  62. public Image getIcon() {
  63. return null;
  64. }
  65. /** {@inheritDoc} */
  66. @Override
  67. public String getStepDescription() {
  68. return "";
  69. }
  70. /** {@inheritDoc} */
  71. @Override
  72. public synchronized void addText(final String text) {
  73. SwingUtilities.invokeLater(new Runnable() {
  74. @Override
  75. public void run() {
  76. infoLabel.setText(infoLabel.getText() + text + "\n");
  77. }
  78. });
  79. }
  80. /** {@inheritDoc} */
  81. @Override
  82. public synchronized void setText(final String text) {
  83. SwingUtilities.invokeLater(new Runnable() {
  84. @Override
  85. public void run() {
  86. infoLabel.setText(text);
  87. }
  88. });
  89. }
  90. }