Make button direct to link java
Go to solution
Solved by Jefroy,
You have to implement ActionListener to your class than add it your button like this:
button.addActionListener(this);
than in the actionPerformed you check if the source is your button than open the website:
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == button){
Desktop.getDesktop().browse(new URL("https://google.com").toURI());
}
}

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now