Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
කිතුල් තලප
Manoj Suranga Bandara
Updated:
Yesterday at 7:04 PM
Ad icon
ව්යාපාර, Tuition පන්ති සහ Personal Portfolios සඳහා Web Setup එකක් රු. 9,099/- කට (වාර්ෂික renewal ර
thathsilura
Updated:
Thursday at 6:17 PM
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Aug 19, 2026
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Aug 18, 2026
🎬 CapCut Pro 1 Month Access! LKR 600
sayuru bandara
Updated:
Aug 18, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
ElaKiri Programmer's Club
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="MihiCherub" data-source="post: 21890461" data-attributes="member: 238676"><p><span style="font-size: 12px">Solution</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">Home class constructor එක public කරන්න. එහෙම නැතුව එකම instance එකක් විතරක්ම නම් ඕනෙ Home class constructor එක private තියල singleton pattern එක use කරන්න. හැබැයි class එක singleton කරනව නම් constructor එකට parameters යවල තේරුමක් නෑ. ඒක singleton නීති වලට පටහැනියි. singleton කරන එකේ මූලික අරමුණ නැති වෙලා යනව. මේ ටික දාන්න constructor close parenthesis එකට යටින්.</span></p><p></p><p>[CODE]private Home(){</p><p> mediaPlayerComponent = new EmbeddedMediaPlayerComponent();</p><p> vlc.setContentPane(mediaPlayerComponent);</p><p>}</p><p></p><p>public static Home getInstance(){</p><p> return HomeHolder.INSTANCE;</p><p>}</p><p></p><p>private static class HomeHolder{</p><p> private static final Home INSTANCE = new Home();</p><p>}</p><p></p><p>private void mediaPlay(String path, String name){</p><p> mediaPlayerComponent.getMediaPlayer().prepareMedia(path);</p><p> mediaPlayerComponent.getMediaPlayer().parseMedia();</p><p> mediaPlayerComponent.getMediaPlayer().play();</p><p> //String name - The assigned value is NEVER use</p><p>}[/CODE][CODE]public void mousePressed(MouseEvent evt) {</p><p> new NativeDiscovery().discover();</p><p> SwingUtilities.invokeLater(() -> {</p><p> //Home Player = new Home(Video_Path, Name);</p><p> Home Player = Home.getInstance();</p><p> Player.mediaPlay(Video_Path,Name); </p><p> });</p><p>} [/CODE]</p></blockquote><p></p>
[QUOTE="MihiCherub, post: 21890461, member: 238676"] [SIZE=3]Solution Home class constructor එක public කරන්න. එහෙම නැතුව එකම instance එකක් විතරක්ම නම් ඕනෙ Home class constructor එක private තියල singleton pattern එක use කරන්න. හැබැයි class එක singleton කරනව නම් constructor එකට parameters යවල තේරුමක් නෑ. ඒක singleton නීති වලට පටහැනියි. singleton කරන එකේ මූලික අරමුණ නැති වෙලා යනව. මේ ටික දාන්න constructor close parenthesis එකට යටින්.[/SIZE] [CODE]private Home(){ mediaPlayerComponent = new EmbeddedMediaPlayerComponent(); vlc.setContentPane(mediaPlayerComponent); } public static Home getInstance(){ return HomeHolder.INSTANCE; } private static class HomeHolder{ private static final Home INSTANCE = new Home(); } private void mediaPlay(String path, String name){ mediaPlayerComponent.getMediaPlayer().prepareMedia(path); mediaPlayerComponent.getMediaPlayer().parseMedia(); mediaPlayerComponent.getMediaPlayer().play(); //String name - The assigned value is NEVER use }[/CODE][CODE]public void mousePressed(MouseEvent evt) { new NativeDiscovery().discover(); SwingUtilities.invokeLater(() -> { //Home Player = new Home(Video_Path, Name); Home Player = Home.getInstance(); Player.mediaPlay(Video_Path,Name); }); } [/CODE] [/QUOTE]
Insert quotes…
Verification
Hathara warak wissa keeyada? (Hathara wadi karanna 20)
Post reply
Top
Bottom