Indirection without abstraction - Snippet 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExportPanelForm { | |
private static final String EXPORTING = "Exporting"; | |
private static final String DOT = "."; | |
private JLabel exportingLabel; | |
public void updateExportingLabel() { | |
String newText = cycle(exportingLabel.getText(), 19); | |
exportingLabel.setText(newText); | |
} | |
public void showExporting() { | |
exportingLabel.setText(EXPORTING + DOT); | |
exportingLabel.setVisible(true); | |
} | |
private static String cycle(String currentText, int maxLength) { | |
return currentText.length() == maxLength | |
? EXPORTING + DOT | |
: currentText + DOT; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment