Remove warning and refactor JFrame frame to local var.