Results 1 to 20 of 22
Thread: Calling one Jframe from another
- 05-26-2011, 08:17 AM #1
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
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
- 05-26-2011, 08:32 AM #2
Please go through the forum rules.
Your other thread has been removed from 'Advanced Java'
db
- 05-26-2011, 08:41 AM #3
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
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
- 05-26-2011, 01:27 PM #4
Member
- Join Date
- May 2011
- Posts
- 9
- Rep Power
- 0
just call the class that extend the JFrame with "new" keyword
eg. new class_name();
- 05-26-2011, 01:42 PM #5
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
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
- 05-26-2011, 01:52 PM #6
Member
- Join Date
- May 2011
- Posts
- 9
- Rep Power
- 0
call the class when the event occurs.............and it is possible.
And what do you mean by another project??????????
- 05-26-2011, 01:55 PM #7
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
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
- 05-26-2011, 02:01 PM #8
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
under an AcctionEvent performed?
Sandeep
- 05-26-2011, 02:27 PM #9
Member
- Join Date
- May 2011
- Posts
- 9
- Rep Power
- 0
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??????.
-
??
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.
- 05-27-2011, 02:34 AM #11
@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.
- 05-27-2011, 05:34 AM #12
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
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
-
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?
- 05-27-2011, 05:50 AM #14
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
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
-
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.
- 05-27-2011, 06:04 AM #16
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
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.
- 05-27-2011, 06:08 AM #17
I still do not understand why you need another frame. Why can't you just display a different panel in the current frame?
- 05-27-2011, 06:13 AM #18
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
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
- 05-27-2011, 06:19 AM #19
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.
- 05-27-2011, 06:23 AM #20
Member
- Join Date
- May 2011
- Posts
- 97
- Rep Power
- 0
Similar Threads
-
to pass a parameter from a jframe children to its jframe mother
By anix in forum NetBeansReplies: 5Last Post: 06-14-2010, 06:10 PM -
Passing data from one JFrame to another JFrame. - need help.
By Unsub in forum New To JavaReplies: 6Last Post: 04-12-2010, 11:33 AM -
Passing data from one JFrame to another JFrame
By tarami in forum New To JavaReplies: 3Last Post: 08-06-2009, 05:44 PM -
How to make a Jframe un-focusable when another Jframe is active?
By Robert_85 in forum Advanced JavaReplies: 4Last Post: 04-22-2009, 11:02 PM -
Calling a JFrame window from a command line program.
By new_2_java in forum New To JavaReplies: 7Last Post: 11-09-2008, 03:40 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks