JAVA语言程序设计题目,求高人解答

JAVA语言程序设计题目,求高人解答,第1张

import javaawtFlowLayout;

import javaawteventActionEvent;

import javaawteventActionListener;

import javaxswingJButton;

import javaxswingJFrame;

import javaxswingJLabel;

import javaxswingJTextField;

public class A implements ActionListener {

JFrame jf;

JLabel jl1;

JLabel jl2;

JLabel jl3;

JButton jb1;

JTextField jtf1;

JTextField jtf2;

JTextField jtf3;

public A(){

init();

showMe();

}

public void init(){

jf=new JFrame("拆分小数点");

jfsetLayout(new FlowLayout());

jl1=new JLabel("请输入小数");

jl2=new JLabel("整数为");

jl3=new JLabel("小数为");

jb1=new JButton("拆分");

jb1addActionListener(this);

jtf1=new JTextField(10);

jtf2=new JTextField(10);

jtf2setEditable(false);

jtf3=new JTextField(10);

jtf3setEditable(false);

jfadd(jl1);

jfadd(jtf1);

jfadd(jl2);

jfadd(jtf2);

jfadd(jl3);

jfadd(jtf3);

jfadd(jb1);

}

public void showMe(){

jfsetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);

jfsetVisible(true);

jfsetLocation(300, 300);

jfpack();

}

@Override

public void actionPerformed(ActionEvent e) {

String comm=egetActionCommand();

if("拆分"equals(comm)){

String s=jtf1getText();

Systemoutprintln(s);

if(scontains("")){

String[] ss=ssplit("\\");

for (int i = 0; i < sslength; i++) {

Systemoutprintln(ss[i]);

}

jtf2setText(ss[0]);

jtf3setText(ss[1]);

}

}

}

public static void main(String[] args) {

new A();

}

}

import javaawtFlowLayout;

import javaawtGridLayout;

import javaawteventActionEvent;

import javaawteventActionListener;

import javautilArrays;

import javaxswingJButton;

import javaxswingJFrame;

import javaxswingJLabel;

import javaxswingJPanel;

import javaxswingJTextField;

public class B implements ActionListener {

public JFrame jf;

private JLabel jl1,jl2,jl3,jl4,jl5,jl6,jl7,jl8,jl9,jl10,jl11,jl12;

private JTextField jtf1,jtf2,jtf3,jtf4,jtf5,jtf6,jtf7,jtf8,jtf9,jtf10,jtf11,jtf12;

private JPanel jp1,jp2,jp3,jp4,jp5,jp6,jp7,jp8,jp9,jp10,jp11,jp12,jp13;

private JButton jb;

public B(){

init();

showMe();

}

public void showMe(){

jfsetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);

jfsetVisible(true);

jfsetLocation(300, 300);

jfpack();

}

public void init(){

jl1=new JLabel("输入第1个数字");

jl2=new JLabel("输入第2个数字");

jl3=new JLabel("输入第3个数字");

jl4=new JLabel("输入第4个数字");

jl5=new JLabel("输入第5个数字");

jl6=new JLabel("输入第6个数字");

jl7=new JLabel("输入第7个数字");

jl8=new JLabel("输入第8个数字");

jl9=new JLabel("输入第9个数字");

jl10=new JLabel("输入第10个数字");

jl11=new JLabel("最大值为");

jl12=new JLabel("最小值为");

jl11setEnabled(false);

jl12setEnabled(false);

jtf1=new JTextField(10);

jtf2=new JTextField(10);

jtf3=new JTextField(10);

jtf4=new JTextField(10);

jtf5=new JTextField(10);

jtf6=new JTextField(10);

jtf7=new JTextField(10);

jtf8=new JTextField(10);

jtf9=new JTextField(10);

jtf10=new JTextField(10);

jtf11=new JTextField(10);

jtf11setEditable(false);

jtf12=new JTextField(10);

jtf12setEditable(false);

jp1=new JPanel();

jp2=new JPanel();

jp3=new JPanel();

jp4=new JPanel();

jp5=new JPanel();

jp6=new JPanel();

jp7=new JPanel();

jp8=new JPanel();

jp9=new JPanel();

jp10=new JPanel();

jp11=new JPanel();

jp12=new JPanel();

jp13=new JPanel();

jb=new JButton("确定");

jbaddActionListener(this);

jp1setLayout(new FlowLayout());

jp1add(jl1);

jp1add(jtf1);

jp2setLayout(new FlowLayout());

jp2add(jl2);

jp2add(jtf2);

jp3setLayout(new FlowLayout());

jp3add(jl3);

jp3add(jtf3);

jp4setLayout(new FlowLayout());

jp4add(jl4);

jp4add(jtf4);

jp5setLayout(new FlowLayout());

jp5add(jl5);

jp5add(jtf5);

jp6setLayout(new FlowLayout());

jp6add(jl6);

jp6add(jtf6);

jp7setLayout(new FlowLayout());

jp7add(jl7);

jp7add(jtf7);

jp8setLayout(new FlowLayout());

jp8add(jl8);

jp8add(jtf8);

jp9setLayout(new FlowLayout());

jp9add(jl9);

jp9add(jtf9);

jp10setLayout(new FlowLayout());

jp10add(jl10);

jp10add(jtf10);

jp11setLayout(new FlowLayout());

jp11add(jl11);

jp11add(jtf11);

jp12setLayout(new FlowLayout());

jp12add(jl12);

jp12add(jtf12);

jf=new JFrame("最大值最小值");

jfsetLayout(new GridLayout(13, 1));

jfadd(jp1);

jfadd(jp2);

jfadd(jp3);

jfadd(jp4);

jfadd(jp5);

jfadd(jp6);

jfadd(jp7);

jfadd(jp8);

jfadd(jp9);

jfadd(jp10);

jfadd(jp11);

jfadd(jp12);

jfadd(jb);

}

@Override

public void actionPerformed(ActionEvent e) {

String comm=egetActionCommand();

if("确定"equals(comm)){

int i1=IntegerparseInt(jtf1getText());

int i2=IntegerparseInt(jtf2getText());

int i3=IntegerparseInt(jtf3getText());

int i4=IntegerparseInt(jtf4getText());

int i5=IntegerparseInt(jtf5getText());

int i6=IntegerparseInt(jtf6getText());

int i7=IntegerparseInt(jtf7getText());

int i8=IntegerparseInt(jtf8getText());

int i9=IntegerparseInt(jtf9getText());

int i10=IntegerparseInt(jtf10getText());

int arr[]={i1,i2,i3,i4,i5,i6,i7,i8,i9,i10};

Arrayssort(arr);

int max=arr[9];

int min=arr[0];

jtf11setText(max+"");

jtf12setText(min+"");

}

}

public static void main(String[] args) {

new B();

}

}

import javaawtFlowLayout;

import javaawteventActionEvent;

import javaawteventActionListener;

import javautilArrays;

import javaxswingJButton;

import javaxswingJFrame;

import javaxswingJLabel;

import javaxswingJTextField;

public class C implements ActionListener {

private JFrame jf;

private JLabel jl1,jl2;

private JTextField jtf1,jtf2;

JButton jb1;

public C(){

init();

showMe();

}

public void init(){

jf=new JFrame("字母排序");

jfsetLayout(new FlowLayout());

jl1=new JLabel("请输入字母");

jl2=new JLabel("排序后");

jb1=new JButton("排序");

jb1addActionListener(this);

jtf1=new JTextField(10);

jtf2=new JTextField(10);

jtf2setEditable(false);

jfadd(jl1);

jfadd(jtf1);

jfadd(jl2);

jfadd(jtf2);

jfadd(jb1);

}

public void showMe(){

jfsetDefaultCloseOperation(JFrameEXIT_ON_CLOSE);

jfsetVisible(true);

jfsetLocation(300, 300);

jfpack();

}

@Override

public void actionPerformed(ActionEvent e) {

String comm=egetActionCommand();

if("排序"equals(comm)){

String s=jtf1getText();

char[] c=new char[slength()];

if(sendsWith("#")){

for (int i = 0; i < slength(); i++) {

c[i]=scharAt(i);

}

}

Arrayssort(c);

String ss="";

for (int i = 0; i < clength; i++) {

ss=ss+c[i];

}

jtf2setText(sssubstring(1));

}

}

public static void main(String[] args) {

new C();

}

}

都是有界面的,写界面不难 就是很麻烦。。。我自己写的 都是可以直接运行的,有什么问题可以再问我。。。

没太看懂是实现这些方法,还是编写工具类。看着改改把。

public class Test {

public static void main(String[] args) {

String s="adc";

Systemoutprintln(concatStrings(s));

}

public static String touppercasee0(String str1) {

String smallToBig =str1toLowerCase();

return smallToBig;

}

public static String tolowercase(String str2) {

String bigToSmall=str2toUpperCase();

return bigToSmall;

}

public static String concatStrings(String str3) {

//指定字符串?

String str4="";

StringBuilder stringBuilder=new StringBuilder();

stringBuilderappend(str3);

stringBuilderappend(str4);

return stringBuildertoString();

}

}

以上就是关于JAVA语言程序设计题目,求高人解答全部的内容,包括:JAVA语言程序设计题目,求高人解答、JAVA语言的编程题、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/9413708.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-28
下一篇2023-04-28

发表评论

登录后才能评论

评论列表(0条)

    保存