Results 1 to 2 of 2
  1. #1
    C.I.A.
    Join Date
    Apr 2009
    Gender
    Female
    Posts
    8,812
    Blog Entries
    39

    Default Is it my compiler? Or the program really have 100errors? >.<


    Code:
    import javax.swing.*;import java.awt.*;
    import java.awt.event.*;
    
    
    public class GUISwingDemo extends JFrame implements ActionListener{
    
    
    	JPanel panel[] = new JPanel[3];
    	JLabel label[] = new JLabel[3];
    	JTextField tf[] = new JTextField[3];
    	JButton btnAdd = new JButton("ADD");
    	String lblCap[] = {"First Number","Second Number","Sum"};
    	int x;
    
    
    	public GUISwingDemo(){
    		setTitle("SwingDemo");
    		for(x=0;x<panel.length;x++)
    			panel[x] = new JPanel();
    		panel[0].setLayout(new GridLayout(3,2));
    		for(x=0;x<label.length;x++){
    			panel[0].add(label[x] = new JLabel(lblCap[x]));
    			panel[0].add(tf[x] = new JTextField(10));
    			label[x].setForeground(Color.RED);
    			label[x].setFont(new Font("Arial",3,20));
    			tf[x].setFont(new Font("Arial",3,20));
    			tf[x].setForeground(Color.BLUE);
    		}
    		
    		btnAdd.addActionListener(this);
    		panel[1].add(btnAdd);
    		panel[2].setLayout(new BorderLayout());
    		panel[2].add(panel[0],BorderLayout.NORTH);
    		panel[2].add(panel[1],BorderLayout.SOUTH);
    		getContentPane().add(panel[2]);
    		setVisible(true);
    		pack();
    
    
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	}
    
    
    	public void actionPerformed(ActionEvent ae){
    		if(ae.getSource().equals(btnAdd)){
    			int n1 = Integer.parseInt(tf[0].getText());
    			int n2 = Integer.parseInt(tf[1].getText());
    			int sum = n1+n2;
    			tf[2].setText(String.valueOf(sum));
    		}
    	}
    
    
    	public static void main(String[] args){
    		new GUISwingDemo();
    	}
    }
    This code worked at school man. But it turned out to have 100errors after compiling.
    Pwede pa check if mu run sa inyu compiler?

    PS: oooooooops. edit edit edit. found the errors na >.< sorrrrrry
    Last edited by kurdapia.nikki; 03-19-2012 at 11:23 PM.

  2. #2
    Elite Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    1,018

    Default Re: Is it my compiler? Or the program really have 100errors? >.<

    Si humana ni?

  3.    Advertisement

Similar Threads

 
  1. HELP!!! is it my internet or my pc or the game!?!
    By poloi123 in forum Networking & Internet
    Replies: 3
    Last Post: 10-24-2012, 05:00 PM
  2. is it my pc or just the QUOTE BUTTON disappear?
    By j.alob in forum Support Center
    Replies: 6
    Last Post: 05-27-2011, 11:01 PM
  3. is it my PS3 or my PS3 disk? HELP!!
    By Dthronian in forum Software & Games (Old)
    Replies: 0
    Last Post: 08-02-2010, 06:03 PM
  4. HELP Is it my fault or my ex-GF's?
    By drezzel86 in forum "Love is..."
    Replies: 51
    Last Post: 09-21-2009, 07:16 PM
  5. HELP Is it my fate to suffer in the world?
    By whitelaceF in forum "Love is..."
    Replies: 31
    Last Post: 01-31-2009, 05:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top