Thread View: borland.public.jbuilder.java.swing
7 messages
7 total messages
Started by Lodhi
Thu, 10 Mar 2005 14:51
JDesktopPane problem
Author: Lodhi
Date: Thu, 10 Mar 2005 14:51
Date: Thu, 10 Mar 2005 14:51
2 lines
1005 bytes
1005 bytes
Is in JDesktopPane I call other Frames (or Internal Frames). As I developed 30 JFrame classes in building an application but now I want to use them in JDesktopPane to have JDesktoppane facility and using the same JMenuBar in all frame classes(without replicating code in other classes? Is it possible)
Re: JDesktopPane problem
Author: John McGrath [TeamB]
Date: Sat, 12 Mar 2005 02:06
Date: Sat, 12 Mar 2005 02:06
22 lines
1777 bytes
1777 bytes
On 3/10/2005 at 9:51:19 AM, Lodhi wrote:
> Is in JDesktopPane I call other Frames (or Internal Frames). As I
> developed 30 JFrame classes in building an application but now I want to
> use them in JDesktopPane to have JDesktoppane facility and using the
> same JMenuBar in all frame classes(without replicating code in other
> classes? Is it possible)
No, you cannot put a JFrame in a JDesktopPane. If you do a little
refactoring, you could move the UI components that you now have in JFrames
into JPanels. You could them place the JPanels in either type of frame.
It should not be too hard to write a general utility to create the frame,
set up the menu, etc.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: JDesktopPane problem
Author: Paul Nichols (TeamB)
Date: Sat, 12 Mar 2005 21:51
Date: Sat, 12 Mar 2005 21:51
18 lines
1649 bytes
1649 bytes
"Lodhi" <atiqlodhi@yahoo.com> wrote in message news:42305ee7$1@newsgroups.borland.com... > > Is in JDesktopPane I call other Frames (or Internal Frames). As I developed 30 JFrame classes in building an application but now I want to use them in JDesktopPane to have JDesktoppane facility and using the same JMenuBar in all frame classes(without replicating code in other classes? Is it possible). Of course!! However, as I stated before, you need to make JMenuBar a class outside of your MainFrame and deploy your listeners and ActionEvents, in a separate class as well. See the Tutorials and Examples on Swing development on the JavaSoft site for details. BTW, If you are going to be using JDesktopPane, then I would change my JFrames to JInternalFrames.
Re: JDesktopPane problem
Author: Lodhi
Date: Mon, 14 Mar 2005 21:21
Date: Mon, 14 Mar 2005 21:21
32 lines
2495 bytes
2495 bytes
I am using JinternalFrames in JFrame(JDesktopPane) now . I am getting difficulty in navigation in them...Let us say I have two Jinternalframes student & courses. I can set links to them from JFrame by using JMenubar. But when I try to set their link (as a requirement) inside Jinternal frame like From Student JinternalFrame when a button clicked it opens Course JinternalFrame in JdesktopPane but In Student JinternalFrame i did not have accesisbility of JDesktopPane instance to do work have any suggestion please post it soon with details(and if possible with example) Regards Lodhi "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote: >On 3/10/2005 at 9:51:19 AM, Lodhi wrote: > >> Is in JDesktopPane I call other Frames (or Internal Frames). As I >> developed 30 JFrame classes in building an application but now I want to >> use them in JDesktopPane to have JDesktoppane facility and using the >> same JMenuBar in all frame classes(without replicating code in other >> classes? Is it possible) > >No, you cannot put a JFrame in a JDesktopPane. If you do a little >refactoring, you could move the UI components that you now have in JFrames >into JPanels. You could them place the JPanels in either type of frame. >It should not be too hard to write a general utility to create the frame, >set up the menu, etc. > >-- >Regards, > >John McGrath [TeamB] > >--------------------------------------------------- >Before sending me e-mail, please read: > http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: JDesktopPane problem
Author: John McGrath [TeamB]
Date: Mon, 14 Mar 2005 23:37
Date: Mon, 14 Mar 2005 23:37
28 lines
2138 bytes
2138 bytes
On 3/14/2005 at 4:21:15 PM, Lodhi wrote:
> I am using JinternalFrames in JFrame(JDesktopPane) now . I am getting
> difficulty in navigation in them...Let us say I have two Jinternalframes
> student & courses. I can set links to them from JFrame by using
> JMenubar. But when I try to set their link (as a requirement) inside
> Jinternal frame like From Student JinternalFrame when a button clicked
> it opens Course JinternalFrame in JdesktopPane but In Student
> JinternalFrame i did not have accesisbility of JDesktopPane instance to
> do work
>
> have any suggestion please post it soon with details(and if possible
> with example)
I do not understand what you mean by "setting links to them using
JMenuBar" or "accesisbility of JDesktopPane instance". If you have some
code that is not working as you expect, it would be a good idea to post
the actual code - ideally a complete, working example. Descriptions of
the code are a poor substitute.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: JDesktopPane problem
Author: Lodhi
Date: Tue, 15 Mar 2005 07:45
Date: Tue, 15 Mar 2005 07:45
107 lines
4840 bytes
4840 bytes
Thanks for your mail.
At very simple scenario...!
We have two JInternalFrames, One JIF is representing Student Contact Information, whereas the other JIF is representing Student Course Information.....
User Come and open the 'Student Contact Information Form' and enters student contact detail and then user clicks the "NEXT" button on JInternalForm of Student Contact Information. This button action displays Student Course Information Form......!
This is not working....! Navigating through buttons in JIFs.
However, if user clicks the Menubar item 'Student Contact Information' then it displays Student information form, and when user click MenuItem of 'Student Course Information' it displays the other form.
Actually one way is working and the other way is not.....!
public class Main extends JFrame implements ActionListener, InternalFrameListener
{
//here some code for jdesktoppane and menubar in jbinit
//including instance of jdpDesktop of JDesktopPane
//code for menuitems
void jMenuItem1_actionPerformed(ActionEvent e) {
JInternalFrame ct = new Student();
try {
jdpDesktop.add(ct, JLayeredPane.DEFAULT_LAYER);
ct.addInternalFrameListener(this); // Listen for events
jdpDesktop.moveToFront(ct);
ct.pack();
ct.show();
ct.setSelected(true);
} catch (PropertyVetoException ex) {
}
}
void jMenuItem2_actionPerformed(ActionEvent e) {
JInternalFrame bizt = new Course();
try {
jdpDesktop.add(bizt, JLayeredPane.DEFAULT_LAYER);
bizt.addInternalFrameListener(this); // Listen for events
jdpDesktop.moveToFront(bizt);
bizt.pack();
bizt.show();
bizt.setSelected(true);
} catch (PropertyVetoException ex) {
}
}
But If I want to go to Course InternalFrame from Student I add a JButton in Student class and want to show screen Course when user click on it
public class Student extends JInternalFrame {
//some code here
void jButton2_actionPerformed(ActionEvent e) {
JInternalFrame c=new Course();
try {
//I did not have visiblity to this variable of Main class
// jdpDesktop.add(c, JLayeredPane.DEFAULT_LAYER);
//or I create new instance of JDesktopPane and do it
JDesktopPane jdp=new JDesktopPane();
jdp.add(c, JLayeredPane.DEFAULT_LAYER);
// c.addInternalFrameListener(this); // Listen for events
jdp.moveToFront(c);
c.setSize(400,400);
c.show();
c.setSelected(true);
c.setVisible(true);
} catch (PropertyVetoException ex) {
}
}
My all tries are not working
What code I will write in above method.......
Thanks for your patience...respond soon
Regards,
Lodhi
"John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote:
>On 3/14/2005 at 4:21:15 PM, Lodhi wrote:
>
>> I am using JinternalFrames in JFrame(JDesktopPane) now . I am getting
>> difficulty in navigation in them...Let us say I have two Jinternalframes
>> student & courses. I can set links to them from JFrame by using
>> JMenubar. But when I try to set their link (as a requirement) inside
>> Jinternal frame like From Student JinternalFrame when a button clicked
>> it opens Course JinternalFrame in JdesktopPane but In Student
>> JinternalFrame i did not have accesisbility of JDesktopPane instance to
>> do work
>>
>> have any suggestion please post it soon with details(and if possible
>> with example)
>
>I do not understand what you mean by "setting links to them using
>JMenuBar" or "accesisbility of JDesktopPane instance". If you have some
>code that is not working as you expect, it would be a good idea to post
>the actual code - ideally a complete, working example. Descriptions of
>the code are a poor substitute.
>
>--
>Regards,
>
>John McGrath [TeamB]
>
>---------------------------------------------------
>Before sending me e-mail, please read:
> http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: JDesktopPane problem
Author: John McGrath [TeamB]
Date: Wed, 16 Mar 2005 01:44
Date: Wed, 16 Mar 2005 01:44
35 lines
2494 bytes
2494 bytes
On 3/15/2005 at 2:45:10 AM, Lodhi wrote:
First, I should mention that when you include code in a post, it would
very helpful if you would format it reasonably. Some newsreaders do not
handle tabs, so it is a good idea to untabify the code before you paste it
in. If that does not work, you can just format it yourself in the message.
> try {
> //I did not have visiblity to this variable of Main class
> // jdpDesktop.add(c, JLayeredPane.DEFAULT_LAYER);
>
> //or I create new instance of JDesktopPane and do it
> JDesktopPane jdp=new JDesktopPane();
> jdp.add(c, JLayeredPane.DEFAULT_LAYER);
If you want to add a new JInternalFrame to the existing, instance of
JDesktopPane that is being displayed, then creating a new JDesktopPane
and adding it to that does not help. You need to make sure you have
access to that existing instance. One way to do this is to pass it an
argument in its constructor.
It would also make a lot more sense to write a single method to create the
new JInternalFrame. Instead of placing that code in the ActionListener
for a menu item, extract that into a separate method which you call from
that ActionListener. Then you can use the same method when you want to
create the frame from a different context.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads