Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final String CONSUMER_KEY = "HHrGLrxxxxxxxxxxxk4jh534j";
- final String CONSUMER_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
- final String ACCESS_TOKEN = "1588987572-WJOKl3jsRkfxxxxxxxxxxxxx";
- final String ACCESS_TOKEN_SECRET = "qgioo3BhLTxxxxxxxxxxxxxxxxxx";
- ConfigurationBuilder builder = new ConfigurationBuilder();
- builder.setOAuthConsumerKey(CONSUMER_KEY);
- builder.setOAuthConsumerSecret(CONSUMER_SECRET);
- Configuration configuration = builder.build();
- TwitterFactory factory = new TwitterFactory(configuration);
- Twitter twitter = factory.getInstance();
- twitter.setOAuthAccessToken(new AccessToken(ACCESS_TOKEN, ACCESS_TOKEN_SECRET));`
- JLabel lblUserName = new JLabel("User Name : ");
- textField = new JTextField();
- textField.setColumns(10);
- JLabel lblPassword = new JLabel("Password : ");
- passwordField = new JPasswordField();
- JButton btnLogin = new JButton("Login");
- btnLogin.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- try{
- String userName = textField.getText();
- String password = String.valueOf(passwordField.getPassword());
- Twitter twitter = new Twitter(userName, password);//there I'm getting this error "Cannot instantiate the type Twitter"
- twitter.verifyCredentials();
- JOptionPane.showMessageDialog(null, "You're logged in!");
- }catch (TwitterException e1) {
- JOptionPane.showMessageDialog(null, "Login failed!");
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement