java - Error message doesn't display correctly -



java - Error message doesn't display correctly -

i'm trying create dialog display error message whenever create wrong move in scrabble game. in problem.java, create this

class problem { problem(string s) { message = s; } }

so write code display warning :

void displayproblem(problem p) { joptionpane.showmessagedialog(this,p, "warning!",joptionpane.warning_message); }

i expect error message when don't set tile : "no tiles placed" what's in code ended :

what's wrong code anyway?

you either need pass p.message dialog or override problem's tostring() method , homecoming message there. you're seeing output of standard tostring(), i.e. class name + instance id.

btw, posted lot of irrelevant code, might create lot of people want either close question or prevent them trying answer. when asking questions should seek , boil downwards relevant parts, in case how display dialog , parameters like. more information, have here: http://stackoverflow.com/help/how-to-ask

java message

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -