Błąd "Cannot make a static reference to the non-static method" – jak go naprawić?

0

Witam! Mam taką funkcję:

	public void checkHour(){
		Pattern pat = Pattern.compile("\\d{2}:\\d{2}");
		Matcher mat = Pattern.matcher(mainTxtFld.getText());
		
		//mat.matches();
		
		
	}

I... Kompilator "daje" mi błąd: "Cannot make a static reference to the non-static method matcher(CharSequence) from the type Pattern"... Co mam zrobić? Jeśli potrzebny cały kod, to jest tu: https://pastebin.com/6MxR5ngF

2

matcher to metoda niestatyczna, który musi zostać uruchomiona na konkretnym obiekcie.

Pattern pat = Pattern.compile("\\d{2}:\\d{2}");
Matcher mat = pat.matcher(mainTxtFld.getText());

1 użytkowników online, w tym zalogowanych: 0, gości: 1