コード例 #1
0
 private void authorizeButtonActionPerformed(ActionEvent e) {
   String accountName = accountNameField.getText().trim();
   if (accountName.length() > 0 && !accountName.contains(" ")) {
     String URL =
         "https://api.twitch.tv/kraken/oauth2/authorize"
             + "?response_type=token"
             + "&client_id=qw8d3ve921t0n6e3if07l664f1jn1y7"
             + "&redirect_uri=http://gocnak.github.io/Botnak/token_redirect.html"
             + "&scope=chat_login";
     if (boxReadSubs.isSelected()) URL += "+channel_subscriptions";
     if (boxCommercial.isSelected()) URL += "+channel_commercial";
     if (boxEditStatus.isSelected()) URL += "+channel_editor";
     if (boxFollowed.isSelected()) URL += "+user_read";
     Utils.openWebPage(URL);
     if (listener == null || !listener.isAlive()) {
       listener = new TokenListener(this);
       listener.start();
     }
   } else {
     statusPane.setText("Failed to authorize account, invalid account name!");
   }
 }
コード例 #2
0
 @Override
 public void dispose() {
   if (listener != null && listener.isAlive()) listener.interrupt();
   listener = null;
   super.dispose();
 }