<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>package &#8211; The SIGMA</title>
	<atom:link href="https://danushka96.github.io/sigma/index.php/tag/package/feed/" rel="self" type="application/rss+xml" />
	<link>https://danushka96.github.io/sigma/</link>
	<description>&#60;For Those Who Code/&#62;</description>
	<lastBuildDate>
	Sat, 02 Mar 2019 16:57:34 +0000	</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.1.1</generator>
	<item>
		<title>Graphical User Interface &#8211; දෙවන පියවර</title>
		<link>https://danushka96.github.io/sigma/index.php/2018/06/08/graphical-user-interface-2/</link>
				<comments>https://danushka96.github.io/sigma/index.php/2018/06/08/graphical-user-interface-2/#respond</comments>
				<pubDate>Fri, 08 Jun 2018 14:36:51 +0000</pubDate>
		<dc:creator><![CDATA[Gayan Sampath]]></dc:creator>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[Gui]]></category>
		<category><![CDATA[JFrame]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[Window]]></category>

		<guid isPermaLink="false">https://danushka96.github.io/sigma/?p=1118</guid>
				<description><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">4</span> <span class="rt-label rt-postfix">minutes</span></span> හරි යාලුවනේ ..ඔන්න මං අදත් ආවා කලින් පාඩමේ ඉතිරි කොටසත් සමගින්&#8230;the sigma blog අඩවියට පැමිණි ඔයාලා හැමෝම සාදරයෙන් පිලිගන්නවා.. කලින් පාඩමේදී අපි කතා කලා මොකක්ද GUI එකක් කියන්නේ කියලා සහ කොහොමද. GUI එකක් හදා ගන්නේ කියලා&#8230;ඒ ගැන මතක ඇති කියලා හිතනවා..මතක නෑ වගේ නම් මෙතනින් ගිහින් කලින් පාඩමත් බලන් එන්නකෝ..<a class="moretag" href="https://danushka96.github.io/sigma/index.php/2018/06/08/graphical-user-interface-2/"> Read more&#8230;</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2018/06/08/graphical-user-interface-2/">Graphical User Interface &#8211; දෙවන පියවර</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></description>
								<content:encoded><![CDATA[<span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">4</span> <span class="rt-label rt-postfix">minutes</span></span><p>හරි යාලුවනේ ..ඔන්න මං අදත් ආවා කලින් පාඩමේ ඉතිරි කොටසත් සමගින්&#8230;the sigma blog අඩවියට පැමිණි ඔයාලා හැමෝම සාදරයෙන් පිලිගන්නවා.. කලින් පාඩමේදී අපි කතා කලා මොකක්ද GUI එකක් කියන්නේ කියලා සහ කොහොමද. GUI එකක් හදා ගන්නේ කියලා&#8230;ඒ ගැන මතක ඇති කියලා හිතනවා..මතක නෑ වගේ නම් <a href="https://danushka96.github.io/sigma/index.php/2018/04/23/graphical-user-interface-1_step/" target="_blank" rel="noopener">මෙතනින්</a> ගිහින් කලින් පාඩමත් බලන් එන්නකෝ..</p>
<p>අද අපි කතා කරන්න යන්නේ කලින් පාඩමේදී සාදාගත් window එකට graphical element add කරන එක&#8230;.හරි මුලින්ම අපි window එකට නමක් දෙමුකෝ&#8230;තවත් විදියකින් කියනවනම් window එකට title එකක් set කරමුකෝ&#8230;මේ සදහා අපි පාවිච්චි කරනවා setTitle() කියන method එක&#8230;.argument එකක් විදියට අපිට ඕනි title එකක් විදියට pass කරන්න පුලුවන්&#8230;code එක බලන්නකෝ&#8230;</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		MyJavaFrame.setTitle("My first Java Frame !");
       }
}

</pre>
<p>Output&#8230;</p>
<p><img class="wp-image-1119 aligncenter" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui1-300x181.jpg" alt="" width="457" height="276" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui1-300x181.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui1.jpg 593w" sizes="(max-width: 457px) 100vw, 457px" /></p>
<p>හරි title එකක් නම් set කලා..දැන් අපි බලමු label එකක් කොහොමද set කරන්නේ කියලා..</p>
<p>Label එකක් හදනකොට කරන්නෙත් අර window එකක් හදනකොට කරපු දේම තමයි&#8230;ඒ කිව්වේ&#8230;window එකක් හදන අවස්ථාවේ කලේ JFrame කියලා කලින් predefine කරලා තිබුන class එකක object එකක් හදපු එකනේ&#8230;මෙතනදි කරන්නෙත් ඒ දේම තමයි..JLabel කියලා class එකක් කලින් define කරලා තියනවා &#8230;අන්න ඒ class එකේ object එකක් හදන එක තමයි කරන්නේ&#8230;JFrame , JLabel විතරක් නෙවෙයි JPanel,JMenu, JButton,JTextArea,JTextField වගේ class ගොඩක් predefine කරලා තියනවා අපි අර මුලින්ම import කරලා තියන package ඇතුලේ&#8230;අපිට තියෙන්නේ අවශ්ය graphical element එකේ object එකක් හදන එක විතරයි&#8230;හරි ලේසියි නේද😃😃&#8230;.</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		MyJavaFrame.setTitle("My first Java Frame !");

		<strong>JLabel lebel1=new JLabel();</strong>
		
       }
}

</pre>
<p>ඔන්න ඔහොම තමයි label එකක් හදා ගන්නේ&#8230;label එකක් නිකං හැදුවට වැඩක් නෑනේ&#8230;ඒක අපේ window එකට set කරන්නත් ඕනිනේ&#8230;මේ සදහා අපි පාවිච්චි කරනවා add කියන keyword එක.</p>
<p>හදාගත්ත label එක add කරනකොට add කරන්න බලාපොරොත්තු වන ස්ථානයත් දෙන්න ඕනි වරහන් ඇතුලේ&#8230;North, South, East , West හා Center කියලා add කරන්න පුලුවන් ස්ථාන පහක් තියනවා&#8230;labels,buttons,textFields .. වගේ ඒවා අපිට මේ ස්තාන වලට add කරන්න පුලුවන්..</p>
<p><img class="wp-image-1123 aligncenter" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui5-300x259.jpg" alt="" width="386" height="333" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui5-300x259.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui5.jpg 457w" sizes="(max-width: 386px) 100vw, 386px" /></p>
<p>ඔන්න ඔය ස්ථාන පහටම button එක add කලාම මෙන්න මේ වගේ&#8230;</p>
<p><img class="wp-image-1124 aligncenter" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui6-300x72.jpg" alt="" width="551" height="132" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui6-300x72.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui6.jpg 724w" sizes="(max-width: 551px) 100vw, 551px" /></p>
<p>තව දෙයක් තියනවා ..<strong>.graphical element එක add කරන්න ඕනි ස්ථානය දක්වද්දී පලවෙනි අකුර upper case එකක් වෙන්නත් ඕනි</strong>&#8230;</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		MyJavaFrame.setTitle("My first Java Frame !");

		JLabel label1=new JLabel("This is a Lebel !");
		
		<strong>MyJavaFrame.add("North",label1);</strong>
		
       }
}

</pre>
<p>output එකත් බලන්නකෝ&#8230;</p>
<p><img class="wp-image-1120 aligncenter" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui2-300x177.jpg" alt="" width="434" height="256" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui2-300x177.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui2.jpg 610w" sizes="(max-width: 434px) 100vw, 434px" /></p>
<p>හරි label එකකුත් දැම්මා&#8230;දැන් අපි බලමු panel එකක් අපේ window එකට එකතු කරන්නේ කොහොමද කියලා..කලින් වගේම තමයි Jpanel කියන class එකේ object එකක් හදලා add keyword එක පාවිච්චි කරලා set කරන්න තමයි තියෙන්නේ&#8230;</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		MyJavaFrame.setTitle("My first Java Frame !");

		JLabel label1=new JLabel("This is a Lebel !");
		
		MyJavaFrame.add("North",label1);

		<strong>JPanel panel1=new JPanel();
	
		MyJavaFrame.add(panel1);</strong>	
       }
}

</pre>
<p>output එකත් බලන්නකෝ&#8230;</p>
<p><img class="wp-image-1120 aligncenter" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui2-300x177.jpg" alt="" width="397" height="234" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui2-300x177.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui2.jpg 610w" sizes="(max-width: 397px) 100vw, 397px" /></p>
<p>කිසි වෙනසක් පේන්නේ නෑ නේද&#8230;ඇත්තටම panel එක අපේ window එකට add වෙලා තියෙන්නේ..window එකේ පාටයි panel එකේ පාටයි සමාන නිසා තමයි අපිට panel එක පේන්නේ නැත්තේ&#8230; මෙන්න මේ විදියට panel එකේ පාට වෙනස් කරන්නකෝ&#8230;.</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		MyJavaFrame.setTitle("My first Java Frame !");

		JLabel label1=new JLabel("This is a Lebel !");
		
		MyJavaFrame.add("North",label1);

		JPanel panel1=new JPanel();

		<strong>panel1.setBackground(Color.BLUE);</strong>

		MyJavaFrame.add(panel1);	
       }
}

</pre>
<p>හරි දැන් බලන්නකෝ output එක &#8230;</p>
<p><img class="wp-image-1121 aligncenter" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui3-300x204.jpg" alt="" width="457" height="311" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui3-300x204.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui3.jpg 498w" sizes="(max-width: 457px) 100vw, 457px" /></p>
<p>හරි දැන් panel එක පේනවා නේද..හරි panel එකකුත් හැදුවා&#8230;දැන් අපි බලමු Text field එකකුයි text area එකකුයි හදන්නේ කොහොමද කියලා&#8230;කලින් වගේම JtextField කියන class එකෙයි , JtextArea කියන class එකෙයි object හදන්න තමයි තියෙන්නේ&#8230;පොඩි වෙනසයි තියෙන්නේ object හදනකොට constructor එක ඇතුලේ coloms ගනනයි rows ගනනයි pass කරන්න තියෙන්නේ..</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		MyJavaFrame.setTitle("My first Java Frame !");

		JLabel label1=new JLabel("This is a Lebel !");
		
		MyJavaFrame.add("North",label1);
		JPanel panel1=new JPanel();

		panel1.setBackground(Color.BLUE);

		MyJavaFrame.add(panel1);

		<strong>JTextField textField1=new JTextField();

		JTextArea textArea1=new JTextArea(5,5);	</strong>
	
		
       }
}


</pre>
<p>හරි ඔන්න ඔහොම හදාගත්ත text field එකයි text area එකයි අපේ window එකට add කරනකොට ටිකක් කල්පනා කරන්න වෙනවා&#8230;මොකද දන්නවද&#8230;කලින් අපි panel එකක් හදලා window එකට add කරපු නිසා අලුතින් හදන elements window එකට add කලාට පෙනෙන්නේ නෑ&#8230;අන්න එතකොට අපි අලුත් elements add කරනවා අපේ panel එකට&#8230;</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		MyJavaFrame.setTitle("My first Java Frame !");

		JLabel label1=new JLabel("This is a Lebel !");
		
		MyJavaFrame.add("North",label1);
		JPanel panel1=new JPanel();

		panel1.setBackground(Color.BLUE);

		MyJavaFrame.add(panel1);

		<strong>JTextField textField1=new JTextField();

		JTextArea textArea1=new JTextArea(5,5);	
	
		panel1.add("North",textField1);
		panel1.add("South",textArea1);
		MyJavaFrame.add(panel1);</strong>
       }
}

</pre>
<p>අව්ලක් නෑ නේද..හරි දැන් අපි බලමු button එකක් කොහොමද අපේ window එකට set කරන්නේ කියලා&#8230;ලොකු වෙනසක් නෑ&#8230;JButton කියන class එකේ object එකක් හදන්න තමයි තියෙන්නේ&#8230;button එකට අවශය නම constractor එකින් pass කරන්න පුලුවන්&#8230;හරි අපේ window එකට button එකක් add කරනවා North කියන position එකට&#8230;</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		MyJavaFrame.setTitle("My first Java Frame !");

		JButton button=new JButton("Click me !");
		MyJavaFrame.add("North",button);
       }
}


</pre>
<p>හරි ඔන්න ඔය විදියට button එකක් හදාගන්න පුලුවන්&#8230;</p>
<p>out put එකත් පොඩ්ඩක් බලන්නකෝ&#8230;</p>
<p><img class="wp-image-1125 aligncenter" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui6-1-300x224.jpg" alt="" width="454" height="339" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui6-1-300x224.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/06/gui6-1.jpg 477w" sizes="(max-width: 454px) 100vw, 454px" /></p>
<p>හරි නේද&#8230;ඔන්න ඔහොමයි button එකක් add කරන්නේ&#8230;.හරි අදට ඇති වගේ නේ..😃😃……මීලඟ පාඩමත් සමගින් හමුවෙමු.සුභ දවසක්!</p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2018/06/08/graphical-user-interface-2/">Graphical User Interface &#8211; දෙවන පියවර</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://danushka96.github.io/sigma/index.php/2018/06/08/graphical-user-interface-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Graphical User Interface &#8211; පළමු පියවර</title>
		<link>https://danushka96.github.io/sigma/index.php/2018/04/23/graphical-user-interface-1_step/</link>
				<comments>https://danushka96.github.io/sigma/index.php/2018/04/23/graphical-user-interface-1_step/#respond</comments>
				<pubDate>Mon, 23 Apr 2018 13:43:11 +0000</pubDate>
		<dc:creator><![CDATA[Gayan Sampath]]></dc:creator>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[package]]></category>

		<guid isPermaLink="false">https://danushka96.github.io/sigma/?p=991</guid>
				<description><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">3</span> <span class="rt-label rt-postfix">minutes</span></span> හරි යාලුවනේ ඔන්න මං අයෙත් ආවා අලුත් පාඩම් මාලාවක් සමගින්..😀😀😃&#8230;මේ තමයි එහි පලමු දිගහැරුම&#8230;පුරුදු විදියටම ආයුබෝවන් කියලා යාලුවෝ හැමෝම පිලිගන්නවා.. the sigma අඩවියට ගියොත් ඔයාලට අපේ කලින් මඟහැරුනු පාඩම් ඔක්කොම බලන්නත් පුලුවන්..හරි එහෙනං අපි බහිමු අද පාඩමට&#8230;මම කලින්ම කිව්වනේ අලුත් පාඩමක් පටන් ගන්න යන්නේ කියලා&#8230;ඇත්තටම මොකද්ද පටන් ගන්න යන පාඩම&#8230;ඒ<a class="moretag" href="https://danushka96.github.io/sigma/index.php/2018/04/23/graphical-user-interface-1_step/"> Read more&#8230;</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2018/04/23/graphical-user-interface-1_step/">Graphical User Interface &#8211; පළමු පියවර</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></description>
								<content:encoded><![CDATA[<span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">3</span> <span class="rt-label rt-postfix">minutes</span></span><p>හරි යාලුවනේ ඔන්න මං අයෙත් ආවා අලුත් පාඩම් මාලාවක් සමගින්..😀😀😃&#8230;මේ තමයි එහි පලමු දිගහැරුම&#8230;පුරුදු විදියටම ආයුබෝවන් කියලා යාලුවෝ හැමෝම පිලිගන්නවා.. <a href="https://danushka96.github.io/sigma/">the sigma</a> අඩවියට ගියොත් ඔයාලට අපේ කලින් මඟහැරුනු පාඩම් ඔක්කොම බලන්නත් පුලුවන්..හරි එහෙනං අපි බහිමු අද පාඩමට&#8230;මම කලින්ම කිව්වනේ අලුත් පාඩමක් පටන් ගන්න යන්නේ කියලා&#8230;ඇත්තටම මොකද්ද පටන් ගන්න යන පාඩම&#8230;ඒ තමයි graphical user interface ..මොකද්ද මේ graphical user interface එකක් කියන්නේ&#8230;මොකටද පාවිච්චි වෙන්නේ&#8230;කොහොමද interface එකක් හදන්නේ..ඔන්න ඔය වගේ ප්‍රශ්න load එකක් ඔයාලගේ ඔලුවට එනවා ඇති&#8230;the sigma සමග නිරන්තරයෙන් රැදී හිටියොත් ඔන්න ඔය ප්‍රශ්න ඔක්කෝටම සරලව විසදුම් ලබා ගන්න පුලුවන්..ඒ නිසා දිගටම අපිත් සමඟ රැඳී සිටින්න කියලා යාලුවෝ හැමෝටම ආරාධනා කරනවා..</p>
<p>හරි මොකද්ද graphical user interface(GUI) එකක් කියලා කියන්නේ&#8230;කෙටියෙන්ම කියනවානම් windows , buttons , icons වගේ graphical elements එකතු කරලා හදපු අතුරු මුහුණතක්&#8230;හරි මෙහෙම හිතන්නකෝ&#8230; ඔයා code කරනවා programme එකක්&#8230;ඒකෙ input දෙන්නේ කොහොමද , ඒක run කරන්නේ කොහොමද වගේ දේවල් ඔයා හොදටම දන්නවා&#8230;මොකද කියනවනම් programme එක හැදුවේ ඔයා නිසා&#8230;හිතන්නකෝ programming ගැන මොකුත්ම දන්නැති කෙනෙක්ට programme එක පාවිච්චි කරන්න දෙනවා කියලා&#8230;එයා නිකං කරකවලා අතහැරියා වගේ නේද.😃😃..ඔන්න ඔය අවුල නැති කරන්න පුලුවන් graphical user interface (user friendly graphical user interface ) එකක් පාවිච්චි කරලා&#8230;තවත් විදියකින් කියනවනම් programming ගැන මොකුත් නොදන්නා අයෙකුට පවා programme එකත් සමග වැඩ කරන්න පුලුවන් වෙන විදියට හදපු අතුරු මුහුණතකට තමයි graphical user interface එකක් කියන්නේ.. හරි idea එකක් ආවා නේද මොකද්ද graphical user interface (GUI) එකක් කියන්නේ කියලා&#8230;හරි එහෙනං අපි බලමු කොහොමද GUI එකක් හදන්නේ කියලා..මේ සදහා මම පාවිච්චි කරනවා Java programming language එක.</p>
<p>GUI එකක් හදන්න ඉස්සරින් මුලින්ම කරන්න ඕනි දෙයක් තමයි java package එකේ තියන awt library එකකයි swing library එකයි import කරගන්න එක.awt library එක ගත්තොත් ඒක ඇතුලේ තියනවා Dimension , Toolkit , Color වගේ library ගොඩක් predefine කරලා තියනවා&#8230;swing library එක ගත්තොත් ..panels,buttons, icons .. වගේ ඒවා predifine කරලා තියනවා..අපි GUI එකක් හදනකොට මේ libraries මුලින්ම import කරගෙන ඉන්න ඕනි.එකින් එක වෙන වෙනම import කරනවට වඩා ලේසියි මෙන්න මේ වගේ ඔක්කොම එකපාර import කරන එක.</p>
<pre>import java.awt.*;

import java.swing.*;

</pre>
<p>හරි ඔන්න ඔහොම තමයි libraries ටික import කර ගන්නේ.. හරි එහෙනන් අපි interface එකක් හදන්න පටාන් ගමු☺☺..</p>
<p>interface එකක් හදන්න පුලුවන් ආකාර දෙකක් තියනවා&#8230;පලවෙනි විදිය තමයි <a href="https://danushka96.github.io/sigma/index.php/2018/03/25/object-oriented-programming-5/">inheritance </a> පාවිච්චි කරලා..අනික් විදිය තමයි <a href="https://danushka96.github.io/sigma/index.php/2018/03/25/object-oriented-programming-5/">inheritance </a> පාචිච්චි කරන් නැතුව .. ක්‍රම දෙකේ ලොකු වෙනසක් නෑ..හරි මම <a href="https://danushka96.github.io/sigma/index.php/2018/03/25/object-oriented-programming-5/">inheritance </a> පාවිච්චි කරලම හදන්නම්කෝ&#8230;හරි මුලින්ම අපි window එකක් හදාගෙන ඉමු&#8230;</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();

       }
}

</pre>
<p>හරි ඔන්න ඔය විදියට තමයි window එකක් හදන්නේ..ඇත්තටම මෙතනදි කරලා තියෙන්නේ මේකයි &#8230; window එකක් හදන හැටි define කරලා තියෙන්නේ අපි import කරපු package එකේ තියන Jframe කියන Class එකේ .. අපි මෙතනදි කලේ ඒ class එකේ(Jframe) object එකක් හදපු එක.හරි දැන් code එක compile කරන්නකෝ..හදපු window එක පේන්නේ නෑ නේද&#8230;දැන් මොකද කරන්නේ&#8230;ඒකට අපි setVisible කියන method එක call කරලා argument එකක් විදියට true කියන boolean value එක pass කරනවා&#8230;</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
       }
}


</pre>
<p>හරි දැන් compile කරන්නකෝ..දැන් ඔයාගේ screen එකේ කොනක අපි හදාගත්තු window එක චූටිවට තියනවා නේද&#8230;</p>
<p><img class="alignnone wp-image-1001" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui-300x180.jpg" alt="" width="527" height="316" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui-300x180.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui.jpg 596w" sizes="(max-width: 527px) 100vw, 527px" /></p>
<p>ඔන්න ඕක අපිට ඕනි ප්‍රමාණයට හදා ගන්න පුලුවන් setSize( height,width) කියන method එක call කරලා.. arguments විදියට අපිට අවශය height එකයි width එකයි pass කරන්න පුලුවන්..</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
       }
}

</pre>
<p>හරි දැන් compile කලාම මෙන්න මේ වගේ window එකක් එනවා නේද&#8230;</p>
<p><img class="alignnone wp-image-1002" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_2-300x158.jpg" alt="" width="532" height="280" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_2-300x158.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_2-768x406.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_2-1024x541.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_2.jpg 1138w" sizes="(max-width: 532px) 100vw, 532px" /></p>
<p>හරි ..code එක compile වෙලා window එක default හැදෙන්නේ screen එකේ කොනක නේද&#8230;අන්න ඒක screen එකේ මැද හදාගන්න ඕනි නම් setLocationRelativeTo() කියන method එක call කරනවා..මෙහිදී argument එකක් විදියට null කියන value එක pass කරනවා..</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
       }
}

</pre>
<p>හරි දැන් compile කරන්නකෝ&#8230;</p>
<p><img class="alignnone wp-image-1003" src="https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_3-300x169.jpg" alt="" width="531" height="299" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_3-300x169.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_3-768x432.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_3-1024x576.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2018/04/gui_3.jpg 1366w" sizes="(max-width: 531px) 100vw, 531px" /></p>
<p>ඒ වැඩෙත් හරි එතකොට&#8230;.දැන් හදපු window එක close කරන්නකෝ&#8230;දැන් පොඩ්ඩක් compiler එක දිහාත් බලන්නකෝ&#8230;compiler එකේ පෙන්න විදියට programme එක තාම run වෙනවා නේද&#8230;ඒ කියන්නේ window එක close කලාට programme එක තාමත් run වෙනවා නේද&#8230;මෙන්න මේ අව්ල නැති කරන්න පුලුවන් setDefaultCloseOperation() කියන method එක call කරලා&#8230;මෙහිදී argument එක විදියට Jframe.EXIT_ON_CLOSE කියන parameter එක තමයි pass කරන්නේ..</p>
<pre>import java.awt.*;
import javax.swing.*;

class Gui extends JFrame{
	public static void main(String args[]){
		JFrame MyJavaFrame=new JFrame();
		MyJavaFrame.setVisible(true);
		MyJavaFrame.setSize(300,300);
		MyJavaFrame.setLocationRelativeTo(null);
		MyJavaFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       }
}
</pre>
<p>හරි දැන් code එක compile කරලා window එක close කරලා compiler එක දිහා බලන්නකෝ&#8230;දැන්නම් අව්ලක් නෑ නේද&#8230;window එක close කරනකොටම programme එකත් run වෙලා ඉවරයි&#8230;</p>
<p>හරි අදට ඇති නේ..😃😃&#8230;GUI වල basic ටික ඉගෙන ගෙන ඉවරයි දැන්&#8230;මීලඟ පාඩමෙන් අපි බලමු හදාගත්ත window එකට icons සහ buttons add කරන්නේ කියලා&#8230;මීලග පාඩමත් සමගින් හමුවෙමු.සුභ දවසක්!</p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2018/04/23/graphical-user-interface-1_step/">Graphical User Interface &#8211; පළමු පියවර</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://danushka96.github.io/sigma/index.php/2018/04/23/graphical-user-interface-1_step/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
	</channel>
</rss>
