Page 1 of 2 12 LastLast
Results 1 to 20 of 22
  1. #1
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Question Calling one Jframe from another

    Hi,

    I have one project by name "test_seamless" which is a desktop application and has 1st screen for login for the user, after he login into the database, he clicks "Next" button, when the user clicks "Next" button, it should call one more Jframe from another project.

    How to implement this using java code ?

    thanks in advance

    Sandeep

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    Please go through the forum rules.

    Your other thread has been removed from 'Advanced Java'

    db

  3. #3
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    Hi,

    Sorry for posting it in advanced java also, i wont repeat it again, thanks for informing it and please can you tell me how to call another JFrame?

    Sandeep

  4. #4
    javababa is offline Member
    Join Date
    May 2011
    Posts
    9
    Rep Power
    0

    Default

    just call the class that extend the JFrame with "new" keyword

    eg. new class_name();

  5. #5
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    Hi javababa,

    thanks for replying, but im writing code under an event, where i cannot create new class in it, so i have to write it under an action event performed to call another frame which is another project.

    Sandeep

  6. #6
    javababa is offline Member
    Join Date
    May 2011
    Posts
    9
    Rep Power
    0

    Default

    call the class when the event occurs.............and it is possible.
    And what do you mean by another project??????????

  7. #7
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    another project is that :

    i have created one project with one JFrame which has all userid and password and login stuff for databases, now i have created a new project where i will create one more JFrame in it and have to link it to first JFrame tat is created, so how to call these JFrames is my doubt?

    Sandeep

  8. #8
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    under an AcctionEvent performed?


    Sandeep

  9. #9
    javababa is offline Member
    Join Date
    May 2011
    Posts
    9
    Rep Power
    0

    Default

    I dont understand that.........why should you create two projects????? what is the directory of your class files..........both the classes in the same directory or each one has separate one??????.

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

    Default

    Quote Originally Posted by sandeep43 View Post
    Hi javababa,

    thanks for replying, but im writing code under an event, where i cannot create new class in it, so i have to write it under an action event performed to call another frame which is another project.

    Sandeep
    ??
    What do you mean you "can't create a new class in it"? If you're talking about objects, not classes, you can certainly create a new object or instance of a class anywhere. I suggest you greatly clarify your problem and even create a small sample program, an SSCCE to demonstrate your problem.

  11. #11
    Jodokus's Avatar
    Jodokus is offline Senior Member
    Join Date
    Jan 2011
    Location
    Amsterdam, the Netherlands
    Posts
    230
    Rep Power
    4

    Default

    @OP:
    I did'nt see a real problem until now, only a mixing of "complications" that have nothing to do with eachother.
    - Like Javababa and Fubarable said, there's nothing opposing creating instances anywhere.
    - You can lounch a JFrame from a JFrame (often not a good idea, but you can).
    - You can do those things from within an actionPerformed() (maybe checking if it already exists).
    - You can do these things from different coupled projects.
    No bug ever had to calculate its fitnessfunction.

  12. #12
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    Hi,

    Thnks for reply

    so i can create New JFrame within the same project and can i call it within an ActionPerformed event of another JFrame JButton ? If so how can i call that new Jframe created ?

    Regards
    Sandeep

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

    Default

    You just create it and call it like any other JFrame.

    What have you tried? Please show us this and how it's not working. And why do you need a JFrame to create and display another JFrame?

  14. #14
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    Hi fubarable,

    i am creating an desktop application, so wen user clicks "Next" button, it should call new JFrame, so how to call new JFrame is my question, i think now it is clear.

    Sandeep

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

    Default

    Fine, so again, just display the JFrame as you would usually do so, as fully outlined in the Java tutorials. Again, you're not telling us what is not working. Or have you not yet tried to do this?

    Pertinent tutorials:
    How to Make Frames (Main Windows) (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
    Using Top-Level Containers (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

    But again, I would wager that most of us here wouldn't be spitting a bunch of JFrames at the user but rather would be swapping JPanels in a single JFrame to change the view, something that is easy to do with CardLayout.

  16. #16
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    oh ok thnks a lot and i haven't tired it out, before trying it i have asked u people, so that i will have clear idea as to how can i implement and make a go for it.
    i will refer the tutorials Fubarable. thanks for it.

  17. #17
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    I still do not understand why you need another frame. Why can't you just display a different panel in the current frame?

  18. #18
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    Hi junky

    i think u guys would have installed so many softwares for ur laptop's, in same way i have to create an application.

    while u install any software or application into ur system u c a "Next" button and later u keep clicking next and finally click "Install" and then finish the installation of the application, in the same way i have to create a software type application, so in my application wen user clicks Next it should go to next Frame or panel. so how to do this ?

    Sandeep

  19. #19
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,788
    Rep Power
    7

    Default

    You create a panel for each "screen" of the installation/application. When user clicks next you have the actionPerformed method create and display the next screen. We are not going to hold your hand and write the code for you. Read the links provided, write your own code and when you get stuck come back here and ask a specific question.

  20. #20
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    yea junky ur correct i don't want any code help i can do code stuff, as i was stuck as to how can i implement i posted here, now then i have got a solution i will try and any doubts i will come back and post it.

    Thanks Java punters and forum

    Sandeep

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 5
    Last Post: 06-14-2010, 06:10 PM
  2. Replies: 6
    Last Post: 04-12-2010, 11:33 AM
  3. Passing data from one JFrame to another JFrame
    By tarami in forum New To Java
    Replies: 3
    Last Post: 08-06-2009, 05:44 PM
  4. Replies: 4
    Last Post: 04-22-2009, 11:02 PM
  5. Calling a JFrame window from a command line program.
    By new_2_java in forum New To Java
    Replies: 7
    Last Post: 11-09-2008, 03:40 AM

Posting Permissions

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