button with hyperlink....how?

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Nov 2006
Posts: 38
Reputation: apontutul is an unknown quantity at this point 
Solved Threads: 1
apontutul's Avatar
apontutul apontutul is offline Offline
Light Poster

button with hyperlink....how?

 
0
  #1
Aug 16th, 2007
I want to make: when i click a button after I've given some input it checks & if successful it opens a new window/page i.e I want to create a link....till now I've done

  1.  
  2. import javax.swing.JOptionPane;
  3.  
  4.  
  5. public class inputwindow {
  6.  
  7. /**
  8.   * @param args
  9.   */
  10. public static void main(String[] args) {
  11. // TODO Auto-generated method stub
  12. //String id= "admin";
  13. //String pw= "admin";
  14. String name,pass = "";
  15. name = JOptionPane.showInputDialog("UserName");
  16. pass = JOptionPane.showInputDialog("Password");
  17. //String msg = "Hello " + name ;
  18. //JOptionPane.showMessageDialog(null, msg);
  19. if (name.equals("admin") && pass.equals("admin"))
  20. {
  21. JOptionPane.showMessageDialog(null, "login successful");
  22. }
  23. else {
  24. JOptionPane.showMessageDialog(null,"you are not allowed");
  25. }
  26.  
  27. }
  28.  
  29. }


here in the place of "login successful" i want to put somthing that will open a window to be specific I want open a "xyz" web application. for eg: "http://localhost:8080/xyz"......hope I've made myself clear....please suggest..thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 871
Reputation: vinod_javas is an unknown quantity at this point 
Solved Threads: 7
vinod_javas's Avatar
vinod_javas vinod_javas is offline Offline
Practically a Posting Shark

Re: button with hyperlink....how?

 
0
  #2
Aug 16th, 2007
I dont think you can use hyperlink in windows application

its only for web application
Adios,

Vinod......
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,442
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 260
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: button with hyperlink....how?

 
0
  #3
Aug 16th, 2007
Read the Swing tutorial. You are looking for ActionListener.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,492
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 519
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: button with hyperlink....how?

 
0
  #4
Aug 16th, 2007
As masijade said, you can do that with an ActionListener, however I have to wonder why you are writing a Java program just for a login and then opening a web application. Why not simply login in to the web application?
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 38
Reputation: apontutul is an unknown quantity at this point 
Solved Threads: 1
apontutul's Avatar
apontutul apontutul is offline Offline
Light Poster

Re: button with hyperlink....how?

 
0
  #5
Aug 17th, 2007
actually i want only "one person"/admin to enter a specific folder inside the application not the whole application as you said....could someone tip me some details about ActionListener....i'm bit confused!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: button with hyperlink....how?

 
0
  #6
Aug 18th, 2007
What don't you understand. Be more specific.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 38
Reputation: apontutul is an unknown quantity at this point 
Solved Threads: 1
apontutul's Avatar
apontutul apontutul is offline Offline
Light Poster

Re: button with hyperlink....how?

 
0
  #7
Aug 19th, 2007
I want to pass this URL
"http://localhost:8080/xyz/admin" as a parameter when the user clicks OK or enters the password in the JoptionPane.......is it possible with ActionListener.....how?

ps: how can I make both the username/password be taken from ONE dialog box? (as you can see i'm using 2boxes)
Last edited by apontutul; Aug 19th, 2007 at 7:03 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,442
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 260
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: button with hyperlink....how?

 
0
  #8
Aug 19th, 2007
Read the API for JOptionPane. I assume you're letting him enter a URL, in that case you already have the URL, you simply need to capture the return value of the JOptionPane method. As I said, read the API for that (and the tutorial), it explains it completely.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 38
Reputation: apontutul is an unknown quantity at this point 
Solved Threads: 1
apontutul's Avatar
apontutul apontutul is offline Offline
Light Poster

Re: button with hyperlink....how?

 
0
  #9
Aug 20th, 2007
Originally Posted by masijade View Post
I assume you're letting him enter a URL.
could'nt understand what you meant by that.
the user enters id/pw (both "admin")...if he enters correctly he will be given the access to the "admin" folder of the web application. the user does'nt enters any URL!!!....is there any tool other than JoptionPane that will make matters easier?
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,442
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 260
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: button with hyperlink....how?

 
0
  #10
Aug 20th, 2007
What do you mean "you want to pass it as a parameter". Explain, without reference to URLs, JOptionPanes, Parameter Passing, or anything else technical, what it is, exactly that you want to accomplish.
Last edited by masijade; Aug 20th, 2007 at 4:51 am. Reason: typo
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC