Results 1 to 5 of 5
  1. #1
    Noelf21 is offline Member
    Join Date
    Dec 2009
    Posts
    12
    Rep Power
    0

    Default Button To run application

    how would i go about making a button to run a class what code would i need so that when i click the button the class would be run

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    Add a button to a panel in a frame. And have that button respond to a click by calling the main() method you wish to invoke.

    You might want to read the swing trail in Sun's Tutorial for details, especially How to use Buttons.

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    Also posted at Sun forums.

    @OP: I would recommend the advice of Java Ranch about cross posting to other sites.

  4. #4
    Noelf21 is offline Member
    Join Date
    Dec 2009
    Posts
    12
    Rep Power
    0

    Default

    cheers for the heads up but i was desperate for an answer and i have been working on it all day

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Noelf21 View Post
    cheers for the heads up but i was desperate for an answer and i have been working on it all day
    Understood, but please understand that if you frustrate those who would help you, then your cross-posting will have the opposite effect desired: you'll get less help. Thank you for your cooperation in this.

Similar Threads

  1. Replies: 3
    Last Post: 12-04-2009, 01:10 PM
  2. Replies: 0
    Last Post: 04-22-2009, 02:30 PM
  3. simulate form type=button press with java application
    By redmoonzer01 in forum Networking
    Replies: 1
    Last Post: 03-29-2008, 07:28 AM
  4. Replies: 0
    Last Post: 02-16-2008, 10:31 PM
  5. Replies: 0
    Last Post: 02-16-2008, 10:29 PM

Posting Permissions

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