help me please i cant take it anymore please

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2008
Posts: 1
Reputation: silvermixmark is an unknown quantity at this point 
Solved Threads: 0
silvermixmark silvermixmark is offline Offline
Newbie Poster

help me please i cant take it anymore please

 
0
  #1
Mar 12th, 2008
//my problem is that i dont know how will i start, i have the idea but i cant apply it.,.,. can you help me to put the cation listener??
this is a case study i am a i.t student in the philippines. and my project is a student grades.. the output is to get the name and grde from test one up to test three then it will show the average of the 3 test in the text area please help me out,..,.,..,., please help me
thankyou|!! ='c //







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

public class Login extends JFrame{
private JLabel myTestLabel1, myTestLabel2, myTestLabel3, myStudentNameLabel, myLabel4,AverageTextFieldLabel;
private JButton myButton;
private JRadioButton myRadioButton1, myRadioButton2, myRadioButton3;
private JTextField myTest1, myTest2, myTest3, myStudentName, AverageTextField;
private JTextArea myStudentTextArea;

public Login()
{
super("StudentGrades");
Container container= getContentPane();
container.setLayout(new FlowLayout());


myStudentNameLabel= new JLabel("Student Name:");
myStudentNameLabel.setBounds( 16, 16, 208, 218 );

container.add(myStudentNameLabel);


myStudentName= new JTextField(10);
myStudentName.setBounds( 16, 16, 208, 218 );
container.add(myStudentName);




//test1//
myTestLabel1= new JLabel("Test 1");
myTestLabel1.setBounds( 16, 16, 208, 218 );
container.add(myTestLabel1);


myTest1= new JTextField(10);
myTest1.setBounds( 16, 16, 208, 218 );
container.add(myTest1);

//test2//
myTestLabel2= new JLabel("Test 2");
myTestLabel2.setBounds( 16, 16, 208, 218 );
container.add(myTestLabel2);

myTest2= new JTextField(10);
myTest2.setBounds( 16, 16, 208, 218 );
container.add(myTest2);

//test3//
myTestLabel3= new JLabel("Test 3");
myTestLabel3.setBounds( 16, 67, 208, 218 );
container.add(myTestLabel3);
myTest3= new JTextField(10);
myTest3.setBounds( 16, 76, 208, 218 );
container.add(myTest3);


myButton= new JButton ("Submit Grades");//inserting button
myButton.setBounds( 16, 45, 208, 218 );
container.add(myButton);





//lalam radio button//
myRadioButton1= new JRadioButton("Letter");
container.add(myRadioButton1);

myRadioButton2= new JRadioButton("Numeric");
container.add(myRadioButton2);


myLabel4= new JLabel( "TextArea");
container.add(myLabel4);

myStudentTextArea= new JTextArea("Two");
container.add(myStudentTextArea);
setSize(2341, 1233);
setVisible(true);


AverageTextFieldLabel= new JLabel("Average");
AverageTextFieldLabel.setBounds( 16, 16, 208, 218 );
container.add(AverageTextFieldLabel);


myTest1= new JTextField(10);

container.add(AverageTextField);






















}

private class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent event)
{







}
}





public static void main(String[]args)
{
Login application = new Login();
application.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE);
}
}
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 794
Reputation: darkagn has a spectacular aura about darkagn has a spectacular aura about darkagn has a spectacular aura about 
Solved Threads: 110
darkagn's Avatar
darkagn darkagn is offline Offline
Master Poster

Re: help me please i cant take it anymore please

 
0
  #2
Mar 12th, 2008
Ok, so in your actionPerformed method, you put whatever code you need to do what you want when the button is pressed. Then you add the action listener to the button by writing the following:
  1. myButton= new JButton ("Submit Grades");//inserting button
  2. myButton.setBounds( 16, 45, 208, 218 );
  3. myButton.addActionListener( new ButtonHandler() );
  4. container.add(myButton);
That's all there is to it really...
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC