This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to copy the gui design from one jframe to another jframe  RSS feed

 
sukhbir barpagga
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the gui design for a frame(its pretty bad) but the point is I want to copy this same design to all the other 90 frames how can I do so ? the design is shown below
 
Campbell Ritchie
Sheriff
Posts: 53742
127
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Why have you got more than one frame. You should only use one frame instance and add the other display components to it.
 
sukhbir barpagga
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yes that was exactly what I was thinking to just have a single frame , but I'm not sure how do I change the display components . Thanks for the reply.
 
Rob Camick
Ranch Hand
Posts: 2752
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to copy this same design to all the other 90 frames how can I do so


I don't understand this requirement either. I doubt you have an application with 90 different forms.

More than likely you might have a list and then you select an item from your list and then display more details about the selected Item.

In any case it does not make sense to have 90 duplicate panels. You need to better describe your requirement.

In the meantime you can start by looking at the Swing tutorial to better understand how Swing works.


 
sukhbir barpagga
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok I will tell you what I'm trying to do is I have created an assignment application to buy property. I have different locations and price which are in combo box selection. when they selected all the different combo box they go to next frame, in which all the frames are supposed to have the same layout. the data is connected with MySQL.
Screenshot (4).png
[Thumbnail for Screenshot (4).png]
this is the application desing
 
sukhbir barpagga
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the source which i am using. and had created all the mess
Screenshot (5).png
[Thumbnail for Screenshot (5).png]
this is the source im using
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sukhbir barpagga wrote:... in which all the frames are supposed to have the same layout. the data is connected with MySQL.

In pseudo code
1) Create one JPanel instance.
2) Use proper layout manager to add all required child components (JComboBox, JButton etc)
3) Add the JPanel to the JFrame and display it.
4) When the user selection changes, it will result in the display data change. Refresh the existing JPanel to display the new data.

In a nutshell, use one JPanel as a template and change the data as required. No need to have 90 panels/frames
 
Campbell Ritchie
Sheriff
Posts: 53742
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I presume you already have the connection to MySQL working?
 
sukhbir barpagga
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No the connection is not yet done , I just added the connected just have to write the code for it . And I'm not sure what a layout manager is ?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sukhbir barpagga wrote:And I'm not sure what a layout manager is ?

Recommended reading : https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
 
sukhbir barpagga
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alright so i have to add a jPanel to the the jFrame where the selection of combo boxes and radiobuttons take place .?
 
Campbell Ritchie
Sheriff
Posts: 53742
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:. . . Recommended reading : https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
Read the rest of the tutorial “trail”. You put the buttons where you want them; how can we tell you where to put them?
 
sukhbir barpagga
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no no thats no what i meant. i was asking that should i put the jpanel on the frame {which is attached} because i was using absolute layout already before.
Screenshot (4).png
[Thumbnail for Screenshot (4).png]
should i put the jpanel in this frame
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sukhbir barpagga wrote:no no thats no what i meant. i was asking that should i put the jpanel on the frame {which is attached} because i was using absolute layout already before.

Yes
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!