密猟オンラインクライアントプログラム JAVAベース
メッセージ類をリソースファイルへ分離して日本語化
メインビューでEnterキーを押すとチャットウィンドウへフォーカスを移動するようにした
| @@ -39,8 +39,9 @@ | ||
| 39 | 39 | if (barticle == true) { |
| 40 | 40 | /* post */ |
| 41 | 41 | if (MesgBox.MessageBox(wnd, |
| 42 | - "Do you want to post article?", | |
| 43 | - "Post article", null, true) == true) { | |
| 42 | + Hunt.getBundle().getString("CONFIRM_POST"), | |
| 43 | + Hunt.getBundle().getString("TITLE_POSTARTICLE"), null, | |
| 44 | + true) == true) { | |
| 44 | 45 | /* process to post article */ |
| 45 | 46 | String subject = wnd.getTitle(); |
| 46 | 47 | String mesg; |
| @@ -50,16 +51,17 @@ | ||
| 50 | 51 | } else { |
| 51 | 52 | /* send mail */ |
| 52 | 53 | if (MesgBox.MessageBox(wnd, |
| 53 | - "Do you want to send mail?", | |
| 54 | - "Send mail", null, true) == true) { | |
| 54 | + Hunt.getBundle().getString("CONFIRM_SEND"), | |
| 55 | + Hunt.getBundle().getString("TITLE_SENDMAIL"), null, | |
| 56 | + true) == true) { | |
| 55 | 57 | /* process to send mail */ |
| 56 | 58 | String s = wnd.getTitle().substring(8); |
| 57 | 59 | StringBuffer work = new StringBuffer(); |
| 58 | - s = Hunt.getToken(s, ">", work); | |
| 60 | + s = Hunt.getToken(s, ">", work); //NOI18N | |
| 59 | 61 | if (work.length() > 0) { |
| 60 | 62 | String username = work.toString(); |
| 61 | 63 | String mesg; |
| 62 | - Hunt.getToken(s, "\n", work); | |
| 64 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 63 | 65 | mesg = wnd.getText(); |
| 64 | 66 | Hunt.getSendTask().send_one_mail(username, |
| 65 | 67 | work.toString(), mesg); |
| @@ -34,12 +34,12 @@ | ||
| 34 | 34 | if (ask == true) { |
| 35 | 35 | Panel panel = new Panel(); |
| 36 | 36 | Button button; |
| 37 | - button = new Button("YES"); | |
| 38 | - button.setActionCommand("OK"); | |
| 37 | + button = new Button(Hunt.getBundle().getString("BUTTON_YES")); | |
| 38 | + button.setActionCommand("OK"); //NOI18N | |
| 39 | 39 | button.addActionListener(msgevent); |
| 40 | 40 | panel.add(button); |
| 41 | - button = new Button("N O"); | |
| 42 | - button.setActionCommand("CANCEL"); | |
| 41 | + button = new Button(Hunt.getBundle().getString("BUTTON_NO")); | |
| 42 | + button.setActionCommand("CANCEL"); //NOI18N | |
| 43 | 43 | button.addActionListener(msgevent); |
| 44 | 44 | panel.add(button); |
| 45 | 45 | dialog.add(panel, BorderLayout.SOUTH); |
| @@ -46,8 +46,8 @@ | ||
| 46 | 46 | } else { |
| 47 | 47 | Panel panel = new Panel(); |
| 48 | 48 | Button button; |
| 49 | - button = new Button("OK"); | |
| 50 | - button.setActionCommand("OK"); | |
| 49 | + button = new Button(Hunt.getBundle().getString("BUTTON_OK")); | |
| 50 | + button.setActionCommand("OK"); //NOI18N | |
| 51 | 51 | button.addActionListener(msgevent); |
| 52 | 52 | panel.add(button); |
| 53 | 53 | dialog.add(panel, BorderLayout.SOUTH); |
| @@ -78,12 +78,12 @@ | ||
| 78 | 78 | dialog.add(panel, BorderLayout.CENTER); |
| 79 | 79 | panel = new Panel(); |
| 80 | 80 | Button button; |
| 81 | - button = new Button("OK"); | |
| 82 | - button.setActionCommand("OK"); | |
| 81 | + button = new Button(Hunt.getBundle().getString("BUTTON_OK")); | |
| 82 | + button.setActionCommand("OK"); //NOI18N | |
| 83 | 83 | button.addActionListener(msgevent); |
| 84 | 84 | panel.add(button); |
| 85 | - button = new Button("CANCEL"); | |
| 86 | - button.setActionCommand("CANCEL"); | |
| 85 | + button = new Button(Hunt.getBundle().getString("BUTTON_CANCEL")); | |
| 86 | + button.setActionCommand("CANCEL"); //NOI18N | |
| 87 | 87 | button.addActionListener(msgevent); |
| 88 | 88 | panel.add(button); |
| 89 | 89 | dialog.add(panel, BorderLayout.SOUTH); |
| @@ -116,10 +116,10 @@ | ||
| 116 | 116 | @Override |
| 117 | 117 | public void actionPerformed(ActionEvent e) { |
| 118 | 118 | String cmd = e.getActionCommand(); |
| 119 | - if (cmd.equals("OK") == true) { | |
| 119 | + if (cmd.equals("OK") == true) { //NOI18N | |
| 120 | 120 | ok = true; |
| 121 | 121 | dialog.dispose(); |
| 122 | - } else if (cmd.equals("CANCEL") == true) { | |
| 122 | + } else if (cmd.equals("CANCEL") == true) { //NOI18N | |
| 123 | 123 | dialog.dispose(); |
| 124 | 124 | } |
| 125 | 125 | } |
| @@ -123,7 +123,7 @@ | ||
| 123 | 123 | case 'V': |
| 124 | 124 | case 'v': /* print rivision */ |
| 125 | 125 | |
| 126 | - Hunt.display_message("Version 2.00"); | |
| 126 | + Hunt.display_message("Version 2.00"); //NOI18N | |
| 127 | 127 | break; |
| 128 | 128 | |
| 129 | 129 | case '?': /* command list */ |
| @@ -133,7 +133,10 @@ | ||
| 133 | 133 | |
| 134 | 134 | default: |
| 135 | 135 | MesgBox.MessageBox((Frame) Hunt.getMessageView(), |
| 136 | - "Invalid command", "Error", null, false); | |
| 136 | + Hunt.getBundle(). | |
| 137 | + getString("ERRMESG_INVALIDCOMMAND"), | |
| 138 | + Hunt.getBundle().getString("TITLE_ERROR"), | |
| 139 | + null, false); | |
| 137 | 140 | break; |
| 138 | 141 | } |
| 139 | 142 | break; |
| @@ -184,7 +187,10 @@ | ||
| 184 | 187 | |
| 185 | 188 | default: |
| 186 | 189 | MesgBox.MessageBox((Frame) Hunt.getMessageView(), |
| 187 | - "Invalid mail command", "Error", null, false); | |
| 190 | + Hunt.getBundle(). | |
| 191 | + getString("ERRMESG_INVALIDMAILCOMMAND"), | |
| 192 | + Hunt.getBundle().getString("TITLE_ERROR"), | |
| 193 | + null, false); | |
| 188 | 194 | break; |
| 189 | 195 | } |
| 190 | 196 | break; |
| @@ -220,7 +226,7 @@ | ||
| 220 | 226 | /* say command */ |
| 221 | 227 | void sayCommand(String s) { |
| 222 | 228 | StringBuffer work = new StringBuffer(); |
| 223 | - s = Hunt.getToken(s, " ,", work); | |
| 229 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 224 | 230 | if (work.length() > 0) { |
| 225 | 231 | if (s.length() > 0) { |
| 226 | 232 | doSendMessage(s); |
| @@ -231,7 +237,7 @@ | ||
| 231 | 237 | /* broadcast command */ |
| 232 | 238 | void broadcastCommand(String s) { |
| 233 | 239 | StringBuffer work = new StringBuffer(); |
| 234 | - s = Hunt.getToken(s, " ,", work); | |
| 240 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 235 | 241 | if (work.length() > 0) { |
| 236 | 242 | if (s.length() > 0) { |
| 237 | 243 | doBroadcastMessage(s); |
| @@ -242,9 +248,9 @@ | ||
| 242 | 248 | /* tell command */ |
| 243 | 249 | void tellCommand(String s) { |
| 244 | 250 | StringBuffer work = new StringBuffer(); |
| 245 | - s = Hunt.getToken(s, " ,", work); | |
| 251 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 246 | 252 | if (work.length() > 0) { |
| 247 | - s = Hunt.getToken(s, " ,", work); | |
| 253 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 248 | 254 | if (work.length() > 0) { |
| 249 | 255 | String username = work.toString(); |
| 250 | 256 | if (s.length() > 0) { |
| @@ -264,7 +270,8 @@ | ||
| 264 | 270 | buffer[0] = Hunt.HCLIT_LOGOFF; |
| 265 | 271 | if (session.send_packet_c(buffer, 0) == false) { |
| 266 | 272 | /* errot ? */ |
| 267 | - System.out.println("Can't send packet"); | |
| 273 | + System.out.println(Hunt.getBundle(). | |
| 274 | + getString("ERRMESG_SENDPACKET")); | |
| 268 | 275 | } |
| 269 | 276 | } |
| 270 | 277 |
| @@ -273,7 +280,8 @@ | ||
| 273 | 280 | buffer[0] = Hunt.HCLIT_MOVE; |
| 274 | 281 | buffer[2] = (byte) n; |
| 275 | 282 | if (session.send_packet_c(buffer, 1) == false) { |
| 276 | - System.out.println("Can't send packet"); | |
| 283 | + System.out.println(Hunt.getBundle(). | |
| 284 | + getString("ERRMESG_SENDPACKET")); | |
| 277 | 285 | Hunt.abort(); |
| 278 | 286 | } |
| 279 | 287 | } |
| @@ -283,7 +291,8 @@ | ||
| 283 | 291 | buffer[0] = Hunt.HCLIT_CHDIR; |
| 284 | 292 | buffer[2] = (byte) n; |
| 285 | 293 | if (session.send_packet_c(buffer, 1) == false) { |
| 286 | - System.out.println("Can't send packet"); | |
| 294 | + System.out.println(Hunt.getBundle(). | |
| 295 | + getString("ERRMESG_SENDPACKET")); | |
| 287 | 296 | Hunt.abort(); |
| 288 | 297 | } |
| 289 | 298 | } |
| @@ -293,7 +302,8 @@ | ||
| 293 | 302 | buffer[0] = Hunt.HCLIT_FIRE; |
| 294 | 303 | buffer[2] = (byte) n; |
| 295 | 304 | if (session.send_packet_c(buffer, 1) == false) { |
| 296 | - System.out.println("Can't send packet"); | |
| 305 | + System.out.println(Hunt.getBundle(). | |
| 306 | + getString("ERRMESG_SENDPACKET")); | |
| 297 | 307 | Hunt.abort(); |
| 298 | 308 | } |
| 299 | 309 | } |
| @@ -303,7 +313,8 @@ | ||
| 303 | 313 | buffer[0] = Hunt.HCLIT_ITEM; |
| 304 | 314 | buffer[2] = (byte) n; |
| 305 | 315 | if (session.send_packet_c(buffer, 1) == false) { |
| 306 | - System.out.println("Can't send packet"); | |
| 316 | + System.out.println(Hunt.getBundle(). | |
| 317 | + getString("ERRMESG_SENDPACKET")); | |
| 307 | 318 | Hunt.abort(); |
| 308 | 319 | } |
| 309 | 320 | } |
| @@ -312,7 +323,8 @@ | ||
| 312 | 323 | public void doPickUp() { |
| 313 | 324 | buffer[0] = Hunt.HCLIT_PICK; |
| 314 | 325 | if (session.send_packet_c(buffer, 0) == false) { |
| 315 | - System.out.println("Can't send packet"); | |
| 326 | + System.out.println(Hunt.getBundle(). | |
| 327 | + getString("ERRMESG_SENDPACKET")); | |
| 316 | 328 | Hunt.abort(); |
| 317 | 329 | } |
| 318 | 330 | } |
| @@ -335,7 +347,7 @@ | ||
| 335 | 347 | System.arraycopy(p, 0, buffer, 3, nlen); |
| 336 | 348 | } |
| 337 | 349 | if (session.send_packet_c(buffer, nlen + 1) == false) { |
| 338 | - System.out.println("Can't send packet"); | |
| 350 | + System.out.println(Hunt.getBundle().getString("ERRMESG_SENDPACKET")); | |
| 339 | 351 | Hunt.abort(); |
| 340 | 352 | } |
| 341 | 353 | } |
| @@ -358,7 +370,8 @@ | ||
| 358 | 370 | System.arraycopy(p, 0, buffer, 3, nlen); |
| 359 | 371 | } |
| 360 | 372 | if (session.send_packet_c(buffer, nlen + 1) == false) { |
| 361 | - System.out.println("Can't send packet"); | |
| 373 | + System.out.println(Hunt.getBundle(). | |
| 374 | + getString("ERRMESG_SENDPACKET")); | |
| 362 | 375 | Hunt.abort(); |
| 363 | 376 | } |
| 364 | 377 | } |
| @@ -396,7 +409,8 @@ | ||
| 396 | 409 | } |
| 397 | 410 | buffer[0] = Hunt.HCLIT_MESG2U; |
| 398 | 411 | if (session.send_packet_c(buffer, n - 2) == false) { |
| 399 | - System.out.println("Can't send packet"); | |
| 412 | + System.out.println(Hunt.getBundle(). | |
| 413 | + getString("ERRMESG_SENDPACKET")); | |
| 400 | 414 | Hunt.abort(); |
| 401 | 415 | } |
| 402 | 416 | } |
| @@ -405,7 +419,8 @@ | ||
| 405 | 419 | public void doWho() { |
| 406 | 420 | buffer[0] = Hunt.HCLIT_WHO; |
| 407 | 421 | if (session.send_packet_c(buffer, 0) == false) { |
| 408 | - System.out.println("Can't send packet"); | |
| 422 | + System.out.println(Hunt.getBundle(). | |
| 423 | + getString("ERRMESG_SENDPACKET")); | |
| 409 | 424 | Hunt.abort(); |
| 410 | 425 | } |
| 411 | 426 | } |
| @@ -414,7 +429,8 @@ | ||
| 414 | 429 | public void doPay() { |
| 415 | 430 | buffer[0] = Hunt.HCLIT_PAY; |
| 416 | 431 | if (session.send_packet_c(buffer, 0) == false) { |
| 417 | - System.out.println("Can't send packet"); | |
| 432 | + System.out.println(Hunt.getBundle(). | |
| 433 | + getString("ERRMESG_SENDPACKET")); | |
| 418 | 434 | Hunt.abort(); |
| 419 | 435 | } |
| 420 | 436 | } |
| @@ -422,9 +438,9 @@ | ||
| 422 | 438 | /* send buy command */ |
| 423 | 439 | public void doBuy(String s) { |
| 424 | 440 | StringBuffer work = new StringBuffer(); |
| 425 | - s = Hunt.getToken(s, " ,", work); | |
| 441 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 426 | 442 | if (work.length() > 0) { |
| 427 | - s = Hunt.getToken(s, " ,", work); | |
| 443 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 428 | 444 | if (work.length() > 0) { |
| 429 | 445 | int buytype = 0; |
| 430 | 446 | switch (work.charAt(0)) { |
| @@ -443,7 +459,8 @@ | ||
| 443 | 459 | buffer[2] = (byte) (buytype - 1); |
| 444 | 460 | buffer[3] = (byte) Integer.parseInt(s); |
| 445 | 461 | if (session.send_packet_c(buffer, 2) == false) { |
| 446 | - System.out.println("Can't send packet"); | |
| 462 | + System.out.println(Hunt.getBundle(). | |
| 463 | + getString("ERRMESG_SENDPACKET")); | |
| 447 | 464 | Hunt.abort(); |
| 448 | 465 | } |
| 449 | 466 | return; |
| @@ -450,7 +467,7 @@ | ||
| 450 | 467 | } |
| 451 | 468 | } |
| 452 | 469 | } |
| 453 | - Hunt.display_message("[Buy command: syntax error]"); | |
| 470 | + Hunt.display_message(Hunt.getBundle().getString("ERRMESG_BUYCOMMAND")); | |
| 454 | 471 | } |
| 455 | 472 | |
| 456 | 473 | /* request data list */ |
| @@ -457,7 +474,8 @@ | ||
| 457 | 474 | public void doRequestList(int n) { |
| 458 | 475 | buffer[0] = (n != 0) ? Hunt.HCLIT_REQITEM : Hunt.HCLIT_REQWEAPON; |
| 459 | 476 | if (session.send_packet_c(buffer, 0) == false) { |
| 460 | - System.out.println("Can't send packet"); | |
| 477 | + System.out.println(Hunt.getBundle(). | |
| 478 | + getString("ERRMESG_SENDPACKET")); | |
| 461 | 479 | Hunt.abort(); |
| 462 | 480 | } |
| 463 | 481 | } |
| @@ -465,9 +483,9 @@ | ||
| 465 | 483 | /* store item */ |
| 466 | 484 | public void doStoreShop(String s) { |
| 467 | 485 | StringBuffer work = new StringBuffer(); |
| 468 | - s = Hunt.getToken(s, " ,", work); | |
| 486 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 469 | 487 | if (work.length() > 0) { |
| 470 | - s = Hunt.getToken(s, " ,", work); | |
| 488 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 471 | 489 | if (work.length() > 0) { |
| 472 | 490 | int ntype = 0; |
| 473 | 491 | switch (work.charAt(0)) { |
| @@ -486,16 +504,17 @@ | ||
| 486 | 504 | buffer[0] = Hunt.HCLIT_STOREANIMAL; |
| 487 | 505 | Hunt.htonl(Long.parseLong(s), buffer, 2); |
| 488 | 506 | if (session.send_packet_c(buffer, 4) == false) { |
| 489 | - System.out.println("Can't send packet"); | |
| 507 | + System.out.println(Hunt.getBundle(). | |
| 508 | + getString("ERRMESG_SENDPACKET")); | |
| 490 | 509 | Hunt.abort(); |
| 491 | 510 | } |
| 492 | 511 | } else if (ntype > 0) { |
| 493 | 512 | int parts_no = -1; |
| 494 | 513 | long parts_cost = -1; |
| 495 | - s = Hunt.getToken(s, " ,", work); | |
| 514 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 496 | 515 | if (work.length() > 0) { |
| 497 | 516 | parts_no = Integer.parseInt(work.toString()); |
| 498 | - Hunt.getToken(s, "\n", work); | |
| 517 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 499 | 518 | if (work.length() > 0) { |
| 500 | 519 | parts_cost = Long.parseLong(work.toString()); |
| 501 | 520 | } |
| @@ -506,16 +525,19 @@ | ||
| 506 | 525 | buffer[3] = (byte) parts_no; |
| 507 | 526 | Hunt.htonl(parts_cost, buffer, 4); |
| 508 | 527 | if (session.send_packet_c(buffer, 6) == false) { |
| 509 | - System.out.println("Can't send packet"); | |
| 528 | + System.out.println(Hunt.getBundle(). | |
| 529 | + getString("ERRMESG_SENDPACKET")); | |
| 510 | 530 | Hunt.abort(); |
| 511 | 531 | } |
| 512 | 532 | } |
| 513 | 533 | } else { |
| 514 | - Hunt.display_message("[Store command: illegal type]"); | |
| 534 | + Hunt.display_message(Hunt.getBundle(). | |
| 535 | + getString("ERRMESG_STORECOMMAND")); | |
| 515 | 536 | } |
| 516 | 537 | } |
| 517 | 538 | } else { |
| 518 | - Hunt.display_message("[Store command: syntax error]"); | |
| 539 | + Hunt.display_message(Hunt.getBundle(). | |
| 540 | + getString("ERRMESG_STORESYNTAX")); | |
| 519 | 541 | } |
| 520 | 542 | } |
| 521 | 543 |
| @@ -522,9 +544,9 @@ | ||
| 522 | 544 | /* change my shop name */ |
| 523 | 545 | public void doChangeShopName(String s) { |
| 524 | 546 | StringBuffer work = new StringBuffer(); |
| 525 | - s = Hunt.getToken(s, " ,", work); | |
| 547 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 526 | 548 | if (work.length() > 0) { |
| 527 | - Hunt.getToken(s, "\n", work); | |
| 549 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 528 | 550 | if (work.length() > 0) { |
| 529 | 551 | String newname = work.toString(); |
| 530 | 552 | int n = 2; |
| @@ -545,12 +567,14 @@ | ||
| 545 | 567 | } |
| 546 | 568 | buffer[0] = Hunt.HCLIT_CHANGEMYSHOP; |
| 547 | 569 | if (session.send_packet_c(buffer, 16) == false) { |
| 548 | - System.out.println("Can't send packet"); | |
| 570 | + System.out.println(Hunt.getBundle(). | |
| 571 | + getString("ERRMESG_SENDPACKET")); | |
| 549 | 572 | Hunt.abort(); |
| 550 | 573 | } |
| 551 | 574 | } |
| 552 | 575 | } else { |
| 553 | - Hunt.display_message("[Change shop name command: syntax error]"); | |
| 576 | + Hunt.display_message(Hunt.getBundle(). | |
| 577 | + getString("ERRMESG_CHANGESHOPNAME")); | |
| 554 | 578 | } |
| 555 | 579 | } |
| 556 | 580 |
| @@ -557,9 +581,9 @@ | ||
| 557 | 581 | /* discard shop item */ |
| 558 | 582 | public void doDiscardShopItem(String s) { |
| 559 | 583 | StringBuffer work = new StringBuffer(); |
| 560 | - s = Hunt.getToken(s, " ,", work); | |
| 584 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 561 | 585 | if (work.length() > 0) { |
| 562 | - s = Hunt.getToken(s, " ,", work); | |
| 586 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 563 | 587 | if (work.length() > 0) { |
| 564 | 588 | int ntype = 0; |
| 565 | 589 | switch (work.charAt(0)) { |
| @@ -576,13 +600,15 @@ | ||
| 576 | 600 | buffer[2] = (byte) (ntype - 1); |
| 577 | 601 | buffer[3] = (byte) Integer.parseInt(s); |
| 578 | 602 | if (session.send_packet_c(buffer, 2) == false) { |
| 579 | - System.out.println("Can't send packet"); | |
| 603 | + System.out.println(Hunt.getBundle(). | |
| 604 | + getString("ERRMESG_SENDPACKET")); | |
| 580 | 605 | Hunt.abort(); |
| 581 | 606 | } |
| 582 | 607 | } |
| 583 | 608 | } |
| 584 | 609 | } else { |
| 585 | - Hunt.display_message("[Discard command: syntax error]"); | |
| 610 | + Hunt.display_message(Hunt.getBundle(). | |
| 611 | + getString("ERRMESG_DISCARDCOMMAND")); | |
| 586 | 612 | } |
| 587 | 613 | } |
| 588 | 614 |
| @@ -590,7 +616,8 @@ | ||
| 590 | 616 | public void doDestroyShop() { |
| 591 | 617 | buffer[0] = Hunt.HCLIT_DESTROYMYSHOP; |
| 592 | 618 | if (session.send_packet_c(buffer, 0) == false) { |
| 593 | - System.out.println("Can't send packet"); | |
| 619 | + System.out.println(Hunt.getBundle(). | |
| 620 | + getString("ERRMESG_SENDPACKET")); | |
| 594 | 621 | Hunt.abort(); |
| 595 | 622 | } |
| 596 | 623 | } |
| @@ -599,7 +626,8 @@ | ||
| 599 | 626 | public void doRequestShopList() { |
| 600 | 627 | buffer[0] = Hunt.HCLIT_LISTMYSHOP; |
| 601 | 628 | if (session.send_packet_c(buffer, 0) == false) { |
| 602 | - System.out.println("Can't send packet"); | |
| 629 | + System.out.println(Hunt.getBundle(). | |
| 630 | + getString("ERRMESG_SENDPACKET")); | |
| 603 | 631 | Hunt.abort(); |
| 604 | 632 | } |
| 605 | 633 | } |
| @@ -608,7 +636,8 @@ | ||
| 608 | 636 | public void doRequestAnimalList() { |
| 609 | 637 | buffer[0] = Hunt.HCLIT_REQANIMAL; |
| 610 | 638 | if (session.send_packet_c(buffer, 0) == false) { |
| 611 | - System.out.println("Can't send packet"); | |
| 639 | + System.out.println(Hunt.getBundle(). | |
| 640 | + getString("ERRMESG_SENDPACKET")); | |
| 612 | 641 | Hunt.abort(); |
| 613 | 642 | } |
| 614 | 643 | } |
| @@ -617,7 +646,8 @@ | ||
| 617 | 646 | public void doRequestLiveAnimalList() { |
| 618 | 647 | buffer[0] = Hunt.HCLIT_LISTLIVEANIMAL; |
| 619 | 648 | if (session.send_packet_c(buffer, 0) == false) { |
| 620 | - System.out.println("Can't send packet"); | |
| 649 | + System.out.println(Hunt.getBundle(). | |
| 650 | + getString("ERRMESG_SENDPACKET")); | |
| 621 | 651 | Hunt.abort(); |
| 622 | 652 | } |
| 623 | 653 | } |
| @@ -625,11 +655,11 @@ | ||
| 625 | 655 | /* write message on shop hige */ |
| 626 | 656 | public void doWriteMessage(String s) { |
| 627 | 657 | StringBuffer work = new StringBuffer(); |
| 628 | - s = Hunt.getToken(s, " ,", work); | |
| 658 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 629 | 659 | if (work.length() > 0) { |
| 630 | 660 | byte[] pmesg = null; |
| 631 | 661 | int nlen; |
| 632 | - Hunt.getToken(s, "\n", work); | |
| 662 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 633 | 663 | if (work.length() > 0) { |
| 634 | 664 | String mesg = work.toString(); |
| 635 | 665 | try { |
| @@ -650,11 +680,13 @@ | ||
| 650 | 680 | System.arraycopy(pmesg, 0, buffer, 3, nlen); |
| 651 | 681 | } |
| 652 | 682 | if (session.send_packet_c(buffer, nlen + 1) == false) { |
| 653 | - System.out.println("Can't send packet"); | |
| 683 | + System.out.println(Hunt.getBundle(). | |
| 684 | + getString("ERRMESG_SENDPACKET")); | |
| 654 | 685 | Hunt.abort(); |
| 655 | 686 | } |
| 656 | 687 | } else { |
| 657 | - Hunt.display_message("[Write message command: syntax error]"); | |
| 688 | + Hunt.display_message(Hunt.getBundle(). | |
| 689 | + getString("ERRMESG_WRITECOMMAND")); | |
| 658 | 690 | } |
| 659 | 691 | } |
| 660 | 692 |
| @@ -661,9 +693,9 @@ | ||
| 661 | 693 | /* dtop obj */ |
| 662 | 694 | public void doDrop(String s) { |
| 663 | 695 | StringBuffer work = new StringBuffer(); |
| 664 | - s = Hunt.getToken(s, " ,", work); | |
| 696 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 665 | 697 | if (work.length() > 0) { |
| 666 | - s = Hunt.getToken(s, " ,", work); | |
| 698 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 667 | 699 | if (work.length() > 0) { |
| 668 | 700 | int ntype = 0; |
| 669 | 701 | switch (work.charAt(0)) { |
| @@ -677,12 +709,12 @@ | ||
| 677 | 709 | } |
| 678 | 710 | if (ntype > 0) { |
| 679 | 711 | int objno; |
| 680 | - s = Hunt.getToken(s, " ,", work); | |
| 712 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 681 | 713 | if (work.length() > 0) { |
| 682 | 714 | byte[] pmesg = null; |
| 683 | 715 | int nlen; |
| 684 | 716 | objno = Integer.parseInt(work.toString()); |
| 685 | - Hunt.getToken(s, "\n", work); | |
| 717 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 686 | 718 | if (work.length() > 0) { |
| 687 | 719 | String mesg = work.toString(); |
| 688 | 720 | try { |
| @@ -705,19 +737,22 @@ | ||
| 705 | 737 | System.arraycopy(pmesg, 0, buffer, 5, nlen); |
| 706 | 738 | } |
| 707 | 739 | if (session.send_packet_c(buffer, nlen + 3) == false) { |
| 708 | - System.out.println("Can't send packet"); | |
| 740 | + System.out.println(Hunt.getBundle(). | |
| 741 | + getString("ERRMESG_SENDPACKET")); | |
| 709 | 742 | Hunt.abort(); |
| 710 | 743 | } |
| 711 | 744 | } else { |
| 712 | - Hunt.display_message("[Drop command: " | |
| 713 | - + "no find slot number]"); | |
| 745 | + Hunt.display_message(Hunt.getBundle(). | |
| 746 | + getString("ERRMESG_DROPNOSLOT")); | |
| 714 | 747 | } |
| 715 | 748 | } else { |
| 716 | - Hunt.display_message("[Drop command: illegal type]"); | |
| 749 | + Hunt.display_message(Hunt.getBundle(). | |
| 750 | + getString("ERRMESG_DROPILLEGALTYPE")); | |
| 717 | 751 | } |
| 718 | 752 | } |
| 719 | 753 | } else { |
| 720 | - Hunt.display_message("[Drop command: syntax error]"); | |
| 754 | + Hunt.display_message(Hunt.getBundle(). | |
| 755 | + getString("ERRMESG_DROPSYNTAX")); | |
| 721 | 756 | } |
| 722 | 757 | } |
| 723 | 758 |
| @@ -724,10 +759,10 @@ | ||
| 724 | 759 | /* read mail command */ |
| 725 | 760 | public void doReadMail(String s) { |
| 726 | 761 | StringBuffer work = new StringBuffer(); |
| 727 | - s = Hunt.getToken(s, " ,", work); | |
| 762 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 728 | 763 | if (work.length() > 0) { |
| 729 | 764 | int num = 0; |
| 730 | - Hunt.getToken(s, "\n", work); | |
| 765 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 731 | 766 | if (work.length() > 0) { |
| 732 | 767 | num = Integer.parseInt(work.toString()); |
| 733 | 768 | } |
| @@ -734,7 +769,8 @@ | ||
| 734 | 769 | buffer[0] = Hunt.HCLIT_READMAIL; |
| 735 | 770 | buffer[2] = (byte) num; |
| 736 | 771 | if (session.send_packet_c(buffer, 1) == false) { |
| 737 | - System.out.println("Can't send packet"); | |
| 772 | + System.out.println(Hunt.getBundle(). | |
| 773 | + getString("ERRMESG_SENDPACKET")); | |
| 738 | 774 | Hunt.abort(); |
| 739 | 775 | } else { |
| 740 | 776 | HuntReadWnd wnd = new HuntReadWnd(false); |
| @@ -747,7 +783,8 @@ | ||
| 747 | 783 | public void doListMail() { |
| 748 | 784 | buffer[0] = Hunt.HCLIT_LISTMAIL; |
| 749 | 785 | if (session.send_packet_c(buffer, 0) == false) { |
| 750 | - System.out.println("Can't send packet"); | |
| 786 | + System.out.println(Hunt.getBundle(). | |
| 787 | + getString("ERRMESG_SENDPACKET")); | |
| 751 | 788 | Hunt.abort(); |
| 752 | 789 | } |
| 753 | 790 | } |
| @@ -755,10 +792,10 @@ | ||
| 755 | 792 | /* read article */ |
| 756 | 793 | public void doReadArticle(String s) { |
| 757 | 794 | StringBuffer work = new StringBuffer(); |
| 758 | - s = Hunt.getToken(s, " ,", work); | |
| 795 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 759 | 796 | if (work.length() > 0) { |
| 760 | 797 | int num = 0; |
| 761 | - Hunt.getToken(s, "\n", work); | |
| 798 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 762 | 799 | if (work.length() > 0) { |
| 763 | 800 | num = Integer.parseInt(work.toString()); |
| 764 | 801 | } |
| @@ -765,7 +802,8 @@ | ||
| 765 | 802 | buffer[0] = Hunt.HCLIT_BBS_READ; |
| 766 | 803 | buffer[2] = (byte) num; |
| 767 | 804 | if (session.send_packet_c(buffer, 1) == false) { |
| 768 | - System.out.println("Can't send packet"); | |
| 805 | + System.out.println(Hunt.getBundle(). | |
| 806 | + getString("ERRMESG_SENDPACKET")); | |
| 769 | 807 | Hunt.abort(); |
| 770 | 808 | } else { |
| 771 | 809 | HuntReadWnd wnd = new HuntReadWnd(true); |
| @@ -778,7 +816,8 @@ | ||
| 778 | 816 | public void doListArticle() { |
| 779 | 817 | buffer[0] = Hunt.HCLIT_BBS_LIST; |
| 780 | 818 | if (session.send_packet_c(buffer, 0) == false) { |
| 781 | - System.out.println("Can't send packet"); | |
| 819 | + System.out.println(Hunt.getBundle(). | |
| 820 | + getString("ERRMESG_SENDPACKET")); | |
| 782 | 821 | Hunt.abort(); |
| 783 | 822 | } |
| 784 | 823 | } |
| @@ -786,10 +825,10 @@ | ||
| 786 | 825 | /* delete mail */ |
| 787 | 826 | public void doDeleteMail(String s) { |
| 788 | 827 | StringBuffer work = new StringBuffer(); |
| 789 | - s = Hunt.getToken(s, " ,", work); | |
| 828 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 790 | 829 | if (work.length() > 0) { |
| 791 | 830 | int num = 0; |
| 792 | - Hunt.getToken(s, "\n", work); | |
| 831 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 793 | 832 | if (work.length() > 0) { |
| 794 | 833 | num = Integer.parseInt(work.toString()); |
| 795 | 834 | } |
| @@ -796,7 +835,8 @@ | ||
| 796 | 835 | buffer[0] = Hunt.HCLIT_DELETEMAIL; |
| 797 | 836 | buffer[2] = (byte) num; |
| 798 | 837 | if (session.send_packet_c(buffer, 1) == false) { |
| 799 | - System.out.println("Can't send packet"); | |
| 838 | + System.out.println(Hunt.getBundle(). | |
| 839 | + getString("ERRMESG_SENDPACKET")); | |
| 800 | 840 | Hunt.abort(); |
| 801 | 841 | } |
| 802 | 842 | } |
| @@ -805,9 +845,9 @@ | ||
| 805 | 845 | /* transfer score */ |
| 806 | 846 | public void doTransferScore(String s) { |
| 807 | 847 | StringBuffer work = new StringBuffer(); |
| 808 | - s = Hunt.getToken(s, " ,", work); | |
| 848 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 809 | 849 | if (work.length() > 0) { |
| 810 | - s = Hunt.getToken(s, " ,", work); | |
| 850 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 811 | 851 | if (work.length() > 0) { |
| 812 | 852 | String username = work.toString(); |
| 813 | 853 | byte[] pusername; |
| @@ -817,7 +857,7 @@ | ||
| 817 | 857 | return; |
| 818 | 858 | } |
| 819 | 859 | int nlen = Array.getLength(pusername); |
| 820 | - Hunt.getToken(s, "\n", work); | |
| 860 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 821 | 861 | if (work.length() > 0) { |
| 822 | 862 | int n = 2; |
| 823 | 863 | long score = Long.parseLong(work.toString()); |
| @@ -833,7 +873,8 @@ | ||
| 833 | 873 | Hunt.htonl(score, buffer, n); |
| 834 | 874 | n += 4; |
| 835 | 875 | if (session.send_packet_c(buffer, n) == false) { |
| 836 | - System.out.println("Can't send packet"); | |
| 876 | + System.out.println(Hunt.getBundle(). | |
| 877 | + getString("ERRMESG_SENDPACKET")); | |
| 837 | 878 | Hunt.abort(); |
| 838 | 879 | } |
| 839 | 880 | } |
| @@ -844,9 +885,9 @@ | ||
| 844 | 885 | /* change animal name */ |
| 845 | 886 | public void doChangeAnimalName(String s) { |
| 846 | 887 | StringBuffer work = new StringBuffer(); |
| 847 | - s = Hunt.getToken(s, " ,", work); | |
| 888 | + s = Hunt.getToken(s, " ,", work); //NOI18N | |
| 848 | 889 | if (work.length() > 0) { |
| 849 | - Hunt.getToken(s, "\n", work); | |
| 890 | + Hunt.getToken(s, "\n", work); //NOI18N | |
| 850 | 891 | if (work.length() > 0) { |
| 851 | 892 | int n = 2; |
| 852 | 893 | String newname = work.toString(); |
| @@ -867,13 +908,14 @@ | ||
| 867 | 908 | } |
| 868 | 909 | buffer[0] = Hunt.HCLIT_CHANGEANIMAL; |
| 869 | 910 | if (session.send_packet_c(buffer, n) == false) { |
| 870 | - System.out.println("Can't send packet"); | |
| 911 | + System.out.println(Hunt.getBundle(). | |
| 912 | + getString("ERRMESG_SENDPACKET")); | |
| 871 | 913 | Hunt.abort(); |
| 872 | 914 | } |
| 873 | 915 | } |
| 874 | 916 | } else { |
| 875 | - Hunt.display_message("[Change animal name command:" | |
| 876 | - + " syntax error]"); | |
| 917 | + Hunt.display_message(Hunt.getBundle(). | |
| 918 | + getString("ERRMESG_CHANGEANIMAL")); | |
| 877 | 919 | } |
| 878 | 920 | } |
| 879 | 921 |
| @@ -911,7 +953,8 @@ | ||
| 911 | 953 | buffer[n++] = 0; |
| 912 | 954 | buffer[n++] = (byte) Hunt.HPROTOCOL_VERSION; |
| 913 | 955 | if (session.send_packet_c(buffer, n - 2) == false) { |
| 914 | - System.out.println("Can't send packet"); | |
| 956 | + System.out.println(Hunt.getBundle(). | |
| 957 | + getString("ERRMESG_SENDPACKET")); | |
| 915 | 958 | Hunt.abort(); |
| 916 | 959 | } |
| 917 | 960 | } |
| @@ -966,7 +1009,8 @@ | ||
| 966 | 1009 | buffer[n++] = 0; |
| 967 | 1010 | } |
| 968 | 1011 | if (session.send_packet_c(buffer, n - 2) == false) { |
| 969 | - System.out.println("Can't send packet"); | |
| 1012 | + System.out.println(Hunt.getBundle(). | |
| 1013 | + getString("ERRMESG_SENDPACKET")); | |
| 970 | 1014 | Hunt.abort(); |
| 971 | 1015 | } |
| 972 | 1016 | } |
| @@ -1010,7 +1054,7 @@ | ||
| 1010 | 1054 | try { |
| 1011 | 1055 | StringBuffer work = new StringBuffer(); |
| 1012 | 1056 | while (mesg != null) { |
| 1013 | - mesg = Hunt.getToken(mesg, "\n", work); | |
| 1057 | + mesg = Hunt.getToken(mesg, "\n", work); //NOI18N | |
| 1014 | 1058 | p = work.toString().getBytes(Hunt.SYSTEM_CHARSET); |
| 1015 | 1059 | nlen = Array.getLength(p); |
| 1016 | 1060 | if (nlen > 255) { |
| @@ -1058,7 +1102,7 @@ | ||
| 1058 | 1102 | try { |
| 1059 | 1103 | StringBuffer work = new StringBuffer(); |
| 1060 | 1104 | while (mesg != null) { |
| 1061 | - mesg = Hunt.getToken(mesg, "\n", work); | |
| 1105 | + mesg = Hunt.getToken(mesg, "\n", work); //NOI18N | |
| 1062 | 1106 | p = work.toString().getBytes(Hunt.SYSTEM_CHARSET); |
| 1063 | 1107 | nlen = Array.getLength(p); |
| 1064 | 1108 | if (nlen > 255) { |
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | package hunton; |
| 2 | 2 | |
| 3 | 3 | import java.awt.*; |
| 4 | -import java.io.*; | |
| 5 | 4 | import java.text.*; |
| 6 | 5 | |
| 7 | 6 | public class HuntStatusView extends Frame { |
| @@ -9,7 +8,7 @@ | ||
| 9 | 8 | HuntStatusPanel stat; |
| 10 | 9 | |
| 11 | 10 | HuntStatusView() { |
| 12 | - super("status"); | |
| 11 | + super(Hunt.getBundle().getString("TITLE_STATUSWND")); | |
| 13 | 12 | stat = new HuntStatusPanel(); |
| 14 | 13 | add(stat, BorderLayout.CENTER); |
| 15 | 14 | } |
| @@ -21,7 +20,11 @@ | ||
| 21 | 20 | |
| 22 | 21 | class HuntStatusPanel extends Canvas { |
| 23 | 22 | |
| 24 | - static final String direction[] = {"N", "W", "E", "S"}; | |
| 23 | + static final String direction[] = { | |
| 24 | + Hunt.getBundle().getString("DIRECTIONSTR_N"), | |
| 25 | + Hunt.getBundle().getString("DIRECTIONSTR_W"), | |
| 26 | + Hunt.getBundle().getString("DIRECTIONSTR_E"), | |
| 27 | + Hunt.getBundle().getString("DIRECTIONSTR_S")}; | |
| 25 | 28 | static String[] hungryMesg; |
| 26 | 29 | |
| 27 | 30 | static { |
| @@ -30,25 +33,12 @@ | ||
| 30 | 33 | |
| 31 | 34 | HuntStatusPanel() { |
| 32 | 35 | super(); |
| 33 | - int i; | |
| 34 | - try { | |
| 35 | - InputStream fis = getClass().getResourceAsStream("hungry.utf8"); | |
| 36 | - InputStreamReader isr = new InputStreamReader(fis, "utf-8"); | |
| 37 | - try (BufferedReader fin = new BufferedReader(isr)) { | |
| 38 | - for (i = 0; i < 5; i++) { | |
| 39 | - hungryMesg[i] = fin.readLine(); | |
| 40 | - if (hungryMesg[i] == null) { | |
| 41 | - hungryMesg[i] = "?"; | |
| 42 | - } | |
| 43 | - } | |
| 44 | - } | |
| 45 | - } catch (IOException e) { | |
| 46 | - hungryMesg[0] = "Near death"; | |
| 47 | - hungryMesg[1] = "Very hungry"; | |
| 48 | - hungryMesg[2] = "Hungry"; | |
| 49 | - hungryMesg[3] = "Good"; | |
| 50 | - hungryMesg[4] = "Full"; | |
| 51 | - } | |
| 36 | + hungryMesg[0] = Hunt.getBundle().getString("HUNGRYMESG_0"); | |
| 37 | + hungryMesg[1] = Hunt.getBundle().getString("HUNGRYMESG_1"); | |
| 38 | + hungryMesg[2] = Hunt.getBundle().getString("HUNGRYMESG_2"); | |
| 39 | + hungryMesg[3] = Hunt.getBundle().getString("HUNGRYMESG_3"); | |
| 40 | + hungryMesg[4] = Hunt.getBundle().getString("HUNGRYMESG_4"); | |
| 41 | + setFont(new Font(Font.MONOSPACED, Font.PLAIN, 16)); | |
| 52 | 42 | } |
| 53 | 43 | |
| 54 | 44 | @Override |
| @@ -69,52 +59,52 @@ | ||
| 69 | 59 | /* display status */ |
| 70 | 60 | int i; |
| 71 | 61 | String work; |
| 72 | - DecimalFormat form = new DecimalFormat("###0"); | |
| 62 | + DecimalFormat form = new DecimalFormat("###0"); //NOI18N | |
| 73 | 63 | FontMetrics fm = offg.getFontMetrics(); |
| 74 | 64 | int nheight = fm.getHeight(); |
| 75 | 65 | int y = nheight; |
| 76 | 66 | offg.setColor(Color.white); |
| 77 | 67 | if (Hunt.getType() != 0) { |
| 78 | - work = "[G] HP:"; | |
| 68 | + work = Hunt.getBundle().getString("GUARD_HP"); | |
| 79 | 69 | work += Long.toString(Hunt.getHP()); |
| 80 | - work += " "; | |
| 70 | + work += " "; //NOI18N | |
| 81 | 71 | work += hungryMesg[Hunt.getHungry()]; |
| 82 | 72 | offg.drawString(work, 0, y); |
| 83 | 73 | y += nheight; |
| 84 | - work = "X:"; | |
| 74 | + work = "X:"; //NOI18N | |
| 85 | 75 | work += form.format(Hunt.getX()); |
| 86 | - work += " Y:"; | |
| 76 | + work += " Y:"; //NOI18N | |
| 87 | 77 | work += form.format(Hunt.getY()); |
| 88 | 78 | offg.drawString(work, 0, y); |
| 89 | 79 | y += nheight; |
| 90 | - work = "Score:"; | |
| 80 | + work = Hunt.getBundle().getString("SCOREMESG"); | |
| 91 | 81 | work += Long.toString(Hunt.getScore()); |
| 92 | 82 | offg.drawString(work, 0, y); |
| 93 | 83 | y += nheight; |
| 94 | - work = "Direction:"; | |
| 84 | + work = Hunt.getBundle().getString("DIRECTIONMESG"); | |
| 95 | 85 | work += direction[Hunt.getDir()]; |
| 96 | 86 | offg.drawString(work, 0, y); |
| 97 | 87 | y += nheight; |
| 98 | 88 | } else { |
| 99 | - work = "[H] HP:"; | |
| 89 | + work = Hunt.getBundle().getString("HUNTER_HP"); | |
| 100 | 90 | work += Long.toString(Hunt.getHP()); |
| 101 | - work += " "; | |
| 91 | + work += " "; //NOI18N | |
| 102 | 92 | work += hungryMesg[Hunt.getHungry()]; |
| 103 | 93 | offg.drawString(work, 0, y); |
| 104 | 94 | y += nheight; |
| 105 | - work = "Crime:"; | |
| 95 | + work = Hunt.getBundle().getString("CRIMEMESG"); | |
| 106 | 96 | work += Long.toString(Hunt.getCrime()); |
| 107 | - work += " X:"; | |
| 97 | + work += " X:"; //NOI18N | |
| 108 | 98 | work += form.format(Hunt.getX()); |
| 109 | - work += " Y:"; | |
| 99 | + work += " Y:"; //NOI18N | |
| 110 | 100 | work += form.format(Hunt.getY()); |
| 111 | 101 | offg.drawString(work, 0, y); |
| 112 | 102 | y += nheight; |
| 113 | - work = "Score:"; | |
| 103 | + work = Hunt.getBundle().getString("SCOREMESG"); | |
| 114 | 104 | work += Long.toString(Hunt.getScore()); |
| 115 | 105 | offg.drawString(work, 0, y); |
| 116 | 106 | y += nheight; |
| 117 | - work = "Direction:"; | |
| 107 | + work = Hunt.getBundle().getString("DIRECTIONMESG"); | |
| 118 | 108 | work += direction[Hunt.getDir()]; |
| 119 | 109 | offg.drawString(work, 0, y); |
| 120 | 110 | y += nheight; |
| @@ -121,25 +111,25 @@ | ||
| 121 | 111 | } |
| 122 | 112 | for (i = 0; i < Hunt.WEAPON_MAX; i++) { |
| 123 | 113 | int n = i + 1; |
| 124 | - work = "W"; | |
| 114 | + work = Hunt.getBundle().getString("WEAPONMESG"); | |
| 125 | 115 | work += Integer.toString(n); |
| 126 | - work += ":"; | |
| 116 | + work += ":"; //NOI18N | |
| 127 | 117 | work += Hunt.getWeapon(i); |
| 128 | - work += "("; | |
| 118 | + work += "("; //NOI18N | |
| 129 | 119 | work += Integer.toString(Hunt.getWeaponLeft(i)); |
| 130 | - work += ")"; | |
| 120 | + work += ")"; //NOI18N | |
| 131 | 121 | offg.drawString(work, 0, y); |
| 132 | 122 | y += nheight; |
| 133 | 123 | } |
| 134 | 124 | for (i = 0; i < Hunt.ITEM_MAX; i++) { |
| 135 | 125 | int n = i + 1; |
| 136 | - work = "I"; | |
| 126 | + work = Hunt.getBundle().getString("ITEMMESG"); | |
| 137 | 127 | work += Integer.toString(n); |
| 138 | - work += ":"; | |
| 128 | + work += ":"; //NOI18N | |
| 139 | 129 | work += Hunt.getItem(i); |
| 140 | - work += "("; | |
| 130 | + work += "("; //NOI18N | |
| 141 | 131 | work += Integer.toString(Hunt.getItemLeft(i)); |
| 142 | - work += ")"; | |
| 132 | + work += ")"; //NOI18N | |
| 143 | 133 | offg.drawString(work, 0, y); |
| 144 | 134 | y += nheight; |
| 145 | 135 | } |
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | |
| 8 | 8 | public class Hunt { |
| 9 | 9 | |
| 10 | - public static final String SYSTEM_CHARSET = "UTF-8"; | |
| 10 | + public static final String SYSTEM_CHARSET = "UTF-8"; //NOI18N | |
| 11 | 11 | |
| 12 | 12 | /* system const value */ |
| 13 | 13 | public static final int SENDMAP_CHUNK = 1000; |
| @@ -162,6 +162,10 @@ | ||
| 162 | 162 | static int nowHungry; |
| 163 | 163 | static int yourType; |
| 164 | 164 | |
| 165 | + public static final java.util.ResourceBundle getBundle() { | |
| 166 | + return java.util.ResourceBundle.getBundle("hunton.hunton"); | |
| 167 | + } | |
| 168 | + | |
| 165 | 169 | public static final int ntohs(byte[] p, int nidx) { |
| 166 | 170 | return (((int) p[nidx] & 0xff) << 8) | ((int) p[nidx + 1] & 0xff); |
| 167 | 171 | } |
| @@ -227,7 +231,7 @@ | ||
| 227 | 231 | |
| 228 | 232 | public static final String getWeapon(int n) { |
| 229 | 233 | if (nowWeapon[n] == null) { |
| 230 | - return "?"; | |
| 234 | + return "?"; //NOI18N | |
| 231 | 235 | } else { |
| 232 | 236 | return nowWeapon[n]; |
| 233 | 237 | } |
| @@ -235,7 +239,7 @@ | ||
| 235 | 239 | |
| 236 | 240 | public static final String getItem(int n) { |
| 237 | 241 | if (nowItem[n] == null) { |
| 238 | - return "?"; | |
| 242 | + return "?"; //NOI18N | |
| 239 | 243 | } else { |
| 240 | 244 | return nowItem[n]; |
| 241 | 245 | } |
| @@ -291,7 +295,7 @@ | ||
| 291 | 295 | } |
| 292 | 296 | nowWeapon[n] = new String(p, nidx, i + 1, SYSTEM_CHARSET); |
| 293 | 297 | } catch (UnsupportedEncodingException e) { |
| 294 | - nowWeapon[n] = "?"; | |
| 298 | + nowWeapon[n] = "?"; //NOI18N | |
| 295 | 299 | } |
| 296 | 300 | } |
| 297 | 301 |
| @@ -305,7 +309,7 @@ | ||
| 305 | 309 | } |
| 306 | 310 | nowItem[n] = new String(p, nidx, i + 1, SYSTEM_CHARSET); |
| 307 | 311 | } catch (UnsupportedEncodingException e) { |
| 308 | - nowItem[n] = "?"; | |
| 312 | + nowItem[n] = "?"; //NOI18N | |
| 309 | 313 | } |
| 310 | 314 | } |
| 311 | 315 |
| @@ -492,17 +496,17 @@ | ||
| 492 | 496 | /* write mail command */ |
| 493 | 497 | public static void doWriteMail(String s) { |
| 494 | 498 | StringBuffer work = new StringBuffer(); |
| 495 | - s = getToken(s, " ,", work); | |
| 499 | + s = getToken(s, " ,", work); //NOI18N | |
| 496 | 500 | if (work.length() > 0) { |
| 497 | - s = getToken(s, ",", work); | |
| 501 | + s = getToken(s, ",", work); //NOI18N | |
| 498 | 502 | if (work.length() > 0) { |
| 499 | 503 | String username = work.toString(); |
| 500 | - getToken(s, "\n", work); | |
| 504 | + getToken(s, "\n", work); //NOI18N | |
| 501 | 505 | if (work.length() > 0) { |
| 502 | 506 | String title; |
| 503 | - title = "MAIL TO:"; | |
| 507 | + title = Hunt.getBundle().getString("MAILTOMESG"); | |
| 504 | 508 | title += username; |
| 505 | - title += ">"; | |
| 509 | + title += ">"; //NOI18N | |
| 506 | 510 | title += work.toString(); |
| 507 | 511 | HuntWriteWnd wnd = new HuntWriteWnd(title, false); |
| 508 | 512 | wnd.setVisible(true); |
| @@ -515,9 +519,9 @@ | ||
| 515 | 519 | /* post article command */ |
| 516 | 520 | public static void doPostArticle(String s) { |
| 517 | 521 | StringBuffer work = new StringBuffer(); |
| 518 | - s = getToken(s, " ,", work); | |
| 522 | + s = getToken(s, " ,", work); //NOI18N | |
| 519 | 523 | if (work.length() > 0) { |
| 520 | - getToken(s, "\n", work); | |
| 524 | + getToken(s, "\n", work); //NOI18N | |
| 521 | 525 | if (work.length() > 0) { |
| 522 | 526 | HuntWriteWnd wnd = new HuntWriteWnd(work.toString(), true); |
| 523 | 527 | wnd.setVisible(true); |
| @@ -529,7 +533,7 @@ | ||
| 529 | 533 | /* reply mail */ |
| 530 | 534 | public static void reply_mail(String username, String mesg) { |
| 531 | 535 | String work; |
| 532 | - String subject = ""; | |
| 536 | + String subject = ""; //NOI18N | |
| 533 | 537 | BreakIterator bi = BreakIterator.getLineInstance(); |
| 534 | 538 | bi.setText(mesg); |
| 535 | 539 | int spos = bi.first(); |
| @@ -539,13 +543,15 @@ | ||
| 539 | 543 | reserve_line > 0 && epos != BreakIterator.DONE; |
| 540 | 544 | reserve_line--, spos = epos, epos = bi.next()) { |
| 541 | 545 | work = mesg.substring(spos, epos); |
| 542 | - if (work.indexOf("Subject: ") == 0) { | |
| 546 | + if (work.indexOf(Hunt.getBundle().getString("SUBJECTMESG")) == 0) { | |
| 543 | 547 | subject = work.substring(9); |
| 544 | 548 | } |
| 545 | 549 | } |
| 546 | - work = "MAIL TO:" + username + ">Re:"; | |
| 547 | - if (subject.indexOf("Re:") == 0 || subject.indexOf("RE:") == 0 | |
| 548 | - || subject.indexOf("re:") == 0) { | |
| 550 | + work = Hunt.getBundle().getString("MAILTOMESG"); | |
| 551 | + work += username; | |
| 552 | + work += ">Re:"; //NOI18N | |
| 553 | + if (subject.indexOf("Re:") == 0 || subject.indexOf("RE:") == 0 //NOI18N | |
| 554 | + || subject.indexOf("re:") == 0) { //NOI18N | |
| 549 | 555 | work += subject.substring(3); |
| 550 | 556 | } else { |
| 551 | 557 | work += subject; |
| @@ -555,9 +561,9 @@ | ||
| 555 | 561 | spos = epos, epos = bi.next()) { |
| 556 | 562 | work = mesg.substring(spos, epos); |
| 557 | 563 | if (work.charAt(0) == '>') { |
| 558 | - wnd.addText(">" + work); | |
| 564 | + wnd.addText(">" + work); //NOI18N | |
| 559 | 565 | } else { |
| 560 | - wnd.addText("> " + work); | |
| 566 | + wnd.addText("> " + work); //NOI18N | |
| 561 | 567 | } |
| 562 | 568 | } |
| 563 | 569 | wnd.setVisible(true); |
| @@ -567,7 +573,7 @@ | ||
| 567 | 573 | /* reply article */ |
| 568 | 574 | public static void reply_article(String mesg) { |
| 569 | 575 | String work; |
| 570 | - String subject = ""; | |
| 576 | + String subject = ""; //NOI18N | |
| 571 | 577 | BreakIterator bi = BreakIterator.getLineInstance(); |
| 572 | 578 | bi.setText(mesg); |
| 573 | 579 | int spos = bi.first(); |
| @@ -577,13 +583,13 @@ | ||
| 577 | 583 | reserve_line > 0 && epos != BreakIterator.DONE; |
| 578 | 584 | reserve_line--, spos = epos, epos = bi.next()) { |
| 579 | 585 | work = mesg.substring(spos, epos); |
| 580 | - if (work.indexOf("Subject: ") == 0) { | |
| 586 | + if (work.indexOf(Hunt.getBundle().getString("SUBJECTMESG")) == 0) { | |
| 581 | 587 | subject = work.substring(9); |
| 582 | 588 | } |
| 583 | 589 | } |
| 584 | - work = "Re:"; | |
| 585 | - if (subject.indexOf("Re:") == 0 || subject.indexOf("RE:") == 0 | |
| 586 | - || subject.indexOf("re:") == 0) { | |
| 590 | + work = "Re:"; //NOI18N | |
| 591 | + if (subject.indexOf("Re:") == 0 || subject.indexOf("RE:") == 0 //NOI18N | |
| 592 | + || subject.indexOf("re:") == 0) { //NOI18N | |
| 587 | 593 | work += subject.substring(3); |
| 588 | 594 | } else { |
| 589 | 595 | work += subject; |
| @@ -593,9 +599,9 @@ | ||
| 593 | 599 | spos = epos, epos = bi.next()) { |
| 594 | 600 | work = mesg.substring(spos, epos); |
| 595 | 601 | if (work.charAt(0) == '>') { |
| 596 | - wnd.addText(">" + work); | |
| 602 | + wnd.addText(">" + work); //NOI18N | |
| 597 | 603 | } else { |
| 598 | - wnd.addText("> " + work); | |
| 604 | + wnd.addText("> " + work); //NOI18N | |
| 599 | 605 | } |
| 600 | 606 | } |
| 601 | 607 | wnd.setVisible(true); |
| @@ -607,11 +613,11 @@ | ||
| 607 | 613 | public static void view_help(Object obj) { |
| 608 | 614 | HuntMessageView hview = (HuntMessageView) messageView; |
| 609 | 615 | String wkline; |
| 610 | - hview.display("==== command list begin ===="); | |
| 616 | + hview.display(Hunt.getBundle().getString("COMMANDLIST_BEGIN")); | |
| 611 | 617 | try { |
| 612 | 618 | InputStream fis |
| 613 | - = obj.getClass().getResourceAsStream("hunt_help.utf8"); | |
| 614 | - InputStreamReader isr = new InputStreamReader(fis, "utf-8"); | |
| 619 | + = obj.getClass().getResourceAsStream("hunt_help.utf8"); //NOI18N | |
| 620 | + InputStreamReader isr = new InputStreamReader(fis, "utf-8"); //NOI18N | |
| 615 | 621 | try (BufferedReader fin = new BufferedReader(isr)) { |
| 616 | 622 | while ((wkline = fin.readLine()) != null) { |
| 617 | 623 | hview.display(wkline); |
| @@ -618,9 +624,9 @@ | ||
| 618 | 624 | } |
| 619 | 625 | } |
| 620 | 626 | } catch (IOException e) { |
| 621 | - hview.display("view_help:" + e.getLocalizedMessage()); | |
| 627 | + hview.display("view_help:" + e.getLocalizedMessage()); //NOI18N | |
| 622 | 628 | } |
| 623 | - hview.display("==== command list end ===="); | |
| 629 | + hview.display(Hunt.getBundle().getString("COMMANDLIST_END")); | |
| 624 | 630 | } |
| 625 | 631 | |
| 626 | 632 | /* make session */ |
| @@ -632,9 +638,11 @@ | ||
| 632 | 638 | } |
| 633 | 639 | |
| 634 | 640 | /* make client */ |
| 641 | + | |
| 635 | 642 | static void make_client() { |
| 636 | 643 | Rectangle r; |
| 637 | - mainWnd = new Frame("Hunter-online client [" + UserName + "]"); | |
| 644 | + mainWnd = new Frame(MessageFormat.format(Hunt.getBundle(). | |
| 645 | + getString("CLIENT_TITLEBAR"), new Object[]{UserName})); | |
| 638 | 646 | mainWnd.setLayout(new FlowLayout()); |
| 639 | 647 | mainWnd.addWindowListener(new HuntWndEvent()); |
| 640 | 648 | mainView = new HuntMainView(); |
| @@ -647,7 +655,7 @@ | ||
| 647 | 655 | |
| 648 | 656 | r = mainWnd.getBounds(); |
| 649 | 657 | statusView = new HuntStatusView(); |
| 650 | - statusView.setSize(220, 300); | |
| 658 | + statusView.setSize(300, 300); | |
| 651 | 659 | if (statusViewBounds != null) { |
| 652 | 660 | statusView.setBounds(statusViewBounds); |
| 653 | 661 | } else { |
| @@ -708,9 +716,9 @@ | ||
| 708 | 716 | try { |
| 709 | 717 | if (r != null) { |
| 710 | 718 | ofile.write(Integer.toString((int) r.x) + " " |
| 711 | - + Integer.toString((int) r.y) + " " | |
| 719 | + + Integer.toString((int) r.y) + " " //NOI18N | |
| 712 | 720 | + Integer.toString((int) r.width) + " " |
| 713 | - + Integer.toString((int) r.height)); | |
| 721 | + + Integer.toString((int) r.height)); //NOI18N | |
| 714 | 722 | } |
| 715 | 723 | ofile.newLine(); |
| 716 | 724 | } catch (IOException e) { |
| @@ -721,7 +729,7 @@ | ||
| 721 | 729 | public static void save() { |
| 722 | 730 | try { |
| 723 | 731 | try (BufferedWriter ofile |
| 724 | - = new BufferedWriter(new FileWriter("hunt_setup.def"))) { | |
| 732 | + = new BufferedWriter(new FileWriter("hunt_setup.def"))) { //NOI18N | |
| 725 | 733 | ofile.write(HostName); |
| 726 | 734 | ofile.newLine(); |
| 727 | 735 | ofile.write(Integer.toString(HostPort)); |
| @@ -733,7 +741,7 @@ | ||
| 733 | 741 | save_rect(ofile, messageViewBounds); |
| 734 | 742 | } |
| 735 | 743 | } catch (IOException e) { |
| 736 | - System.out.println("fail to save setup-file!"); | |
| 744 | + System.out.println("fail to save setup-file!"); //NOI18N | |
| 737 | 745 | } |
| 738 | 746 | } |
| 739 | 747 |
| @@ -747,22 +755,22 @@ | ||
| 747 | 755 | int width; |
| 748 | 756 | int height; |
| 749 | 757 | StringBuffer outstr = new StringBuffer(); |
| 750 | - work = getToken(work, " ", outstr); | |
| 758 | + work = getToken(work, " ", outstr); //NOI18N | |
| 751 | 759 | if (outstr.length() == 0) { |
| 752 | 760 | return null; |
| 753 | 761 | } |
| 754 | 762 | x = Integer.parseInt(outstr.toString()); |
| 755 | - work = getToken(work, " ", outstr); | |
| 763 | + work = getToken(work, " ", outstr); //NOI18N | |
| 756 | 764 | if (outstr.length() == 0) { |
| 757 | 765 | return null; |
| 758 | 766 | } |
| 759 | 767 | y = Integer.parseInt(outstr.toString()); |
| 760 | - work = getToken(work, " ", outstr); | |
| 768 | + work = getToken(work, " ", outstr); //NOI18N | |
| 761 | 769 | if (outstr.length() == 0) { |
| 762 | 770 | return null; |
| 763 | 771 | } |
| 764 | 772 | width = Integer.parseInt(outstr.toString()); |
| 765 | - getToken(work, " ", outstr); | |
| 773 | + getToken(work, " ", outstr); //NOI18N | |
| 766 | 774 | if (outstr.length() == 0) { |
| 767 | 775 | return null; |
| 768 | 776 | } |
| @@ -776,15 +784,15 @@ | ||
| 776 | 784 | |
| 777 | 785 | /* load connection parameters */ |
| 778 | 786 | public static void load() { |
| 779 | - HostName = ""; | |
| 787 | + HostName = ""; //NOI18N | |
| 780 | 788 | HostPort = DEFAULT_PORT; |
| 781 | - UserName = ""; | |
| 789 | + UserName = ""; //NOI18N | |
| 782 | 790 | mainWndBounds = null; |
| 783 | 791 | statusViewBounds = null; |
| 784 | 792 | messageViewBounds = null; |
| 785 | 793 | try { |
| 786 | 794 | try (BufferedReader ifile |
| 787 | - = new BufferedReader(new FileReader("hunt_setup.def"))) { | |
| 795 | + = new BufferedReader(new FileReader("hunt_setup.def"))) { //NOI18N | |
| 788 | 796 | String work; |
| 789 | 797 | work = ifile.readLine(); |
| 790 | 798 | if (work != null) { |
| @@ -830,7 +838,7 @@ | ||
| 830 | 838 | |
| 831 | 839 | /* emergency exit */ |
| 832 | 840 | public static void abort() { |
| 833 | - System.out.println("Abnormal termination."); | |
| 841 | + System.out.println("Abnormal termination."); //NOI18N | |
| 834 | 842 | if (rtask != null) { |
| 835 | 843 | rtask.terminate_task(); |
| 836 | 844 | } |
| @@ -759,6 +759,7 @@ | ||
| 759 | 759 | |
| 760 | 760 | @Override |
| 761 | 761 | public void keyPressed(KeyEvent e) { |
| 762 | + HuntMessageView hview; | |
| 762 | 763 | switch (e.getKeyCode()) { |
| 763 | 764 | case KeyEvent.VK_UP: |
| 764 | 765 | case KeyEvent.VK_NUMPAD8: |
| @@ -820,7 +821,11 @@ | ||
| 820 | 821 | Hunt.getSendTask().doFire(2); |
| 821 | 822 | break; |
| 822 | 823 | case KeyEvent.VK_SLASH: |
| 823 | - HuntMessageView hview = (HuntMessageView) Hunt.getMessageView(); | |
| 824 | + hview = (HuntMessageView) Hunt.getMessageView(); | |
| 825 | + hview.setFocus("/"); | |
| 826 | + break; | |
| 827 | + case KeyEvent.VK_ENTER: | |
| 828 | + hview = (HuntMessageView) Hunt.getMessageView(); | |
| 824 | 829 | hview.setFocus(); |
| 825 | 830 | break; |
| 826 | 831 | } |
| @@ -10,13 +10,13 @@ | ||
| 10 | 10 | |
| 11 | 11 | @SuppressWarnings("LeakingThisInConstructor") |
| 12 | 12 | HuntMessageView() { |
| 13 | - super("message"); | |
| 13 | + super(Hunt.getBundle().getString("TITLE_MESSAGE")); | |
| 14 | 14 | messageList = new TextArea(10, 80); |
| 15 | 15 | messageList.setEditable(false); |
| 16 | - messageList.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); | |
| 16 | + messageList.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 16)); | |
| 17 | 17 | add(messageList, BorderLayout.CENTER); |
| 18 | 18 | editWnd = new TextField(); |
| 19 | - editWnd.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); | |
| 19 | + editWnd.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 16)); | |
| 20 | 20 | add(editWnd, BorderLayout.SOUTH); |
| 21 | 21 | editWnd.addActionListener(this); |
| 22 | 22 | setResizable(true); |
| @@ -25,10 +25,17 @@ | ||
| 25 | 25 | |
| 26 | 26 | public void display(String s) { |
| 27 | 27 | messageList.append(s); |
| 28 | - messageList.append("\n"); | |
| 28 | + messageList.append("\n"); //NOI18N | |
| 29 | 29 | messageList.setCaretPosition(Integer.MAX_VALUE); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | + public void setFocus(String s) { | |
| 33 | + toFront(); | |
| 34 | + editWnd.setText(s); | |
| 35 | + editWnd.setCaretPosition(s.length()); | |
| 36 | + editWnd.requestFocus(); | |
| 37 | + } | |
| 38 | + | |
| 32 | 39 | public void setFocus() { |
| 33 | 40 | toFront(); |
| 34 | 41 | editWnd.requestFocus(); |
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | |
| 19 | 19 | @SuppressWarnings("LeakingThisInConstructor") |
| 20 | 20 | HuntLoginWnd() { |
| 21 | - super("Login"); | |
| 21 | + super(Hunt.getBundle().getString("LOGINTITLE")); | |
| 22 | 22 | Label label; |
| 23 | 23 | Button button; |
| 24 | 24 | Panel panel; |
| @@ -27,10 +27,12 @@ | ||
| 27 | 27 | addWindowListener(new HuntLoginWndEvent()); |
| 28 | 28 | setLayout(layout); |
| 29 | 29 | |
| 30 | + setFont(new Font(Font.MONOSPACED, Font.PLAIN, 16)); | |
| 31 | + | |
| 30 | 32 | gridbag.anchor = GridBagConstraints.WEST; |
| 31 | 33 | gridbag.fill = GridBagConstraints.NONE; |
| 32 | 34 | gridbag.gridwidth = 1; |
| 33 | - label = new Label("Host:"); | |
| 35 | + label = new Label(Hunt.getBundle().getString("LOGINHOST")); | |
| 34 | 36 | layout.setConstraints(label, gridbag); |
| 35 | 37 | add(label); |
| 36 | 38 |
| @@ -43,7 +45,7 @@ | ||
| 43 | 45 | |
| 44 | 46 | gridbag.fill = GridBagConstraints.NONE; |
| 45 | 47 | gridbag.gridwidth = 1; |
| 46 | - label = new Label("Port:"); | |
| 48 | + label = new Label(Hunt.getBundle().getString("LOGINPORT")); | |
| 47 | 49 | layout.setConstraints(label, gridbag); |
| 48 | 50 | add(label); |
| 49 | 51 |
| @@ -55,7 +57,7 @@ | ||
| 55 | 57 | |
| 56 | 58 | gridbag.fill = GridBagConstraints.NONE; |
| 57 | 59 | gridbag.gridwidth = 1; |
| 58 | - label = new Label("UserName:"); | |
| 60 | + label = new Label(Hunt.getBundle().getString("LOGINUSERNAME")); | |
| 59 | 61 | layout.setConstraints(label, gridbag); |
| 60 | 62 | add(label); |
| 61 | 63 |
| @@ -66,7 +68,7 @@ | ||
| 66 | 68 | add(username); |
| 67 | 69 | |
| 68 | 70 | gridbag.gridwidth = 1; |
| 69 | - label = new Label("PassWord:"); | |
| 71 | + label = new Label(Hunt.getBundle().getString("LOGINPASSWORD")); | |
| 70 | 72 | layout.setConstraints(label, gridbag); |
| 71 | 73 | add(label); |
| 72 | 74 |
| @@ -78,18 +80,19 @@ | ||
| 78 | 80 | password.addActionListener(this); |
| 79 | 81 | |
| 80 | 82 | gridbag.gridwidth = 1; |
| 81 | - label = new Label(""); | |
| 83 | + label = new Label(""); //NOI18N | |
| 82 | 84 | layout.setConstraints(label, gridbag); |
| 83 | 85 | add(label); |
| 84 | 86 | |
| 85 | 87 | gridbag.gridwidth = GridBagConstraints.REMAINDER; |
| 86 | - newuser = new Checkbox("Make New User", false); | |
| 88 | + newuser = new Checkbox(Hunt.getBundle().getString("LOGIN_MAKENEWUSER"), | |
| 89 | + false); | |
| 87 | 90 | layout.setConstraints(newuser, gridbag); |
| 88 | 91 | add(newuser); |
| 89 | 92 | newuser.addItemListener(this); |
| 90 | 93 | |
| 91 | 94 | gridbag.gridwidth = 1; |
| 92 | - label = new Label("Create Key:"); | |
| 95 | + label = new Label(Hunt.getBundle().getString("LOGINCREATEKEY")); | |
| 93 | 96 | layout.setConstraints(label, gridbag); |
| 94 | 97 | add(label); |
| 95 | 98 |
| @@ -103,47 +106,60 @@ | ||
| 103 | 106 | |
| 104 | 107 | typeselect = new CheckboxGroup(); |
| 105 | 108 | gridbag.gridwidth = 1; |
| 106 | - label = new Label("Class:"); | |
| 109 | + label = new Label(Hunt.getBundle().getString("LOGINCLASS")); | |
| 107 | 110 | layout.setConstraints(label, gridbag); |
| 108 | 111 | add(label); |
| 109 | 112 | |
| 110 | 113 | gridbag.gridwidth = GridBagConstraints.REMAINDER; |
| 111 | - hunterbox = new Checkbox("Animal Hunter", typeselect, true); | |
| 114 | + hunterbox = new Checkbox(Hunt.getBundle(). | |
| 115 | + getString("CLASS_ANIMALHUNTER"), typeselect, true); | |
| 112 | 116 | layout.setConstraints(hunterbox, gridbag); |
| 113 | 117 | add(hunterbox); |
| 114 | 118 | hunterbox.setEnabled(false); |
| 115 | 119 | |
| 116 | 120 | gridbag.gridwidth = 1; |
| 117 | - label = new Label(""); | |
| 121 | + label = new Label(""); //NOI18N | |
| 118 | 122 | layout.setConstraints(label, gridbag); |
| 119 | 123 | add(label); |
| 120 | 124 | |
| 121 | 125 | gridbag.gridwidth = GridBagConstraints.REMAINDER; |
| 122 | - guardbox = new Checkbox("Guard of Honor", typeselect, false); | |
| 126 | + guardbox = new Checkbox(Hunt.getBundle().getString("CLASS_GUARD"), | |
| 127 | + typeselect, false); | |
| 123 | 128 | layout.setConstraints(guardbox, gridbag); |
| 124 | 129 | add(guardbox); |
| 125 | 130 | guardbox.setEnabled(false); |
| 126 | 131 | |
| 132 | + panel = new Panel(); | |
| 133 | + gridbag.fill = GridBagConstraints.BOTH; | |
| 134 | + layout.setConstraints(panel, gridbag); | |
| 135 | + add(panel); | |
| 136 | + layout = new GridBagLayout(); | |
| 137 | + panel.setLayout(layout); | |
| 138 | + | |
| 127 | 139 | gridbag.anchor = GridBagConstraints.CENTER; |
| 140 | + gridbag.insets.set(8, 8, 0, 0); | |
| 141 | + gridbag.fill = GridBagConstraints.BOTH; | |
| 128 | 142 | gridbag.gridwidth = 1; |
| 129 | 143 | gridbag.weightx = 1.0; |
| 130 | - button = new Button("Login"); | |
| 144 | + button = new Button(Hunt.getBundle().getString("BUTTONLOGIN")); | |
| 131 | 145 | layout.setConstraints(button, gridbag); |
| 132 | - add(button); | |
| 133 | - button.setActionCommand("LOGIN"); | |
| 146 | + panel.add(button); | |
| 147 | + button.setActionCommand("LOGIN"); //NOI18N | |
| 134 | 148 | button.addActionListener(this); |
| 135 | 149 | |
| 136 | - gridbag.gridwidth = GridBagConstraints.REMAINDER; | |
| 137 | - gridbag.weightx = 0; | |
| 138 | - button = new Button("Close"); | |
| 150 | + button = new Button(Hunt.getBundle().getString("BUTTONCLOSE")); | |
| 139 | 151 | layout.setConstraints(button, gridbag); |
| 140 | - add(button); | |
| 141 | - button.setActionCommand("CLOSE"); | |
| 152 | + panel.add(button); | |
| 153 | + button.setActionCommand("CLOSE"); //NOI18N | |
| 142 | 154 | button.addActionListener(this); |
| 143 | 155 | |
| 144 | - panel = new Panel(); | |
| 145 | - layout.setConstraints(panel, gridbag); | |
| 146 | - add(panel); | |
| 156 | + gridbag.gridwidth = GridBagConstraints.REMAINDER; | |
| 157 | + gridbag.insets.set(0, 0, 0, 0); | |
| 158 | + gridbag.fill = GridBagConstraints.NONE; | |
| 159 | + gridbag.weightx = 0; | |
| 160 | + label = new Label(""); | |
| 161 | + layout.setConstraints(label, gridbag); | |
| 162 | + panel.add(label); | |
| 147 | 163 | |
| 148 | 164 | pack(); |
| 149 | 165 |
| @@ -170,7 +186,7 @@ | ||
| 170 | 186 | @Override |
| 171 | 187 | public void actionPerformed(ActionEvent e) { |
| 172 | 188 | String cmd = e.getActionCommand(); |
| 173 | - if (cmd.compareTo("LOGIN") == 0) { | |
| 189 | + if (cmd.compareTo("LOGIN") == 0) { //NOI18N | |
| 174 | 190 | setVisible(false); |
| 175 | 191 | Hunt.setHostName(hostaddr.getText()); |
| 176 | 192 | Hunt.setHostPort(Integer.parseInt(hostport.getText())); |
| @@ -183,8 +199,9 @@ | ||
| 183 | 199 | Hunt.login_server(); |
| 184 | 200 | } |
| 185 | 201 | dispose(); |
| 186 | - } else if (cmd.compareTo("CLOSE") == 0) { | |
| 202 | + } else if (cmd.compareTo("CLOSE") == 0) { //NOI18N | |
| 187 | 203 | dispose(); |
| 204 | + System.exit(0); | |
| 188 | 205 | } else { |
| 189 | 206 | Component cp = (Component) e.getSource(); |
| 190 | 207 | cp.transferFocus(); |
| @@ -198,6 +215,7 @@ | ||
| 198 | 215 | @Override |
| 199 | 216 | public void windowClosing(WindowEvent e) { |
| 200 | 217 | e.getWindow().dispose(); |
| 218 | + System.exit(0); | |
| 201 | 219 | } |
| 202 | 220 | } |
| 203 | 221 |
| @@ -27,10 +27,10 @@ | ||
| 27 | 27 | void doServerResult() { |
| 28 | 28 | if (buffer[2] == 0) { |
| 29 | 29 | /* OK */ |
| 30 | - System.out.println("success to login."); | |
| 30 | + System.out.println(Hunt.getBundle().getString("MESG_SUCCESSLOGIN")); | |
| 31 | 31 | } else { |
| 32 | 32 | /* NG */ |
| 33 | - System.out.println("Fail to login server!"); | |
| 33 | + System.out.println(Hunt.getBundle().getString("MESG_FAILLOGIN")); | |
| 34 | 34 | Hunt.abort(); |
| 35 | 35 | } |
| 36 | 36 | } |
| @@ -71,17 +71,17 @@ | ||
| 71 | 71 | username = new String(buffer, n, Hunt.USERNAME_LEN, |
| 72 | 72 | Hunt.SYSTEM_CHARSET); |
| 73 | 73 | } catch (UnsupportedEncodingException e) { |
| 74 | - username = "?"; | |
| 74 | + username = "?"; //NOI18N | |
| 75 | 75 | } |
| 76 | 76 | n += Hunt.USERNAME_LEN; |
| 77 | 77 | work = username; |
| 78 | - work += " tell you,"; | |
| 78 | + work += " tell you,"; //NOI18N | |
| 79 | 79 | nlen = (int) buffer[n++]; |
| 80 | 80 | if (nlen > 0) { |
| 81 | 81 | try { |
| 82 | 82 | message = new String(buffer, n, nlen, Hunt.SYSTEM_CHARSET); |
| 83 | 83 | } catch (UnsupportedEncodingException e) { |
| 84 | - message = "?"; | |
| 84 | + message = "?"; //NOI18N | |
| 85 | 85 | } |
| 86 | 86 | work += message; |
| 87 | 87 | } |
| @@ -98,7 +98,7 @@ | ||
| 98 | 98 | try { |
| 99 | 99 | message = new String(buffer, n, nlen, Hunt.SYSTEM_CHARSET); |
| 100 | 100 | } catch (UnsupportedEncodingException e) { |
| 101 | - message = "?"; | |
| 101 | + message = "?"; //NOI18N | |
| 102 | 102 | } |
| 103 | 103 | Hunt.display_message(message); |
| 104 | 104 | } |
| @@ -114,26 +114,26 @@ | ||
| 114 | 114 | username = new String(buffer, n, Hunt.USERNAME_LEN, |
| 115 | 115 | Hunt.SYSTEM_CHARSET); |
| 116 | 116 | } catch (UnsupportedEncodingException e) { |
| 117 | - username = "?"; | |
| 117 | + username = "?"; //NOI18N | |
| 118 | 118 | } |
| 119 | 119 | n += Hunt.USERNAME_LEN; |
| 120 | 120 | wk_score = Hunt.ntohl(buffer, n); |
| 121 | 121 | n += 4; |
| 122 | - work = "<"; | |
| 122 | + work = "<"; //NOI18N | |
| 123 | 123 | if (buffer[n + 1] != 0) { |
| 124 | - work += "GUARD :"; | |
| 124 | + work += Hunt.getBundle().getString("WHOLIST_GUARD"); | |
| 125 | 125 | } else { |
| 126 | - work += "HUNTER:"; | |
| 126 | + work += Hunt.getBundle().getString("WHOLIST_HUNTER"); | |
| 127 | 127 | } |
| 128 | 128 | work += username; |
| 129 | - work += " "; | |
| 130 | - DecimalFormat form = new DecimalFormat("#########0"); | |
| 129 | + work += " "; //NOI18N | |
| 130 | + DecimalFormat form = new DecimalFormat("#########0"); //NOI18N | |
| 131 | 131 | work += form.format(wk_score); |
| 132 | - work += "Point "; | |
| 132 | + work += Hunt.getBundle().getString("LABEL_POINT"); | |
| 133 | 133 | if (buffer[n] != 0) { |
| 134 | - work += "ON-Line >"; | |
| 134 | + work += Hunt.getBundle().getString("WHOLIST_ONLINE"); | |
| 135 | 135 | } else { |
| 136 | - work += "Off-Line>"; | |
| 136 | + work += Hunt.getBundle().getString("WHOLIST_OFFLINE"); | |
| 137 | 137 | } |
| 138 | 138 | Hunt.display_message(work); |
| 139 | 139 | } |
| @@ -189,39 +189,40 @@ | ||
| 189 | 189 | subject = new String(buffer, 2 + Hunt.USERNAME_LEN + 5, n, |
| 190 | 190 | Hunt.SYSTEM_CHARSET); |
| 191 | 191 | } catch (UnsupportedEncodingException e) { |
| 192 | - subject = "?"; | |
| 192 | + subject = "?"; //NOI18N | |
| 193 | 193 | } |
| 194 | 194 | } else { |
| 195 | - subject = ""; | |
| 195 | + subject = ""; //NOI18N | |
| 196 | 196 | } |
| 197 | 197 | try { |
| 198 | 198 | username = new String(buffer, 2, Hunt.USERNAME_LEN, |
| 199 | 199 | Hunt.SYSTEM_CHARSET); |
| 200 | 200 | } catch (UnsupportedEncodingException e) { |
| 201 | - username = "?"; | |
| 201 | + username = "?"; //NOI18N | |
| 202 | 202 | } |
| 203 | 203 | if (bbsmode != 0) { |
| 204 | 204 | /* bbs article */ |
| 205 | - work = "Article ["; | |
| 205 | + work = Hunt.getBundle().getString("HEADER_ARTICLE"); | |
| 206 | 206 | work += username; |
| 207 | - work += "]"; | |
| 207 | + work += "]"; //NOI18N | |
| 208 | 208 | work += subject; |
| 209 | 209 | } else { |
| 210 | 210 | /* mail message */ |
| 211 | - work = "From "; | |
| 211 | + work = Hunt.getBundle().getString("MAIL_HEADER"); | |
| 212 | 212 | work += username; |
| 213 | 213 | } |
| 214 | 214 | hreadwnd.setTitle(work); |
| 215 | - work = "From "; | |
| 215 | + work = Hunt.getBundle().getString("TITLE_FROM"); | |
| 216 | 216 | work += username; |
| 217 | - work += "\nDate:"; | |
| 217 | + work += Hunt.getBundle().getString("TITLE_DATE"); | |
| 218 | 218 | DateFormat df |
| 219 | - = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL); | |
| 219 | + = DateFormat.getDateTimeInstance(DateFormat.FULL, | |
| 220 | + DateFormat.FULL); | |
| 220 | 221 | Date ntime = new Date(Hunt.ntohl(buffer, 2 + Hunt.USERNAME_LEN) * 1000); |
| 221 | 222 | work += df.format(ntime); |
| 222 | - work += "\nSubject: "; | |
| 223 | + work += Hunt.getBundle().getString("TITLE_SUBJECT"); | |
| 223 | 224 | work += subject; |
| 224 | - work += "\n\n"; | |
| 225 | + work += "\n\n"; //NOI18N | |
| 225 | 226 | hreadwnd.addText(work); |
| 226 | 227 | } |
| 227 | 228 |
| @@ -234,12 +235,12 @@ | ||
| 234 | 235 | try { |
| 235 | 236 | work = new String(buffer, 3, nlen, Hunt.SYSTEM_CHARSET); |
| 236 | 237 | } catch (UnsupportedEncodingException e) { |
| 237 | - work = "?"; | |
| 238 | + work = "?"; //NOI18N | |
| 238 | 239 | } |
| 239 | 240 | } else { |
| 240 | - work = ""; | |
| 241 | + work = ""; //NOI18N | |
| 241 | 242 | } |
| 242 | - work += "\n"; | |
| 243 | + work += "\n"; //NOI18N | |
| 243 | 244 | hreadwnd.addText(work); |
| 244 | 245 | } |
| 245 | 246 | } |
| @@ -310,9 +311,10 @@ | ||
| 310 | 311 | doMailBodyEnd(); |
| 311 | 312 | break; |
| 312 | 313 | default: |
| 313 | - System.out.println("What's? [" | |
| 314 | + System.out.println(Hunt.getBundle(). | |
| 315 | + getString("ERRMESG_WHATPACKET") | |
| 314 | 316 | + Integer.toHexString((int) buffer[0] & 0xff) |
| 315 | - + "]"); | |
| 317 | + + "]"); //NOI18N | |
| 316 | 318 | } |
| 317 | 319 | } |
| 318 | 320 |
| @@ -330,7 +332,8 @@ | ||
| 330 | 332 | process_response(); |
| 331 | 333 | } |
| 332 | 334 | } else { |
| 333 | - System.out.println("Connection closed."); | |
| 335 | + System.out.println(Hunt.getBundle(). | |
| 336 | + getString("MESG_CONNECTIONCLOSE")); | |
| 334 | 337 | Hunt.shutdown(); |
| 335 | 338 | break; |
| 336 | 339 | } |
| @@ -11,9 +11,12 @@ | ||
| 11 | 11 | HuntReadWnd(boolean barticle) { |
| 12 | 12 | super(); |
| 13 | 13 | MenuBar mb = new MenuBar(); |
| 14 | - HuntMenu hm = new HuntMenu((barticle == true) ? "BBS" : "Mail"); | |
| 14 | + HuntMenu hm = new HuntMenu((barticle == true) | |
| 15 | + ? Hunt.getBundle().getString("TITLE_BBS") | |
| 16 | + : Hunt.getBundle().getString("TITLE_MAIL")); | |
| 15 | 17 | hm.addActionListener(this); |
| 16 | - hm.addMenu("Reply", (barticle == true) ? "ReplyArticle" : "ReplyMail"); | |
| 18 | + hm.addMenu(Hunt.getBundle().getString("MENU_REPLY"), | |
| 19 | + (barticle == true) ? "ReplyArticle" : "ReplyMail"); | |
| 17 | 20 | mb.add(hm); |
| 18 | 21 | setMenuBar(mb); |
| 19 | 22 | tarea = new TextArea(25, 80); |
| @@ -37,12 +40,12 @@ | ||
| 37 | 40 | @Override |
| 38 | 41 | public void actionPerformed(ActionEvent e) { |
| 39 | 42 | String cmd = e.getActionCommand(); |
| 40 | - if (cmd.compareTo("ReplyMail") == 0) { | |
| 43 | + if (cmd.compareTo("ReplyMail") == 0) { //NOI18N | |
| 41 | 44 | /* reply mail */ |
| 42 | 45 | String title = getTitle(); |
| 43 | 46 | String mesg = tarea.getText(); |
| 44 | 47 | Hunt.reply_mail(title.substring(5), mesg); |
| 45 | - } else if (cmd.compareTo("ReplyArticle") == 0) { | |
| 48 | + } else if (cmd.compareTo("ReplyArticle") == 0) { //NOI18N | |
| 46 | 49 | /* reply article */ |
| 47 | 50 | String mesg = tarea.getText(); |
| 48 | 51 | Hunt.reply_article(mesg); |