Dodano funkcję Random do wyświetlania notatki
This commit is contained in:
parent
9942897ae4
commit
64157eb74e
@ -1,18 +1,22 @@
|
|||||||
package com.example.notatkon.note;
|
package com.example.notatkon.note;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class Note {
|
public class Note {
|
||||||
private String noteTitle;
|
private String noteTitle;
|
||||||
private String noteContent;
|
private String noteContent;
|
||||||
|
|
||||||
// automatyczne dane do tablicy
|
// automatyczne dane do tablicy
|
||||||
private static String[] NoteTitles = { "Title1" };
|
private static String[] NoteTitles = { "Title1", "Lorem ipsum dolor sit amet, consectetur adipiscing elit" };
|
||||||
|
|
||||||
private static String[] NoteContents = { "Content1" };
|
private static String[] NoteContents = { "Content1", "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"" };
|
||||||
|
|
||||||
//konstruktor
|
//konstruktor
|
||||||
public Note() {
|
public Note() {
|
||||||
noteTitle = NoteTitles[0];
|
Random random = new Random();
|
||||||
noteContent = NoteContents[0];
|
|
||||||
|
noteTitle = NoteTitles[random.nextInt(NoteTitles.length)];
|
||||||
|
noteContent = NoteContents[random.nextInt(NoteContents.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNoteTitle() {
|
public String getNoteTitle() {
|
||||||
|
Loading…
Reference in New Issue
Block a user