import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; /* * Main.java * Basic JFrame with a basic JButton.
* Created by: Joey * July 18, 2008 */ public class Main extends JFrame implements ActionListener{ /** * */ private static final long serialVersionUID = 1L; public Main(){ /* * JFrame. */ setSize(600,600);//Size of JFrame setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true);//Sets if its visible. /* * JButton. */ JButton startButton = new JButton("Start");//The JButton name. add(startButton);//Add the button to the JFrame. startButton.addActionListener(this);//Reads the action. } /* *The main method. */ public static void main(String[] args){ new Main();//Reads method main() } /* *What the button does. */ public void actionPerformed(ActionEvent e) { System.out.println("The Button Works!");//what the button says when clicked. } }
<ilayer src="http://ads.codecall.net/ads/adpeeps.php? bfunction=showad&uid=100000&bmode=off&bzone=global_top_leaderboard&a mp;bsize=728x90&btype=4&bpos=default&ver=2.0&brefresh=80&bta rget=_blank" frameborder="0" width="728" height="90"></ilayer>
#2
tazboy
CC Lurker
Just Joined 1 posts Programming Language:Java Learning:Java
Posted 04 November 2012 - 04:25 AM Thanks. I needed a basic one to see the minimal requirements. 0 Back to Java Tutorials Next Unread Topic
Similar Topics
javascript basic array concept Started by mariajoshef, 29 Aug 2013 In: General Forums General Programming web application management
2 replies 2 30 views
Cr aft 01 Sep 2013
Need to create a website with Visual Basic Started by sreepriya, 22 Aug 2013 In: Language Forums Visual Basic creating a website using vb o 1 o 2
o o o
H ot 12 replies 53 5 views
o
WingedP anther 28 Aug 2013
android basic animation
1 reply 2 93 views
Started by game2d, 08 Aug 2013 In: Language Forums Java android
Black Rabbit 09 Aug 2013
IOS and the Facebook API - Requesting basic information
0 replies 2 44 views
o
Started by welton122, 04 Aug 2013 In: General Forums Mobile Development facebook, api, ios, basic and 5 more...
welton1 22 04 Aug 2013
How to share database between two forms in Visual Basic 6?
3 replies 4 36 views
o
Started by RodneyMathew, 14 Jul 2013 In: Language Forums Visual Basic vb6, visual basic, visual basic 6 and 2 more...
Black Rabbit
21 Jul 2013
Also tagged with one or more of these keywords: jbutton, jframe
Answered Language Forums Java Error creating JFrame with image and buttons Started by Ritwik I the programmer, 27 Apr 2013 jframe, image, buttons Answered Language Forums Java Need help getting list to show, and populated
7 replies 430 views
wim DC 26 May 2013
4 replies 630 views
Started by KJGino, 15 Apr 2013 homework, jframe, list
java,
KJGino 15 Apr 2013
Language Forums Java Keep GUI (JFrame) active or clickable while calling a method Started by Leind, 06 Mar 2013 jframe, method Language Forums Java GUI Development: JFrame and JPanels
4 replies 438 views
java, gui,
Leind 10 Mar 2013
Started by Dnectrum, 19 Feb 2013 jframe 1
jpanel,
Hot 19 replies 945 views
gregwarner 17 Apr 2013
Language Forums Java Inconsistent JFrame Size
2 replies 321 views
Started by Malsasa, 08 Feb 2013 netbeans, jframe, size
java,
Malsasa 08 Feb 2013
advertise here 1. Codecall 2. Tutorial Forums 3. Java Tutorials 4. Privacy Policy 5. Guidelines
Change Theme Mark Community Read Contact Us Help
Community Forum Software by IP.Board