Home arrow static arrow Java Programming [Archive] - 1 compiling error
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - 1 compiling error
This topic has 1 reply on 1 page.

Posts:22
Registered: 7/28/04
1 compiling error  
Jul 30, 2004 5:48 AM



 

Hi guys, somebody know whay I get the error "F:\NUEVO\ALLIO\TemperatureSimulationTanteando2.java:7: TemperatureSimulationTanteando2 is not abstract and does not override abstract method itemStateChanged(java.awt.event.ItemEvent) in java.awt.event.ItemListener" when compiling the following interface??

Thanks.

Peter

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class TemperatureSimulationTanteando2 extends JFrame implements ItemListener{

private JTextField textField0 ,textField1, textField2, textField3, textField4, textField5, textField6, textField7, textField8, textField9, textField10, textField11, textField12, textField13, textField14, textField15;
private JLabel label1, label2;
private String domains[] = { "Domain 1", "Domain 2", "Domain 3"};
private JButton setButton, runButton, quitButton;

private JCheckBox userDefined1, userDefined2, userDefined3, userDefined4;

int i;

// set up GUI
public TemperatureSimulationTanteando2() // esto es como si fuera la "public ButtonTest()"
// lo de arriba tiene q tener el mismo nombre q el programa .java
{
//JFrame frame = new JFrame("Chip Temperature Simulation");
super( "Chip Temperature Simulation " );
//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


// create JTabbedPane
JTabbedPane tabbedPane = new JTabbedPane();

Container contentPane = getContentPane();
contentPane.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridwidth = gbc.REMAINDER;
gbc.insets = new Insets(5, 5 ,5 ,5);

//JLabel label1 = new JLabel( "panel one", SwingConstants.CENTER );
JPanel panel1 = new JPanel();
//panel1.setLayout(new GridLayout(20,1));

JLabel label1 = new JLabel( "How many domains would you like to create?" );
panel1.add( label1);

textField0 = new JTextField(10);
panel1.add( textField0, BorderLayout.WEST );
label1.setVerticalAlignment(SwingConstants.CENTER );

setButton = new JButton( "Set it up" );
panel1.add(setButton);

//////////////////////
tabbedPane.addTab( "No of domains", null, panel1, "First Panel" );

// set up panel2 and add it to JTabbedPane
JLabel label2 = new JLabel( "panel two", SwingConstants.CENTER );
JPanel panel2 = new JPanel();

//panel2.setLayout(new GridLayout(14,1));
panel2.setLayout(new GridLayout(18,1));
//i = domains;
JLabel label9 = new JLabel( "DOMAIN " + i, SwingConstants.RIGHT );
panel2.add( label9);
label9.setVerticalAlignment(SwingConstants.CENTER );
//label9.setBorder(BorderFactory.createLineBorder(Color.yellow));

////////////////////////////////////////////////////////////////////////
//private String domains[] = { "Domain 1", "Domain 2", "Domain 3"};
JComboBox jajaComboBox = new JComboBox(domains);
panel2.add(jajaComboBox);
//imagesComboBox.setMaximumRowCount(3);

////////////////////////////////////////////////////////////////////////
/*
JLabel label10 = new JLabel( "", SwingConstants.LEFT );
panel2.add( label10);
label10.setVerticalAlignment(SwingConstants.CENTER );
*/

JLabel label11 = new JLabel( " The x-coordinate of lowest vertex on the left is: ", SwingConstants.LEFT );
panel2.add( label11);
textField1 = new JTextField(10);
panel2.add( textField1, BorderLayout.WEST );
label11.setVerticalAlignment(SwingConstants.CENTER );
//panel2.add( new JLabel ("The x-coordinate of lowest vertex on the left is:", SwingConstants.LEFT));

JLabel label12 = new JLabel( " The y-coordinate of lowest vertex on the left is: ", SwingConstants.LEFT );
panel2.add( label12);
textField2 = new JTextField(10);
panel2.add( textField2, BorderLayout.WEST );
label12.setVerticalAlignment(SwingConstants.CENTER );

JLabel label13 = new JLabel( " The x-coordinate of uppest vertex on the right is: ", SwingConstants.LEFT );
panel2.add( label13);
textField3 = new JTextField(10);
panel2.add( textField3, BorderLayout.WEST );
label13.setVerticalAlignment(SwingConstants.CENTER );

//label13.setBorder(BorderFactory.createLineBorder(Color.green));

JLabel label14 = new JLabel( " The y-coordinate of uppest vertex on the left is: ", SwingConstants.LEFT );
panel2.add( label14);
textField4 = new JTextField(10);
panel2.add( textField4, BorderLayout.WEST );
label14.setVerticalAlignment(SwingConstants.CENTER );

JLabel label15 = new JLabel( " The number of intervals in the x-direction is: ", SwingConstants.LEFT );
panel2.add( label15);
textField5 = new JTextField(10);
panel2.add( textField5, BorderLayout.WEST );
label15.setVerticalAlignment(SwingConstants.CENTER );

JLabel label16 = new JLabel( " The number of intervals in the y-direction is: ", SwingConstants.LEFT );
panel2.add( label16);
textField6 = new JTextField(10);
panel2.add( textField6, BorderLayout.WEST );
label16.setVerticalAlignment(SwingConstants.CENTER );

JLabel label17 = new JLabel( " Newton method accuracy is: ", SwingConstants.LEFT );
panel2.add( label17);
textField7 = new JTextField(10);
panel2.add( textField7, BorderLayout.WEST );
label17.setVerticalAlignment(SwingConstants.CENTER );

JLabel label18 = new JLabel( " Gauss Seidel method accuracy is: ", SwingConstants.LEFT );
panel2.add( label18);
textField8 = new JTextField(10);
panel2.add( textField8, BorderLayout.WEST );
label18.setVerticalAlignment(SwingConstants.CENTER );

JLabel label19 = new JLabel( " Physical time maximum (end_t) is: ", SwingConstants.LEFT );
panel2.add( label19);
textField9 = new JTextField(10);
panel2.add( textField9, BorderLayout.WEST );
label19.setVerticalAlignment(SwingConstants.CENTER );

JLabel label20 = new JLabel( " Number of time-steps (steps=end_t/dt) is: ", SwingConstants.LEFT );
panel2.add( label20);
textField10 = new JTextField(10);
panel2.add( textField10, BorderLayout.WEST );
label20.setVerticalAlignment(SwingConstants.CENTER );

JLabel label21 = new JLabel( " Material property. Enter 1 or 2: ", SwingConstants.LEFT );
panel2.add( label21);
textField11 = new JTextField(10);
panel2.add( textField11, BorderLayout.WEST );
label21.setVerticalAlignment(SwingConstants.CENTER );

userDefined1 = new JCheckBox("User Def1", false);
panel2.add(userDefined1);
userDefined1.addItemListener(this);

JLabel label22 = new JLabel( " Left side is 'Boundary condition Newmann or Dirichlet, or interface' ", SwingConstants.LEFT );
panel2.add( label22);
textField12 = new JTextField(10);
panel2.add( textField12, BorderLayout.WEST );
label22.setVerticalAlignment(SwingConstants.CENTER );

userDefined2 = new JCheckBox("User Def2", false);
panel2.add(userDefined2);
userDefined2.addItemListener(this);

JLabel label23 = new JLabel( " Top side is 'Boundary condition Newmann or Dirichlet, or interface' ", SwingConstants.LEFT );
panel2.add( label23);
textField13 = new JTextField(10);
panel2.add( textField13, BorderLayout.WEST );
label23.setVerticalAlignment(SwingConstants.CENTER );

userDefined3 = new JCheckBox("User Def3", false);
panel2.add(userDefined3);
userDefined3.addItemListener(this);

JLabel label24 = new JLabel( " Right side is 'Boundary condition Newmann or Dirichlet, or interface' ", SwingConstants.LEFT );
panel2.add( label24);
textField14 = new JTextField(10);
panel2.add( textField14, BorderLayout.WEST );
label24.setVerticalAlignment(SwingConstants.CENTER );

userDefined4 = new JCheckBox("User Def4", false);
panel2.add(userDefined4);
userDefined4.addItemListener(this);

JLabel label25 = new JLabel( " Bottom side is 'Boundary condition Newmann or Dirichlet, or interface' ", SwingConstants.LEFT );
panel2.add( label25);
textField15 = new JTextField(10);
panel2.add( textField15, BorderLayout.WEST );
label25.setVerticalAlignment(SwingConstants.CENTER );


//setLayout(new FlowLayout(FlowLayout.RIGHT));
panel2.add( new JButton( "Save data" ), BorderLayout.EAST );
panel2.add( new JButton( "Next domain >>" ), BorderLayout.EAST );


tabbedPane.addTab( "Enter data", null, panel2, "Second Panel" );

JPanel panel3 = new JPanel();
//panel3.setLayout( new BorderLayout() );
runButton = new JButton("RUN the simulation");
panel3.add(runButton);
//panel3.add( new JButton( "RUN the simulation" ));
quitButton = new JButton("Quit");
panel3.add(quitButton);

tabbedPane.addTab( "Run", null, panel3, "Third Panel" );

// add JTabbedPane to container
getContentPane().add( tabbedPane );

setSize( 900, 700 );
setVisible( true );

} // end constructor

public static void main( String args[] )
{
TemperatureSimulationTanteando2 tabbedPaneDemo = new TemperatureSimulationTanteando2();
tabbedPaneDemo.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}

}

 

Posts:1,044
Registered: 4/16/04
Re: 1 compiling error  
Jul 30, 2004 5:52 AM (reply 1 of 1)



 
public class TemperatureSimulationTanteando2 extends JFrame implements ItemListener{

If you implement an Interface you must override the method(s) specified by the interface or declare your class abstratct

ICE
 
This topic has 1 reply on 1 page.