Home > Back-end >  A Java bosses ask this question: to design a form the user interface. The interface includes three l
A Java bosses ask this question: to design a form the user interface. The interface includes three l

Time:09-18

1. Design a form the user interface, the interface includes three labels, three text boxes and a button, three standard
Sign are respectively [math] [English] [out] button titled [for peace] requirements in the text box input mathematics,
English scores, click the button for peace in the text box shows the total score, after
Thank thank genuflect is begged genuflect is begged

CodePudding user response:

And what type of user interface

CodePudding user response:

reference 1/f, "the other shore flower reply:
what call stranded type user interface

The graphical user,,,, I type wrong,,,,,,,

CodePudding user response:



<script>
The function sum () {
Var sx=document. GetElementById (' sx). The value;//for math score
Var yy=document. GetElementById (" yy "). The value;//to get correct English score
Document. The getElementById (' sum ') value=https://bbs.csdn.net/topics/parseInt (sx) + parseInt (yy);//will be math and English combined assign values to the total score
}
</script>

CodePudding user response:

The
reference "the other shore flower reply: 3/f
& lt; Div>

<script>
The function sum () {
Var sx=document. GetElementById (' sx). The value;//for math score
Var yy=document. GetElementById (" yy "). The value;//to get correct English score
Document. The getElementById (' sum ') value=https://bbs.csdn.net/topics/parseInt (sx) + parseInt (yy);//will be math and English combined assign values to the total score
}
</script>

Is this this is the Java language,,,,,,, I am a little white,,, I don't know much about

CodePudding user response:

 
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
The import javax.mail. Swing. JTextField;

Public class SummationForm extends JFrame implements ActionListener {

Private static final long serialVersionUID=- 3059616600875760053 l;

JLabel labMathematics, labEnglish labTotal;
JTextField textMathematics, textEnglish textTotal;
The static JButton butSummation;

Public SummationForm () {

LabMathematics=new JLabel (" maths scores ");
LabEnglish=new JLabel (" English scores ");
LabTotal=new JLabel (" total ");
TextMathematics=new JTextField (" ", 10);
TextEnglish=new JTextField (" ", 10);
TextTotal=new JTextField (" ", 10);
ButSummation=new JButton (" sum ");

LabMathematics. SetBounds (30, 30, 120, 30);
TextMathematics. SetBounds (180, 30, 120, 30);
LabEnglish. SetBounds (30, 80, 120, 30);
TextEnglish. SetBounds (180, 80, 120, 30);
LabTotal. SetBounds (30, 130, 120, 30);
TextTotal. SetBounds (180, 130, 120, 30);
ButSummation. SetBounds (160, 180, 80, 30);

Add (labMathematics);
Add (textMathematics);
Add (labEnglish);
Add (textEnglish);
Add (labTotal);
Add (textTotal);
Add (butSummation);

SetLayout (null);
SetBounds (200, 100, 400, 300);
//window in the middle of the screen shows the
setLocationRelativeTo(null);
SetTitle (" sum ");
SetResizable (false);
setVisible(true);
}

Public static void main (String [] args) {
SummationForm SummationForm=new SummationForm ();

ButSummation. AddActionListener (summationForm);
SummationForm. Add (butSummation);
}

Public void actionPerformed (an ActionEvent e) {
JButton jb=(JButton) um participant etSource ();
If (jb==butSummation) {
String Mathematics=textMathematics. GetText ();
String English=textEnglish. GetText ();
Try {
Int a=Integer. ParseInt (Mathematics);
Int b=Integer. ParseInt (English);
Int t=a + b;
TextTotal. SetText (String. The valueOf (t));
{} catch Exception (e2)
JOptionPane. ShowMessageDialog (this, "input scores format error!" , "prompt dialog", JOptionPane DEFAULT_OPTION);
}
}
}
}


  • Related