Question:
why i cant compile this java program although there is no error. 10 points if you can help me?
2006-07-28 18:09:42 UTC
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/** Demo of the JTablePane component. **/
public class TabbedApplet extends JApplet
{
public void init () {
Container content_pane = getContentPane ();

// Create an instance of our Tabs class.
Tabs tabs = new Tabs (this);

// And add it to the applet's panel.
content_pane.add (tabs);
} // init

} // class TabbedApplet


/** This JTabbedPane subclass holds three panes, each
* with one button.
**/
class Tabs extends JTabbedPane
implements ActionListener {
JApplet fApplet;

/** Put a button on each of three pages. **/
Tabs (JApplet applet) {
fApplet = applet;
add (makeButton ("1"), "One" );
add (makeButton ("2"), "Two" );
add (makeButton ("3"), "Three" );
} // ctor
/** Make a button here and add this object
* to its action listeners list.
**/
JButton makeButton ( String name) {
JButton b = new JButton ( name );
b.addActionListener ( this );
Three answers:
GreaseMonkeySteve
2006-07-30 07:36:15 UTC
You can probably compile it without errors because you are just declaring a couple classes. In order to run any Java application, you need to have a main method (which is why you are getting an error). You need to have at lease a main method in this file or create another Java file with a main method that creates objects using the classes in this file to use them.
SmartSpider
2006-07-28 19:14:43 UTC
I just compiled the program and it compiled without an error... what error are you getting?
xX_fEaR_thE_rEaPeR_Xx
2006-07-28 18:17:11 UTC
idk 10 points plz!!! can u answer my question it loooks like u know flash and java answer my question


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...