| | |
help me please i cant take it anymore please
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2008
Posts: 1
Reputation:
Solved Threads: 0
//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);
}
}
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);
}
}
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:
That's all there is to it really...
java Syntax (Toggle Plain Text)
myButton= new JButton ("Submit Grades");//inserting button myButton.setBounds( 16, 45, 208, 218 ); myButton.addActionListener( new ButtonHandler() ); container.add(myButton);
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend. ![]() |
Similar Threads
- IE doesn't start anymore (Web Browsers)
- No Colors Anymore? (DaniWeb Community Feedback)
- Can't get into setup utility anymore. (Windows NT / 2000 / XP)
- C drive won't recognize D drive anymore..Help! (Troubleshooting Dead Machines)
- dvd burner will not write anymore (Storage)
- IE6 not reacting anymore after typing URL. (Web Browsers)
- IE Will Not Open Anymore (Viruses, Spyware and other Nasties)
- Can't connect to printer anymore, but ping is ok (Windows NT / 2000 / XP)
- IE won't open on its own anymore (OS X)
- bridge.dll-do i have a problem anymore? (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: struts tutorials
- Next Thread: Dear Friends
| Thread Tools | Search this Thread |
3d 6 @param affinetransform android api applet application arc array arrays automation binary bluetooth bold byte c++ chat class client code color compare component coordinates database detection doctype eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework html ide ideas image ingres input integer internet intersect j2me java java.xls javaexcel javaprojects jni jpanel jtextarea julia keytool keyword linux list loop map method methods mobile netbeans newbie nextline pong print problem producer program programming project projectideas read recursion recursive replaysolutions rim scanner screen sell server set size sms sort sql string swing terminal threads tree web websites windows





