예제 #1
0
  public void applyFont(FontType type, FontData data) {
    Font newFont = new Font(SwtUtils.DISPLAY, data);
    Font oldFont = null;

    switch (type) {
      case GLOBAL:
        {
          oldFont = iniAppearance.getFontGlobal();

          for (Control control : controls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          for (Label label : labels) {
            if (label.isDisposed()) continue;

            label.setFont(newFont);
          }

          for (Button button : buttons) {
            if (button.isDisposed()) continue;

            button.setFont(newFont);
          }

          iniAppearance.setFontGlobal(newFont);
          break;
        }
      case LOG:
        {
          oldFont = iniAppearance.getFontLog();

          for (StyledText control : logControls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          iniAppearance.setFontLog(newFont);
          break;
        }
      case CHAT:
        {
          oldFont = iniAppearance.getFontChat();

          for (Text control : chatControls) {
            if (control.isDisposed()) continue;

            control.setFont(newFont);
          }

          iniAppearance.setFontChat(newFont);
          break;
        }
    }

    if (oldFont != null) oldFont.dispose();
  }
예제 #2
0
  public void initChatControl(Text chat) {
    chat.setFont(iniAppearance.getFontChat());
    chat.setBackground(iniAppearance.getColorBackground());
    chat.setForeground(iniAppearance.getColorForeground());

    chatControls.add(chat);
  }