• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79151
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I presume you already have the connection to MySQL working?
 
sukhbir barpagga
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can simply right click the java file which you want to copy and  click save as template option .The file is saved as template (tools - > templates -> Swing GUI forms). Now Create new jframe with Swing GUI frame -> 'template name' you gave previous step. Now you will get a new jframe with same GUI design.
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
sukhbir barpagga
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch


Amazing that this post is still going on guys, thank you so much for the help, i was 18 when i posted this in high school and now i am 23 😂😂,, but this forum helped me a lot 👏🏽👏🏽👏🏽


[edit by CR] Removed some quote tags which I think are only there by mistake.
 
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic