How to go one jFrame to another JFrame after click on button?

I am having two frames loginFrame.java and UserinfoFrame.java.
In loginFrame.java to click on login button i want to goto UserinfoFrame
(LogInSuccessPanel).
private void bnLoginActionPerformed(java.awt.event.ActionEvent evt) {                                       
// TODO add your handling code here:
int loginCounter=0;
this.remove(jPanel2);
LogInSuccessPanel login = new LogInSuccessPanel();
this.add(login);
update();
//if(evt.getSource()=="login")
// while(loginCounter <= 5)
if(!login(jTextField1.getText(), new String(jPasswordField1.getPassword()))) {
loginCounter++;
System.out.println("UserName : "+jTextField1.getText()) ;
System.out.println("Password : "+jPasswordField1.getPassword());
if(loginCounter >= 6) {
System.out.println("Unable to Login");
connectToDB();
if(jTextField1.equals("UserName"))
//Check Whether username is existing in DB
private void connectToDB() {
try{
     Class.forName("com.mysql.jdbc.Driver");
Connection con= DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
Statement stmt = con.createStatement();
ResultSet rset = stmt.executeQuery("SELECT UserName from login table");
jTextField1.setText("Connected to the Database. Fetching Values from login Tables.\n");
StringBuffer allRowValues = new StringBuffer();
int counter=1;
if (rset.next())
//allRowValues.append("ROW " + counter + ": Username = " + rset.getString(1) + " & Password = " + rset.getString(2) + "\n");
//counter++;
System.out.println(" LOGIN SUCCESSFUL ");
System.out.println("Username : " + rset.getString("username"));
System.out.println("Password " + rset.getString("password"));
System.out.println(" LOGIN SUCCESSFUL ");
else
System.out.println(" LOGIN FAILED ");
// .setText(allRowValues.toString());
rset.close();
stmt.close();
con.close();
} catch (SQLException ex) {
System.out.println("Connection Error = " + ex.toString());
ex.printStackTrace();
}catch(ClassNotFoundException e){
     System.out.println("Error in loading class" + e);
private boolean login(String name, String pwd) {
int count=0;
if(count<=5)
count++;
return true;
else return false;
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
Thanks and regards

search results for
login
http://onesearch.sun.com/search/onesearch/index.jsp?charset=UTF-8&qt=login&rf=0&rt=1&site=dev&nh=10&cs=0&col=developer-forums&dftab=siteforumid%3Ajava57&chooseCat=javaall&subCat=siteforumid%3Ajava57

Similar Messages

  • How to exchange one image for another with a click

    I am brand new to actionscript, so bear with me! I need to create an interactive web-based system which takes the user through steps to assemble something. One of the pages will have images of the tools needed. I want the user to be able to 'tick' off each tool, so that when they click on the image of a specific tool it is replaced by the image faded out and a big red tick over it. essentially it is replacing one image for another when it is clicked on.
    any ideas on the actionscript? Sorry i know this must be basic stuff for you!
    thanks!

    your tool images should be converted to movieclips and given instance names and you should create a red tick movieclip that you assign a class, say RedTick.  you can then use:
    tool1.addEventListener(MouseEvent.CLICK,toolClickF);
    function toolClickF(e:MouseEvent):void{
    var redtick:RedTick=new RedTick();
    addChild(redtick);
    redtick.x=e.currentTarget.x;
    redtick.y=e.currentTarget.y;
    e.currentTarget.alpha=.4;

  • How to refer one view from another view?

    Hi,
    I have 2 views in my Adobe Flash Builder mobile app. I need to refer the first view in my second view.
    How to refer one view from another view? Or how to create a reference to a view wherever needed?

    I don't need any data from my first view. In a certain flow, I need to make my first view to be invisible.
    for eg., My First view is in portrait mode. I change the device to Landscape. In the landscape mode, I want to show a completely different view (second view).
    In this case, what happens is, I see my first view in Landscape mode for a second. Then the second view appears. When I change to Landscape mode, only the second view should be seen. I need to make my first view to be completely invisible in the OnOrientationChanging event of
    StageOrientationEvent
    As stage object and StageOrientationEvent works at application level, I need to know how to refer my first view object in the application level.
    private function onOrientationChanging(soe:StageOrientationEvent):void
          MyFirstView.Visible = False; ====> don't know how to refer MyFirstView here
    Is my question clear now?

  • How to call one  JSFF into another JSFF

    Hi,
    I am very new to ADf. Could you please tell me how to call one JSFF inside another JSFF. We have a common pop-up written in one JSFF. Is there any best approach to get this pop-up into other JSFF.
    Thanks in Advance.
    Regards
    Narasimha

    If you want to resue the jsff code, make use of bounded task flow with page fragment and then use it as a region.
    For more details you can refer: http://docs.oracle.com/cd/E21764_01/web.1111/b31974/taskflows_regions.htm
    One more:
    http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_57/jdtut_11r2_57.html

  • How to include one view into another view

    Hi SDN's,
                   Could any please tell me,How to include one view into another view.
    In my requirment.I want to create a 'Z' view for an interface .In that  view i have to take,
    1) Ship-to-email adrr by
                              LIKP-KUNNR -> KNA1-ADRNR
                              KNA1-ADRNR -> ADR6-ADDRESNUMBER.
    2) E-mail addr of person who created the document.i.e
        LIKP-ERNAM -> USR21-BNAME.
        USR21-ADDRESNUMBER ->  ADR6-ADDRESNUMBER 
        USR21-PERSNUMBER -> ADR6-PERSNUMBER.
       In both the case we have to pass ADDRESSNUMBER to ADR6 table.
    If we pass these condition it fails,B'Coz at a time it passes Two ADDRESSNUMBER and a PERSNUMBER.
    So i created two which fetches only the email addr of  person who created the document.and another view fetches Ship-to-email addr.
    Now i want to include the second view into first view . Is it possible?or please
    tell me someother way to get these email addresses in a single view.

    hi
    as per my knowledge, nested views are not possible. However, while creating a new view, selection method will not giv u option to select the already created view(S) except the tables..i think so.
    regards,
    shamim

  • How to call one program from another program

    Hai,
      How to call one program through another program.
    Example.
       I have two programs 1.ZPROG1 2. ZPROG2.
    When i execute ZPROG1 at that time it should call ZPROG2.

    Hi ,
    u can use submit statement to call a program .
    DATA: text       TYPE c LENGTH 10,
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
          range_tab  LIKE RANGE OF text,
          range_line LIKE LINE OF range_tab.
    rspar_line-selname = 'SELCRIT1'.
    rspar_line-kind    = 'S'.
    rspar_line-sign    = 'I'.
    rspar_line-option  = 'EQ'.
    rspar_line-low     = 'ABAP'.
    APPEND rspar_line TO rspar_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'H'.
    APPEND range_line TO range_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'K'.
    APPEND range_line TO range_tab.
    SUBMIT report1 USING SELECTION-SCREEN '1100'
                   WITH SELECTION-TABLE rspar_tab
                   WITH selcrit2 BETWEEN 'H' AND 'K'
                   WITH selcrit2 IN range_tab
                   AND RETURN.
    regards,
    Santosh thorat

  • How to call one EJB in another EJB?

    How to call one EJB in another EJB? Please explain with some example code.

    To refer a Ejb from another Ejb include <ejb-ref> element in ejb-jar.xml
    <session>
    <ejb-name>EjbA</ejb-name>
    <ejb-ref>
    <ejb-ref-name>EjbB</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>com.ejb.EjbBHome</home>
    <remote>com.ejb.EjbB</remote>
    </ejb-ref>
    </session>
    Include a <reference-descriptor> in weblogic-ejb-jar.xml
    <weblogic-enterprise-bean>
    <ejb-name>EjbA</ejb-name>
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name>EjbB</ejb-ref-name>
    <jndi-name>com.ejb.EjbBHome</jndi-name>
    </ejb-reference-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    In EjbA Bean class refer to EjbB with
    a remote reference to EjbB.
    InitialContext initialContext=new InitialContext();
    EjbBHome EjbBHome=(EjbBHome)
    initialContext.lookup("com.ejb.EjbBHome");
    EjbB ejbB=EjbBHome.findByPrimaryKey(primarykey);

  • How to copy one request to another request

    Hi all,
    How to copy one request to another new request?
    I have a released workbench request in which it has around 1200 Objects (including data elements, domains, programs and many more), now i need to copy all these objects into a new request.
    I can do this by SE03 (Include Objects in a Transport Request ) transaction, but it is a lengthy process.
    Is there any way to copy directly in one go.
    Plz help...
    Regards,
    Satish Reddy D.

    Hi,
    The thing is like this....
    i have a released request in which we have more than 1200 objects, in that i dont need 10 objects.
    so when i create it as copy of transport request, i just deleted those 10 objects and saved.
    Now, if i transport the new request how many objects will go? 1200 or 1190?
    in the new request i am getting the old request under Comment: Object List Included.
    is it necessary to transport the old request?
    i need to transport only 1190 objects.
    Regards,
    Satish Reddy.
    Edited by: Sathish Reddy on Jan 28, 2010 2:18 PM

  • How to display the details of particular order when click on button in sapui5

    Hi Experts,
        How to display the details of particular order when click on button in sapui5?
    I Have a requirement that is i want display all the list of orders coming from backend as shown in image below
    then in that i have a button when i press the button  it need to display the details of particular order as shown in image below
    Please help me .
    Thanks & Regards
    chitti

    Does anyone know how to display the index of current desktop?
    Brute force - - I have written the number of the Desktop directly onto the wallpaper picture I am using for each Desktop  (easy to do with Preview).
    All Desktops are using different wallpaper photos, so they are easily recognized by the color scheme, and in the upper left corner is the number.
    Regards
    Léonie

  • Hi all, how to dubug an application after clicking ok button on popup

    Hi all, how to dubug an application after clicking ok button on popup, pcan anyone give me the porcedure
    Regards,
    Sre

    Copy the below text into a notepad file and save.
    [FUNCTION]
    Command=/H
    Title=Debugger
    Type=SystemCommand
    Now when you get a popup and want to debug from the same, drag & drop the saved file on to the popup window and debug starts right after the next user-command.

  • Launching a JFrame from another JFrame

    Hi,
    I have a JFrame containing a menu(buttons). When I click on a button, I want that it launches another JFrame.
    I tried making use of the code
    Process p = Runtime.getRuntime().exec("java CreateStudentRecord");
    where CreateStudentRecord is the JFrame I want to launch. however this did not work.
    Can anyone help me find out how I can launch another JFrame when I click on a button within another JFrame.
    Thanks,
    Rahul.

    How about just using the following:
    private CreateStudentRecord csr;
    JButton b1 = new JButton("New Student Record");
    b1.addActionListener( new ActionListener() {
         public void actionPerformed(ActionEvent e){
              csr = new CreateStudentRecord().show();
    Rick

  • Please help - JFrame, menu, another JFrame, setBackground

    I am trying to make a simple program that draws a JFrame with a menu. The menu has one item, which when selected draws another JFrame. That JFrame has a button, which when pressed changes the background color. Many hours have gone into this, despite the fact that I made a similar program a few weeks ago.
    The compiler complains about the method getContentPane, when I remove that, it runs and draws the first window, but the menu item does not make the second window. Also, the setDefaultCloseOperation confuses the compiler as well.
    Please help.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MenuAction2
    public static void main(String[] args) 
         MainWindow window = new MainWindow("Menu action example");
      //window.setDefaultCloseOperation.(JFrame.EXIT_ON_CLOSE);
         window.setVisible(true);      
    class MainWindow extends JFrame
         MainWindow(String title)
         super(title);
         getContentPane.setLayout(new BorderLayout());
         Toolkit theKit = getToolkit();          
         Dimension wndSize = theKit.getScreenSize();  
         setBounds(0, 0,wndSize.width, wndSize.height);
         setJMenuBar(menuBar);
         fileMenu = new JMenu("File");
         connectItem = new JMenuItem();
         connectItem = fileMenu.add("Connect...");
         connectItem.addActionListener(menuHandler = new Handler());
         menuBar.add(fileMenu);
         getContentPane.add(toolBar, BorderLayout.NORTH);  
    class Handler implements ActionListener
         public void actionPerformed(ActionEvent e)
          win = new ConnectWindow("Connect to Database");
          getContentPane().add(win, BorderLayout.NORTH);
          setVisible(true);
      private JMenu fileMenu;
      private JMenuItem connectItem;
      private JMenuBar menuBar = new JMenuBar(); 
      private JToolBar toolBar = new JToolBar();
      private Handler menuHandler;
      private ConnectWindow win;
    class ConnectWindow extends JFrame
         ConnectWindow(String title)
              super(title);
              setSize(200,200);
              setLayout(new BorderLayout());
              JButton connectB = new JButton("Connect");
              connectB.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
                        setBackground(Color.red);
              add(connectB,BorderLayout.SOUTH);
              setVisible(true);
    }

    getContentPane is a method so you should use it that way:
    getContentPane().setLayout(new BorderLayout());
    getContentPane.add(new Button("Ok"));

  • How to change one iView to another in portal page by clicking the third one

    Hi all!
    I have created four iViews: two speedometers with web application designer and two iViews with visual composer. I added the speedometers and a visual composer iView #1 to a portal page (default view). The requirement is that by clicking the speedometer #2, the visual composer iView #2 would replace visual composer iView #1 on the portal page. If the user then would select the speedometer #1 again by clicking it, visual composer iView #2 would replace #1 again and so on.
    I have read article http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50b65a5d-f397-2910-a78a-f5544f21c33b?QuickLink=index&overridelayout=true, but it is more about filtering VC iView values with BI web items. I don't need to filter anything, just to change one iView to another in a portal view by clicking a third one.
    I have thought of placing two VC iView to a same portal page area and defining one of the to be visible and another hidden (by clicking speedometers these properties would change), but I haven't found the way how that could be done in portal. Is there a way to define some OnClick-method to change visibility parameters or url-address of another iView?
    One solution might be¨on the other hand to transfer any value to VC by clicking a speedometer and to change the visibility of the VC iViews according to that value (the speedometer #1 should in that case transfer other value to VC than speedometer #2). I don't know if that is possible with speedometers - you can't reference any characteristics or variables with it.
    If you have an idea, what would be the best way to accomplish this requirement, I would be very glad to hear about it! We are in VC 7.0.
    Points garanteed!
    Regards
    Sari

    Hi,
    In the portal, create a page and place the iView having the three input fields on top. Place the second iView below. Keep differing the second iView for every page. In this way you can make the iView with 3 input fields only in the desired pages. You can use EPCF to invoke / navigate to another iView.
    Regards
    Srinivasan T

  • How to place one column under another column in obiee report?

    Hi all,
    I am new to obiee, so need some help from obiee experts. Can anyone tell me how to place one column data under another column in obiee report?
    i need the report to be as below
    category total_students Course_enrollment Test_attended pass_test
    total N % N % N %
    all students ##### ## ## ## ## ## ##
    Ethnicity
    Asian ###### ## ## ## ## ## ##
    African American ###### ## ## ## ## ## ##
    white ######
    Filipino ######
    Gender
    Male ##### ## ## ## ## ## ##
    Female ##### ## ## ## ## ## ##
    and similarly for other columns
    where ethnicity, gender are columns in the table and Course_enrollment, Test_attended, pass_test are calculated columns.
    Please help me to create a report as above if anyone knows how to do it.
    Edited by: Shailaja on Jul 19, 2010 12:23 AM

    Two ideas I can think of:
    1) Create multiple pivot tables and then display them one under the other
    2) Create multiple measure columns such as "male_amt", "female_amt", "white_amt", "asian_amt", "black_amt", etc. for all the columns you need. Then you could simple stack them in a single pivot table.
    Option #2 might give you the prettiest results - but also requires a lot more maintenance (for instance, if you reclassify ethnic groups, you'd have to go through the reports to add additional metric columns).
    Hope this helps,
    Scott

  • How to move one screen to another screen Webdynpro ?

    Hi,
    How to move from one screen to another screen Webdypro ?
    Best Regards,
    Kishore

    Hi,
    for this you have to declare in and outbound plugs to your views,
    bind them into the window area of your component and fire the
    outbound plug in your action handler in view one, view2 will be called
    automatically.
    <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/1f/464941db42f423e10000000a155106/frameset.htm">documentation</a>
    grtz
    Koen

  • How to update one table from another

    I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
    I created a table with the following sql of all the affected rows:
    CREATE TABLE LSU_INTER_FIX_DATE AS
    select request_id,received_date,planned_start_date, actual_start_date
    from lsu_inter2_requests_t
    where received_date < to_date('01-JAN-1900')
    OR planned_start_date < to_date('01-JAN-1900')
    OR actual_start_date < to_date('01-JAN-1900')
    I then repaired all of the rows with three data fixes
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
    where planned_start_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
    where actual_start_date < to_date('01-JAN-1900')
    I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
    UPDATE lsu_inter2_requests_t aaa
    SET aaa.received_date = bbb.received_date
    FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
    When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?

    Comet wrote:
    I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
    I created a table with the following sql of all the affected rows:
    CREATE TABLE LSU_INTER_FIX_DATE AS
    select request_id,received_date,planned_start_date, actual_start_date
    from lsu_inter2_requests_t
    where received_date < to_date('01-JAN-1900')
    OR planned_start_date < to_date('01-JAN-1900')
    OR actual_start_date < to_date('01-JAN-1900')
    I then repaired all of the rows with three data fixes
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
    where planned_start_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
    where actual_start_date < to_date('01-JAN-1900')
    I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
    UPDATE lsu_inter2_requests_t aaa
    SET aaa.received_date = bbb.received_date
    FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
    When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?I am not convinced you have what you think you have
    >
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    When you want to produce a DATE datatype when starting with a string,
    you must use TO_DATE() on the SET line!
    (TO_CHAR(received_date,'RRRR') + 2000)since when do you do add characters (from TO_CHAR) with a constant number (2000)?
    You should NEVER EVER rely on implicit datatype conversion
    Edited by: sb92075 on Jul 27, 2011 7:09 PM

Maybe you are looking for

  • How Do I Open a "Edit in Progress" Photo in the Organizer in a Stacked File

    I have a photo in my organizer which indicates "edit in progress".  This photo is one of three in a version set.  I am unable to open this file to continue the editing. Also, when I complete editing a photo and "save as" a JPEG file I keep getting th

  • Process order settlement driven by T030 & TKA3C vs settlement from recipe

    We settle all process order cost (consumption, production, and variances) to the cost center (or P&L).   These settlements are driven by a hard coded structure (by valuation class) and tables T030 & TKA3C. I suggest that this is not common SAP practi

  • Object count is different via linked server

    Hi, we have created one linked server in ms sql server 2003 from oracle 9i database. when I am checking the count of object in oracle database is different from the count of same object using linked server. Kindly help me in getting some work around

  • Powerbook G3 Woes - PDQ 266 - Installation Headaches...

    Hello people. I have just acquired a PB G3 "PDQ" which has a 20GB HDD along with 512MB of RAM, Model M5473. I cannot install an OS on it to save myself and I'm pulling my hair out. I've reset the machine with the key combo stated at the rear, along w

  • Application constants.... i8n help :-)

    Should I code constants like an IOException into a constant class? There are two approaches I would like to use but am unsure which to pick. 1) I create a common application constants class that declares for eg. an IOException message that is used by