62,621
社区成员
发帖
与我相关
我的任务
分享 import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class slfkjdsdfsaf
{
public static class T1120230035 extends JFrame implements ActionListener
{
private static final long serialVersionUID = 1L;
private static JTextField T1;
private static JTextField T2;
private JTextField T3;
private JButton B2;
public T1120230035()
{
super("小程序查看器");
T1= new JTextField(5);
T2= new JTextField(5);
B2= new JButton("min");
T3= new JTextField(5);
setLayout(new FlowLayout());
add(T1);
add(T2);
add(B2);
add(T3);
B2.addActionListener(this);
T1.addActionListener(this);
T2.addActionListener(this);
T3.addActionListener(this);
setSize(400,400);
setVisible(true);
}
public int commb(int a,int b)
{
int c=a;
int T1120230035e = 0;
if(c<b)
c=b;
for(;c<=a*b;c++)
{
if(a%c==0&&b%c==0)
{
T1120230035e=c;
break;
}
}
return T1120230035e;
}
public void actionPerformed(ActionEvent e){
String u1=T1.getText();
int i =Integer.parseInt(u1);
String u2=T2.getText();
int j =Integer.parseInt(u2);
int s;
s=commb(i,j);
String s2=Integer.toString(s);
T3.setText(s2);
}
public static void main(String[] args) {
T1120230035 cc=new T1120230035();
}
}}
public int commb(int a,int b)
{
int c=a;
int T1120230035e = 0;
if(c<b)
c=b;
for(;c<=a*b;c++)
{
if(a%c==0&&b%c==0)
{
T1120230035e=c;
break;
}
}
return T1120230035e;
}if (c % a == 0 && c % b == 0) {