Пример #1
0
 void keyPressed(int keyCode) {
   switch (keyCode) {
     case KeyEvent.KEYCODE_DPAD_UP:
       line--;
       if (line < 0) {
         line = getLineCount() - 1;
       }
       break;
     case KeyEvent.KEYCODE_DPAD_LEFT:
       page--;
       if (page < 0) {
         page = getPageCount() - 1;
       }
       if (line > getLineCount() - 1) {
         line = getLineCount() - 1;
       }
       break;
     case KeyEvent.KEYCODE_DPAD_RIGHT:
       page++;
       if (page >= getPageCount()) {
         page = 0;
       }
       if (line > getLineCount() - 1) {
         line = getLineCount() - 1;
       }
       break;
     case KeyEvent.KEYCODE_DPAD_DOWN:
       line++;
       if (line >= getLineCount()) {
         line = 0;
       }
       break;
     case KeyEvent.KEYCODE_ENTER: // ��
       try {
         String boardName = boards.get(getCurrentIndex()).getName();
         BbsBoard board = mona.getBoardByName(boardName);
         mona.setTargetBoard(board);
         threadVC.setModel(board.getThreads());
         mode = MODE_THREAD;
         System.err.println("MODE: THREAD");
       } catch (Exception e) {
         e.printStackTrace(System.err);
         status = "5:" + e;
       }
       break;
     case 461: // ��
     case KeyEvent.KEYCODE_SPACE:
     case KeyEvent.KEYCODE_BACK:
       break;
   }
   // System.err.println("boardLine: " + boardLine + "/" + (getLineCount() - 1) + ", " +
   // boardPage + "/" + (getPageCount() - 1));
 }
Пример #2
0
      void paint(Canvas g) {
        paint.setColor(Color.BLACK);
        paint.setStyle(Style.FILL);
        g.drawRect(0, 0, getWidth(), getHeight(), paint);

        paint.setColor(Color.YELLOW);
        String boardMode = "�� �‘I�� " + (page + 1) + "/" + getPageCount();
        g.drawText(boardMode, fontSize, fontSize * 2, paint);

        for (int i = 0; i < getLineCount(); i++) {
          String cursor;
          if (line == i) {
            paint.setColor(Color.BLUE);
            cursor = "��";
          } else {
            paint.setColor(Color.WHITE);
            cursor = "�@";
          }
          BbsBoard board = boards.get(getIndex(i));
          String boardName = cursor + board.getName();
          g.drawText(boardName, fontSize, i * fontSize * 2 + fontSize * 4, paint);
        }
      }