How do I go to a web site when I click on a button ?

Hello
I am going a GUI program that would go to a program or a web site when a button is clicked. What do I have to do to access a web site ?
for instance:     if (e.getSource() == myJButtonBible)
          // go to www.nccbuscc.org/nab/index.htm
        }What do I add to the code to access a web site ? ?
below is the drive class.
Thank you in advance
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import java.awt.event.*;
public class TryGridLayout
  public TryGridLayout() {
    JFrame myJFrame = new JFrame("Choose your program");
    Toolkit myToolkit = myJFrame.getToolkit();
    Dimension myScreenSize = myToolkit.getDefaultToolkit().getScreenSize();
    //Center of screen and set size to half the screen size
    myJFrame.setBounds(myScreenSize.width / 4, myScreenSize.height / 4,
                       myScreenSize.width / 2, myScreenSize.height / 2);
    //change the background color
    myJFrame.getContentPane().setBackground(Color.yellow);
    //create the layout manager
    GridLayout myGridLayout = new GridLayout(2, 2);
    //get the content pane
    Container myContentPane = myJFrame.getContentPane();
    //set the container layout manager
    myContentPane.setLayout(myGridLayout);
    //create an object to hold the button's style
    Border myEdge = BorderFactory.createRaisedBevelBorder();
    //create the button size
    Dimension buttonSize = new Dimension(190, 100);
    //create the button's font object
    Font myFont = new Font("Arial", Font.BOLD, 18);
    //create the 1st button's object
    JButton myJButtonCalculator = new JButton("Calculator");
    myJButtonCalculator.setBackground(Color.red);
    myJButtonCalculator.setForeground(Color.black);
    // set the button's border, size, and font
    myJButtonCalculator.setBorder(myEdge);
    myJButtonCalculator.setPreferredSize(buttonSize);
    myJButtonCalculator.setFont(myFont);
    //create the 2nd button's object
    JButton myJButtonSketcher = new JButton("Sketcher");
    myJButtonSketcher.setBackground(Color.pink);
    myJButtonSketcher.setForeground(Color.black);
// set the button's border, size, and font
    myJButtonSketcher.setBorder(myEdge);
    myJButtonSketcher.setPreferredSize(buttonSize);
    myJButtonSketcher.setFont(myFont);
    //create the 3rd button's object
    JButton myJButtonVideo = new JButton("Airplane-Blimp Video");
    myJButtonVideo.setBackground(Color.pink);
    myJButtonVideo.setForeground(Color.black);
// set the button's border, size, and font
    myJButtonVideo.setBorder(myEdge);
    myJButtonVideo.setPreferredSize(buttonSize);
    myJButtonVideo.setFont(myFont);
    //create the 4th button's object
    JButton myJButtonBible = new JButton("The HolyBible");
    myJButtonBible.setBackground(Color.white);
    myJButtonBible.setForeground(Color.white);
// set the button's border, size, and font
    myJButtonBible.setBorder(myEdge);
    myJButtonBible.setPreferredSize(buttonSize);
    myJButtonBible.setFont(myFont);
    //add the buttons to the content pane
    myContentPane.add(myJButtonCalculator);
    myContentPane.add(myJButtonSketcher);
    myContentPane.add(myJButtonVideo);
    myContentPane.add(myJButtonBible);
    //add behaviors
    ActionListener myActionListener = new ActionListener() {
      public void actionPerformed(ActionEvent e)
        if (e.getSource() == myJButtonCalculator)
          new Calculator();
        else
        if (e.getSource() == myJButtonSketcher)
          new Sketcher();
        else
        if (e.getSource() == myJButtonVideo)
          new Grass();
        else
        if (e.getSource() == myJButtonBible)
          // go to www.nccbuscc.org/nab/index.htm
    }; // end of actionPerformed method
    //add the object listener to listen for the click event on the buttons
    myJButtonCalculator.addActionListener(myActionListener);
    myJButtonSketcher.addActionListener(myActionListener);
    myJButtonVideo.addActionListener(myActionListener);
    myJButtonBible.addActionListener(myActionListener);
    myJFrame.setVisible(true);
  } // end of TryGridLayout constructor
  public static void main (String[] args)
    new TryGridLayout();
} // end of TryGridLayout class
 

Thank you for your reply. I don't understand all the coding.
Its a little bit over my head . Is the below anywhere near correct ?
Thank you in advance
//add behaviors
    ActionListener myActionListener = new ActionListener() {
      public void actionPerformed(ActionEvent e) throws Exception
        /*if (e.getSource() == myJButtonCalculator)
          new Calculator();
        else
        if (e.getSource() == myJButtonSketcher)
          new Sketcher();
        else
        if (e.getSource() == myJButtonVideo)
          new Grass();
        else*/
        if (e.getSource() == myJButtonBible)
                String[] cmd = new String[4];
                cmd[0] = "cmd.exe";
                cmd[1] = "/C";
                cmd[2] = "start";
                cmd[3] = "http://www.nccbuscc.org/nab/index.htm";
//          cmd[3] = "will.xls";
//          cmd[3] = "mailto:";
//          cmd[3] = "a.html";
//          cmd[3] = "file:/c:/java/temp/a.html";
                Process process = Runtime.getRuntime().exec( cmd );
}; //end of actionPerformed() method
       

Similar Messages

  • I recently purchased songs from itunes via my pc and I dont know how to get them onto my iphone? When I click the sync button it says I will lose all the music currently on my iphone.. Help :(

    I recently purchased songs from itunes via my pc and I dont know how to get them onto my iphone? When I click the sync button it says I will lose all the music currently on my iphone.. Help

    If you're syncing with a different iTunes library than the one you previously synced with, then there is no way around it. You're gonna loose the old data. The only way round it would be to make sure that all the music files on your iPhone is also in your iTunes library. If you still have access to the computer with the old library, you could copy the files on to an external harddrive, and then import them into your new iTunes library.
    If it is in fact the same library, then the music currently on your iphone, is also in your itunes library. Just make sure that the artists/albums/playlists, or whatever you sync contains these tracks, that you allready have on your phone and don't want deleted. What i do is, i create a playlist specifically for my iPhone, and i set it up to only sync with this playlist. Whenever i hear a track from my iTunes library or buy a new track that i want on my phone, i just drag it to this playlist and next time i synchronize, it's there without deleting anything else.

  • When I click on certain items such as to close a window nothing happens. In some web sites when I click on a tab nothing happens

    If I open up web sites or applications and I click to close them from the navigation bar at the top nothing happens. Another example is I use My Yahoo and there is a mail button on top - when I click on that nothing happens - including clicking on all the other buttons.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Try to disable hardware acceleration.
    *Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    If disabling hardware acceleration works then check if there is an update available for your graphics display driver.
    *https://support.mozilla.org/kb/how-do-i-upgrade-my-graphics-drivers

  • On logged in sites when i click the back button im no longer logged in until i refresh

    On sites where i am logged in, eg forums or sites where i have saved the layout such as the BBC website whenever i click the back button to go to the previous page i am no longer logged in and my preferences have been cleared and the page has gone back to its defaults state. if i refresh the page its all back to how i set it and i am once again logged in.
    == This happened ==
    Every time Firefox opened
    == Friday evening/Saturday morning.

    Hello Jeni.
    That's how Firefox works. When you go ''back'' to a page where you were not logged in yet, you get logged off. Although it doesn't always work and if you refresh the page you get logged in again.
    The basis of this behavior is that clicking "Back" will take you to a page that is stored in cache, and Firefox doesn't have (in most cases) to redownload the page information again (this is good because it speeds up browsing). You can disable this behavior, but it will mean that every time you press "back", Firefox will re-load the page again, and it will not be instantaneous like it is now.

  • How to build a Oracle style Web site

    Dear All,
    (Not sure whether this question should be this sub-site or not.)
    My question is how to build a Oracle style Web site, what technology should be use.
    Example Site: [http://www.orapub.net/ebs/index.htm|http://www.orapub.net/ebs/index.htm]
    This web site style is like Oracle Enterprise Manager.
    Thanks a lot
    Pan

    You can use Oracle Webcenter or just Oracle ADF to build a Oracle Enterprise Manager kind of Website.
    See details here -
    http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/ria_application/developriaapplication_long.htm
    http://www.youtube.com/watch?v=iE2zTNhlvy8

  • How can I do to change the web site when I open a new tab.

    Dear Friends...
    I cant find information, how to changes the web site when I open a second tab. Example: when I open Firefox my home page is google and that is perfect but when I open a second tab, why appears yahoo as home page? I want to changes that and I cant find how to do it . Thanks

    The normal behavior is to open a blank tab, an add-on will be causing it to display Yahoo. One add-on that does this is the freeze net assistant, if you have that one you can uninstall it and it should revert to opening a blank tab.
    There are add-ons that let you specify what should open in a new tab, such as:
    * NewTabURL - https://addons.mozilla.org/firefox/addon/newtaburl
    * New Tab Homepage - https://addons.mozilla.org/firefox/addon/new-tab-homepage
    Another way of opening the home page in a new tab is to middle click on the home button in the navigation toolbar.

  • How do I put shortcuts to web sites in a (?) tool bar/browser bar...don't know what it is called. With IE, I can just drag the tab for the site to the area I want.

    How do I put shortcuts to web sites in a (?) tool bar/browser bar...don't know what it is called. With IE, I can just drag the tab for the site to the area I want

    Near the right-end of the address bar is a white star which can be difficult to see, but look closely. When you wish to bookmark a shortcut to the toolbar, double click the star. A window will open with the name of the webpage. Under that is the folder box which will probably read 'Unsorted Bookmarks'. Click the drop down arrow and change it to 'Bookmarks Toolbar' then click done.
    I have several folders on my toolbar such as Music, Mail, etc. in which I add multiple websites. If you wish to add a folder, click the second drop down arrow next to 'Bookmark Toolbar' and click 'New Folder' and give it a name.
    To add a bookmark to a folder, again double click the star, make sure you are in Bookmark Toolbar and click one of the two drop down arrows to find the name of the folder.
    For other bookmarks use Bookmark Menu. Whatever is added here can be accessed by Bookmarks on the Menu Bar. If your Menu Bar with Bookmark, File, View, etc. is not visible, click the Alt key and they will become visible. To keep the Menu Bar, click View, Toolbars and check Menu Bar.

  • How can I add bulks of web sites to a certain existing source?

    Hello,
    we administrate web sites in a database application and we like now to sznc the list in this application with those inside oses for a certain exsisting source. So we need either to knwo how to bring bigger lists of web sites into oses via the admin web pages or via other methods.
    So it would be nice to have a mthod, which can be used in scripts.
    Does anybody use something simular or created a solution for this task?
    regards Harald

    See:
    *http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard
    *https://addons.mozilla.org/firefox/addon/allowclipboard-helper/ - AllowClipboard Helper

  • How to remove block from trusted web site. I did the obvious by pasting the web address in the allow content area. What are the other ways

    I am a cityville game player on facebook and for some reason today I am unable to send out blasted on the game when if fact this was never a problem. Finally I went to internet explorer and the same problem happen, but internet explorer let me know that the content was blocked. All I had to do was unblock it and that was easy and know I can blast out. However trying to remove the block from fire fox is a issue. I went into to tools and removed every block and it still want work right. Therefore, how to remove block from trusted web site. I did the obvious by pasting the web address in the allow content area under tools options. What are the other ways

    Hello,
    Thank you for your post.
    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses
    the usage of Visual Studio IDE such as WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    Because your issue is about ASP.NET website programming, I suggest that you can consult your issue on ASP.NET forum:
    http://forums.asp.net/
     for better solution and support.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I have Mac OSX maxmini; Safari states "can't open server since starting with 'open-help-anchor'.  How do I get into the web site this is blocking?

    I have Mac Mini OSX 10.6.2; Safari states "can't open server since url starting with 'open-help-anchor'.  I didn't type this but possibly I was hijacked but it only occurs on the specific banking site I'm trying to get into.  How do I get into the web site I've always been able to get but now this is blocking it?   Is this related to cookies?

    https://discussions.apple.com/message/25085868#25085868
    I started a thread in safari maverics, I ment to put it in iOS Safari.  New Thread lists all the steps I've taken.  No I haven't tried another browser.  I've only ever used Safari on my iDevices.

  • When I start a new tab yahoo search comes and I don't want that. how do I get a different web site to open?

    when I start a new tab yahoo search comes when I start a new tab yahoo search comes and I don't want that. how do I get a different web site to open?

    You need to figure out what you have installed which changed that action to Yahoo from a blank tab, which is the default action in Firefox; and then get rid of that add-on. Then you can can install an add-on which allows you to select what you want in the new tab.
    https://addons.mozilla.org/en-US/firefox/addon/newtaburl/

  • How to get the image from web site

    Hi,
    Anybody know the coding that use to get or download the image from the web site when the image's url is given.
    Thanks

    http://www.exampledepot.com/egs/java.net/GetImage.html

  • My Mac will not automatically connect to a web site when I double click

    My Mac will not automatically connect to a web site when I double click.  The Icon blinks but nothing happens.  This happened once before but I don't recall how it was fixed.  I can often (but not always) open the site by using "open with Safari.app(default)

    Firefox 3 will not run on OS X 10.3.9, it requires at least 10.4
    Try one of these browsers to see if you can access Hotmail - [http://www.seamonkey-project.org/releases/seamonkey1.1.19/ SeaMonkey 1.1.19] or [http://caminobrowser.org/download/ Camino 1.6.11]

  • Sorry if tis is naive.  I have just bought my first iPad Retina Display.  I have WiFi at home but it has taken ages for me to connect as I needed all sorts of codes, passwords, detauils etc.   How does one connect to the web (Google) when one is out and a

    Sorry if this is a bit naive.  I have just bought my first iPad (Retina Display).  I have WiFi at home but it has taken me ages to get on-line as I needed all sorts of codes, passwords, numbers etc.
    How does one connect to the web (Google) when one is out and about?
    Thanks

    haha, You're welcome
    Maybe these links will be useful
    ipad manual/user guide
    http://manuals.info.apple.com/en_US/ipad_user_guide.pdf
    ipad support page
    http://www.apple.com/support/ipad/
    ipad assistant
    http://www.apple.com/support/ipad/assistant/

  • When I click the Sections button then click on the 1st page I get  a page that is titled "Lorem ipsum dolor sit amet"! Where did it come from and how do I get rid of it. I have tried deleting and "dont save" but it comes back.

    In Pages when I click the 'Sections'  button then click on the 1st page I get  a page that is titled "Lorem ipsum dolor sit amet"!  Where did it come from and how do I get rid of it? I have tried deleting and "dont save" but it comes back. It is a full page in some unknown language. The only thing I can decifer is 'cupy uf cak'.   Rdal

    Roger,
    The icon is +Sections, not just Sections, as in "Add a Section". When you click that icon you get a section break and and a new section template, complete with preformatted text called placeholder text. The reason "Lorem ipsum" is there is so you can see what the format looks like. The reason that it is Latin gibberish is so you won't get hung up on, or distracted by, what it says. It's just a display of format. Select the "Lorem ipsum" text and start typing your content.
    Jerry

Maybe you are looking for

  • Fax and scan problem with Acrobat Reader DC

    My Acrobat Reader just updated to the new Reader DC program, and now I cannot send any faxes that contain any PDF documents using the Windows Fax and Scan program .  Has anyone else seen this problem?

  • Why does Xcode4 always crash on create/open project?

    Xcode4 Final, always crashes when I try to create or open a project. some history: did not used the proper script to remove Xcode3, I deleted /Developer and rebooted Xcode4 installed, removed with correct script. (3+ times) tried to remove all xcode/

  • Lag! iPhone 6

    iPhone 6 a lot of lag when i scroll slowly up and down in album music, in setting and album photo

  • R/3-xi-file scenario

    Hi I am a fresher learning XI. I want to establish connection between r/3 and XI. To define RFC destination using SM59 .........should I take "r/3 connection "or "logical destinatio" or "TCP/IP connectiosn" ?? And similarly during port creation using

  • SES: relate attributes to each other

    Hi, I am implementing a SES based index. In this index I store Customer data. Most of the customers have multiple addresses, and here my problem is situated. When I perform a search, the different addresses get mixed up. For example, when I have a cu