示例#1
0
  public void show(boolean forceShow) {

    Properties tipProperties = Tips.get().getTips();

    TipOfTheDayModel loadedTips = TipLoader.load(tipProperties);

    final boolean settingsShowDialog = Settings.get().isShowTipsAtStartup();

    JXTipOfTheDay tipOfTheDay = new JXTipOfTheDay(loadedTips);

    Random generator = new Random();
    int i = generator.nextInt(loadedTips.getTipCount());
    tipOfTheDay.setCurrentTip(i);

    tipOfTheDay.showDialog(
        Application.get(),
        new JXTipOfTheDay.ShowOnStartupChoice() {
          @Override
          public void setShowingOnStartup(boolean showOnStartup) {
            Settings.get().setShowTipsAtStartup(showOnStartup);
          }

          @Override
          public boolean isShowingOnStartup() {
            return settingsShowDialog && !Settings.get().isProxyEnabled();
          }
        },
        forceShow);
  }
示例#2
0
 public void run() {
   if (infoLabel.getText().equals("")) {
     tipsLabel.setText(Tips.get().getRandomTip());
   }
 }