Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Adding / Inserting hyperlink in jbutton.

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Adding / Inserting hyperlink in jbutton.

    Hello im new in creating java awt , swing application but this is a part of my school project thats why im asking for help and idea.

    about the topic is this possible to be happen? to add hyperlink in different jbuttons so
    when the user click the button the browser will automatically open and redirect them to the website given from the jbutton..
    if so, could anyone pls explain it to me how i could do this and apply for my project gui..

    i made a research already in google and found Desktop class and URI but still confusing about how to use these classes..

    any answer must be appreciated.

    btw, im using netbeans as my compiler to design my java gui project and it seems the codes from the netbean compiler for java are messy


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Adding / Inserting hyperlink in jbutton.

    netbeans as my compiler to design my java gui project and it seems the codes from the netbean compiler for java are messy
    Netbeans is a fancy source code editor or an IDE - Integrated Development Environment - not a compiler. If you're using the GUIBuilder, yes, it creates code that is difficult to read, modify, and maintain. You're better off learning how to code with Swing by hand.

    You can program a button to do most anything you want by attaching a listener to it and then programming the listener to do the desired action when the button is pressed. Start with this tutorial, and come back when you need help. We won't tell you how to do it in existing GUIBuilder code, because that is modified using Netbeans. You'll have to refer to the Netbeans documentation for that.

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    jedmustdie (February 1st, 2014)

  4. #3
    Junior Member
    Join Date
    Jan 2014
    Posts
    14
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Adding / Inserting hyperlink in jbutton.

    Quote Originally Posted by GregBrannon View Post
    Netbeans is a fancy source code editor or an IDE - Integrated Development Environment - not a compiler. If you're using the GUIBuilder, yes, it creates code that is difficult to read, modify, and maintain. You're better off learning how to code with Swing by hand.

    You can program a button to do most anything you want by attaching a listener to it and then programming the listener to do the desired action when the button is pressed. Start with this tutorial, and come back when you need help. We won't tell you how to do it in existing GUIBuilder code, because that is modified using Netbeans. You'll have to refer to the Netbeans documentation for that.
    ok, thank you sir .

  5. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Adding / Inserting hyperlink in jbutton.

    After you've reviewed the tutorial, you may learn something from the example provided by andbin in Post #13 of this thread.

  6. The Following User Says Thank You to GregBrannon For This Useful Post:

    jedmustdie (February 1st, 2014)

Similar Threads

  1. Adding JPanel using Jbutton, Expanding JFrame as needed.
    By ShadowMystic in forum AWT / Java Swing
    Replies: 1
    Last Post: February 24th, 2013, 09:13 AM
  2. adding int when you press a jbutton
    By op117 in forum AWT / Java Swing
    Replies: 21
    Last Post: December 30th, 2012, 10:32 PM
  3. JButton, adding a Listener to stop and start?
    By spunkyk014 in forum Object Oriented Programming
    Replies: 1
    Last Post: November 16th, 2012, 09:30 AM
  4. Adding an actionlistener to a JButton with no text
    By captain in forum AWT / Java Swing
    Replies: 1
    Last Post: April 5th, 2012, 02:20 PM
  5. Error when adding ActionListener to JButton
    By grimrader22 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 10th, 2011, 06:53 AM