| | |
button with hyperlink....how?
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
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
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
Java Syntax (Toggle Plain Text)
import javax.swing.JOptionPane; public class inputwindow { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub //String id= "admin"; //String pw= "admin"; String name,pass = ""; name = JOptionPane.showInputDialog("UserName"); pass = JOptionPane.showInputDialog("Password"); //String msg = "Hello " + name ; //JOptionPane.showMessageDialog(null, msg); if (name.equals("admin") && pass.equals("admin")) { JOptionPane.showMessageDialog(null, "login successful"); } else { JOptionPane.showMessageDialog(null,"you are not allowed"); } } }
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
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
----------------------------------------------
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
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)
"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.
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
----------------------------------------------
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
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?
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?
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
----------------------------------------------
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
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Hyperlink a div (JavaScript / DHTML / AJAX)
- ASP.NET: Connecting to database (ASP.NET)
- How to disable a hyperlink or a textbox or a command button? (PHP)
- Is it possible to print a frame by clicking a button in a pop-up? (JAVASCRIPT) (JavaScript / DHTML / AJAX)
- Working with hyperlink....?????? (ASP.NET)
- HYPERLINK with PHP POST (PHP)
- first website doesnt work well? (HTML and CSS)
- Changing the default "submit" button. (HTML and CSS)
Other Threads in the Java Forum
- Previous Thread: Help Needed in JAVA Program
- Next Thread: disabling class verifier
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary bluetooth character chat class classes client code component consumer csv database desktop draw eclipse error event exception fractal ftp game givemetehcodez graphics gui html ide image input integer j2me japplet java javaarraylist javaee javaprojects jmf jni jpanel julia linked linux list loop mac map method methods mobile netbeans newbie objects online oracle oriented panel print printf problem program programming project projects properties recursion replaydirector reporting researchinmotion robot rotatetext rsa scanner screen se server set size sms sort sql string swing template test threads time tree ubuntu windows working






