Thread: GUI Help

Results 1 to 4 of 4
  1. #1 GUI Help 
    Registered Member TehByte's Avatar
    Join Date
    Nov 2008
    Age
    28
    Posts
    311
    Thanks given
    29
    Thanks received
    6
    Rep Power
    68
    How do I create a link button in a Java GUI?
    At the moment I have this code for the button I want to link:

    Code:
    	private JButton websitebutton;
    	public StartupGUI() {
    		websitebutton = new JButton("Visit our website");
    		add (websitebutton);
            }
    Please help if you can, I will rep+

    Thanks
    Reply With Quote  
     

  2. #2  
    Community Veteran



    Join Date
    Jan 2008
    Posts
    3,444
    Thanks given
    46
    Thanks received
    973
    Rep Power
    4748
    add a listener for it

    Reply With Quote  
     

  3. #3  
    Renown Programmer

    Nikki's Avatar
    Join Date
    Aug 2008
    Posts
    3,992
    Thanks given
    553
    Thanks received
    1,078
    Rep Power
    5000
    Quote Originally Posted by Richard1992 View Post
    add a listener for it
    After that, look in rs2 client, and find the "Opening urls", get the open method to find the browser, then implement it into that.
    Please don't add/pm me asking for RSPS help!

    Links:
    - Pastebin
    - Sleeksnap

    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Sep 2009
    Posts
    122
    Thanks given
    2
    Thanks received
    0
    Rep Power
    47
    would be something like this:

    static class Action implements ActionListener {
    public void actionPerformed(ActionEvent event){
    Object site = event.getSource();

    if(site == button) {
    try {
    Desktop d = Desktop.getDesktop();
    d.browse(new URI("www.google.com"));
    } catch (Exception e) {
    }
    }
    }
    █║▌│█│║▌║││█║▌│║▌║
    ORIGINAL PROFILE ®

    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •