| | |
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 |
2dgraphics account android api apple applet application array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class classes client code component data database derby design eclipse encryption error event exception fractal game givemetehcodez graphics gui homework html ide if_statement image inheritance input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile monitoring netbeans newbie nullpointerexception open-source print printing problem program programming project property recursion reference ria scanner screen search server set size sms sort sourcelabs splash sql sqlite static stop string swing testautomation threads time tree ui unicode validation windows






