Created
March 20, 2018 06:26
-
-
Save ggalmazor/5bd3ace358b4f1827c8f04c0f4ef3ccf to your computer and use it in GitHub Desktop.
Indirection without abstraction - Snippet 3
This file contains hidden or 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