Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Swing panel as Single ton

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Can we use JPanel as single ton class where panel always gets populates dynamic data in one VM process.is it a good idea ?

If not single ton then how can we provide single point of access in GUI application ..

help needed for better design ..

Rishi
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rishi,

Welcome back to the ranch! Please remove the comma from your display name ("unorthodox punctuation" as specified in Official policy on registered names). You can adjust your display name here. Thank You very much for your cooperation.
 
Rishi Yagnik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone Can help me ...
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with the Singleton pattern is the *global* access point - it leads to coupling that we typically want to avoid.

Can you elaborate on why you need a single access point, please?

Google for "Just Create One" to find a good article on an alternative to the Singleton pattern.

Also note that your display still doesn't conform to our naming policy - it requires a first and a last name. Thanks in advance for adhering to it - it's an important part in our quest to keep a nice atmosphere around here.
 
Rishi Yagnik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply ..

1st Solution :

I am working with Swing application and I was thinking all the GUI Panels can be single ton so that i can invoke action from one panel to another.(Single point of access).

2nd Solution :

I can set up observer for set of action which can help me for interaction between panel user action(like menu action).

I know single ton dont make sense over here ..but still seeking for some advice .
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your second solution sounds much better to me...
 
Honk if you love justice! And honk twice for tiny ads!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic