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
Handmade Character Soft Toy Peter Rabbit
anil1961
Updated:
Yesterday at 6:30 PM
FOZ Character Plush Toy |
anil1961
Updated:
Monday at 12:31 PM
Ad icon
Colombo
🎓✨ A Better Plan Can Make a Big Difference!
Tmadhusanka
Updated:
Sunday at 5:03 PM
Microsoft Project 2021 & All Versions Available!
hrdilshan
Updated:
Sunday at 2:43 PM
Microsoft Visio 2021 & All Versions Available!
hrdilshan
Updated:
Sunday at 2:42 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Java Help
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="kasuwa1235" data-source="post: 18887935" data-attributes="member: 65783"><p>Button Click demo ekak haduwa . button eka click karama 0,1,2,3 kiyala count wenna but eka wada karanne na mokakda me codins eke aula</p><p></p><p>man file eka save kala ActionListener.java kiyalai </p><p></p><p></p><p>import javax.swing.*; </p><p>import java.awt.event.*;</p><p>public class Main implements ActionListener{</p><p> </p><p> private static void createAndShowGUI() {</p><p> </p><p> JFrame frame = new JFrame("I am a JFrame");</p><p> frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);</p><p> frame.setBounds(20,30,30,30);</p><p> frame.add(butt);</p><p> butt.setBounds(20, 20, 200,200,100);</p><p> frame.getContentPane().setLayout(null); </p><p> </p><p> JButton butt=new JButton("Click me");</p><p> frame.getContentPane();</p><p> </p><p> Main app = new Main();</p><p> </p><p> app.label = new JLabel("0 clicks");</p><p> app.label.setBounds(20,40, 200,20);</p><p> frame.getContentPane().add(app.label);</p><p> </p><p> butt.addActionListener(app);</p><p> frame.setVisible(true); </p><p> }</p><p> </p><p>public void actionPerformed(ActionEvent e)</p><p>{</p><p> clickCount++;</p><p> label.setText("Clicks = "+clickCount);</p><p>}</p><p> public static void main(String[] args) {</p><p> SwingUtilities.invokeLater(new Runnable() {</p><p> public void run() {</p><p> createAndShowGUI();</p><p> }</p><p> });</p><p> }</p><p> </p><p>int clickCount=0; </p><p>JLabel label;</p><p>}</p><p></p><p></p><p></p><p></p><p></p><p></p><p> </p><p></p><p>Ena Error ekath Attchment eke add karala ati Help me <img src="/styles/default/xenforo/smilies/default/sad.gif" class="smilie" loading="lazy" alt=":(" title="Sad :(" data-shortname=":(" /></p></blockquote><p></p>
[QUOTE="kasuwa1235, post: 18887935, member: 65783"] Button Click demo ekak haduwa . button eka click karama 0,1,2,3 kiyala count wenna but eka wada karanne na mokakda me codins eke aula man file eka save kala ActionListener.java kiyalai import javax.swing.*; import java.awt.event.*; public class Main implements ActionListener{ private static void createAndShowGUI() { JFrame frame = new JFrame("I am a JFrame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20,30,30,30); frame.add(butt); butt.setBounds(20, 20, 200,200,100); frame.getContentPane().setLayout(null); JButton butt=new JButton("Click me"); frame.getContentPane(); Main app = new Main(); app.label = new JLabel("0 clicks"); app.label.setBounds(20,40, 200,20); frame.getContentPane().add(app.label); butt.addActionListener(app); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { clickCount++; label.setText("Clicks = "+clickCount); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } int clickCount=0; JLabel label; } Ena Error ekath Attchment eke add karala ati Help me :( [/QUOTE]
Insert quotes…
Verification
Haya warak paha keeyada? (haya wadi kireema paha)
Post reply
Top
Bottom