Last active
February 10, 2020 06:55
-
-
Save Aroueterra/bcec3b015b16a2487e255615b2a90731 to your computer and use it in GitHub Desktop.
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
//Bound to windowOpened event of jFrame | |
public void TutorialStuff() { | |
List<String> list = new ArrayList<>(); | |
// add 5 element in ArrayList | |
list.add("Input <NP> in the input pattern box to copy the name column values"); | |
list.add("Input <#> in the input pattern box to copy the name column values"); | |
list.add("Input <##> in the input pattern box to copy the name column values"); | |
list.add("Input <###> in the input pattern box to copy the name column values"); | |
list.add("Input <#####> in the input pattern box to copy the name column values"); | |
//Use java settings properties to save state between application use | |
//Reference: https://stackoverflow.com/questions/31127908/how-to-make-a-do-not-ask-me-again-dialog-pop-up-box-with-java | |
JCheckBox dontAskMeAgain = new JCheckBox("Leave me alone!"); | |
Object[] options1 = {dontAskMeAgain," Next Tip ", | |
" Close "}; | |
JPanel panel = new JPanel(); | |
Random r = new Random(); | |
int randomitem = r.nextInt(list.size()); | |
String randomElement = list.get(randomitem); | |
panel.add(new JLabel(randomElement)); | |
panel.add(dontAskMeAgain); | |
int result = JOptionPane.showOptionDialog(null, panel, "Tip of the day!", | |
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, | |
null, options1, null); | |
if (result == JOptionPane.NO_OPTION) { | |
//Action command / Listener stuff to change the label | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment