java编写app实例,JAVA编写一个小应用程序急

1,JAVA编写一个小应用程序急用JS写可行?不知道哦
2,编写一个Java Application应用程序如何编写能实现以下效果用记事本写一个Test.java的文件public class Testpublic static void main(String[] args) System.out.println("Welcome to Java World!");}}进入CMD 转换到你这个文件所在的目录下然后编译输入javac Test.javajava Test就可以出来没用IDE的话 。。先建立一个文本文件保存为.java格式文件名要和pulic 类名一样;编辑输入保存 。public class Testpublic static void main(String[] args) System.out.println("Welcome to Java World!");}}打开dos窗口..转换到你这个文件所在的目录下 。javac Test.java 编译.java Test运行 。如果你没转到文件所在的目录下,你编译运行的时候都要输入绝对路径 。楼上是对的 。只要一个主方法+个输出语句就KO了 。public class Testpublic static void main(String[] args) System.out.println("Welcome to Java World!");}}【java编写app实例,JAVA编写一个小应用程序急】
3,用java编写一个小应用程序package test;import javax.swing.JPanel;import java.awt.*;import java.awt.event.WindowAdapter;import javax.swing.JFrame;class PaintovalPane extends JPanelpublic void paintComponent(Graphics g)super.paintComponent(g);g.setColor(Color.pink);g.fillOval(300, 300, 100, 100); }}class PaintovalFrame extends JFramepublic PaintovalFrame()setTitle("圆");setSize(1000, 1000);addWindowListener(new WindowAdapter()});Container contentPane = getContentPane();contentPane.add(new PaintovalPane()); }}public class Paintovalpublic static void main(String[] args)JFrame f = new PaintovalFrame();f.show(); }}运行没问题,采纳吧,兄弟~~你看看Swing ; 这块很简单的; 看懂请采纳1
4 , 编写java applet 程序随便写了个 功能实现了 public class Trapezoidalprivate double upWeight; private double height; private double downWeight; public Trapezoidal(double upWeight,double height,double downWeight) setHeight(height); setDownWeight(downWeight); setUpWeight(upWeight); } public double getUpWeight()return upWeight; } public void setUpWeight(double upWeight)this.upWeight = upWeight; } public double getHeight()return height; } public void setHeight(double height)this.height = height; } public double getDownWeight()return downWeight; } public void setDownWeight(double downWeight)this.downWeight = downWeight; } public String count() return Double.toString((getDownWeight()+getUpWeight())*getHeight()/2); }}import java.awt.GridLayout;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.JPanel;import javax.swing.JTextField;import com.sun.xml.internal.fastinfoset.algorithm.IEEE754FloatingPointEncodingAlgorithm;public class TestApp extends JFrame private JFrame jf = new JFrame(); private JPanel jp = new JPanel(); private JLabel jl1,jl2,jl3; private JButton jb1; private JTextField jtf1,jtf2,jtf3,jtf4; public TestApp() jl1 = new JLabel("上底"); jl2 = new JLabel("下底"); jl3 = new JLabel("高"); jtf1 = new JTextField(); jtf2 = new JTextField(); jtf3 = new JTextField(); jtf4 = new JTextField("结果"); jb1 = new JButton("计算"); jp.setLayout(new GridLayout(4, 2)); jp.add(jl1); jp.add(jtf1); jp.add(jl2); jp.add(jtf2); jp.add(jl3); jp.add(jtf3); jp.add(jb1); jp.add(jtf4); jf.add(jp); jf.setVisible(true); jf.setSize(400, 300); jb1.addActionListener(new ActionListener()public void actionPerformed(ActionEvent e)// TODO Auto-generated method stub double str1 = Double.valueOf(jtf1.getText()); double str2 = Double.valueOf(jtf2.getText()); double str3 = Double.valueOf(jtf3.getText()); jtf4.setText(new Trapezoidal(str1, str3, str2).count()); System.out.println(new Trapezoidal(str1, str3, str2).count()); } }); } public static void main(String[] args)// TODO Auto-generated method stub TestApp ta = new TestApp(); }}5,怎么使用JAVA编写一个小应用程序单人版五子棋,自己写的 。------------------------------------------import java.awt.*;import java.awt.event.*;import javax.swing.*;class mypanel extends Panel implements MouseListenerint chess[][] = new int[11][11];boolean Is_Black_True;mypanel()Is_Black_True = true;for(int i = 0;i < 11;i++)for(int j = 0;j < 11;j++)chess[i][j] = 0;}}addMouseListener(this);setBackground(Color.BLUE);setBounds(0, 0, 360, 360);setVisible(true);}public void mousePressed(MouseEvent e)int x = e.getX(); int y = e.getY(); if(x < 25 || x > 330 + 25 ||y < 25 || y > 330+25)return;} if(chess[x/30-1][y/30-1] != 0)return;}if(Is_Black_True == true)chess[x/30-1][y/30-1] = 1;Is_Black_True = false;repaint();Justisewiner();return;}if(Is_Black_True == false)chess[x/30-1][y/30-1] = 2;Is_Black_True = true;repaint();Justisewiner();return;}}void Drawline(Graphics g)for(int i = 30;i <= 330;i += 30)for(int j = 30;j <= 330; j+= 30)g.setColor(Color.WHITE);g.drawLine(i, j, i, 330);} } for(int j = 30;j <= 330;j += 30)g.setColor(Color.WHITE);g.drawLine(30, j, 330, j); }}void Drawchess(Graphics g)for(int i = 0;i < 11;i++)for(int j = 0;j < 11;j++)if(chess[i][j] == 1)g.setColor(Color.BLACK);g.fillOval((i + 1) * 30 - 8, (j + 1) * 30 - 8, 16, 16);}if(chess[i][j] == 2)g.setColor(Color.WHITE);g.fillOval((i + 1) * 30 - 8, (j + 1) * 30 - 8, 16, 16);}} }}void Justisewiner()int black_count = 0; int white_count = 0;int i = 0; for(i = 0;i < 11;i++)//横向判断for(int j = 0;j < 11;j++)if(chess[i][j] == 1)black_count++;if(black_count == 5)JOptionPane.showMessageDialog(this, "黑棋胜利");Clear_Chess();return;}}elseblack_count = 0;}if(chess[i][j] == 2)white_count++;if(white_count == 5)JOptionPane.showMessageDialog(this, "白棋胜利");Clear_Chess();return;}}elsewhite_count = 0;}} } for(i = 0;i < 11;i++)//竖向判断for(int j = 0;j < 11;j++)if(chess[j][i] == 1)black_count++;if(black_count == 5)JOptionPane.showMessageDialog(this, "黑棋胜利");Clear_Chess();return;}}elseblack_count = 0;}if(chess[j][i] == 2)white_count++;if(white_count == 5)JOptionPane.showMessageDialog(this, "白棋胜利");Clear_Chess();return;}}elsewhite_count = 0;}} }for(i = 0;i < 7;i++)//左向右斜判断for(int j = 0;j < 7;j++)for(int k = 0;k < 5;k++)if(chess[i + k][j + k] == 1)black_count++;if(black_count == 5)JOptionPane.showMessageDialog(this, "黑棋胜利");Clear_Chess();return;}}elseblack_count = 0;}if(chess[i + k][j + k] == 2)white_count++;if(white_count == 5)JOptionPane.showMessageDialog(this, "白棋胜利");Clear_Chess();return;}}elsewhite_count = 0;}}} } for(i = 4;i < 11;i++)//右向左斜判断for(int j = 6;j >= 0;j--)for(int k = 0;k < 5;k++)if(chess[i - k][j + k] == 1)black_count++;if(black_count == 5)JOptionPane.showMessageDialog(this, "黑棋胜利");Clear_Chess();return;}}elseblack_count = 0;}if(chess[i - k][j + k] == 2)white_count++;if(white_count == 5)JOptionPane.showMessageDialog(this, "白棋胜利");Clear_Chess();return;}}elsewhite_count = 0;}}} }}void Clear_Chess()for(int i=0;i<11;i++)for(int j=0;j<11;j++)chess[i][j]=0;} } repaint();}public void paint(Graphics g)Drawline(g);Drawchess(g);}public void mouseExited(MouseEvent e)public void mouseEntered(MouseEvent e)public void mouseReleased(MouseEvent e)public void mouseClicked(MouseEvent e)}class myframe extends Frame implements WindowListenermypanel panel;myframe()setLayout(null);panel = new mypanel();add(panel);panel.setBounds(0,23, 360, 360);setTitle("单人版五子棋");setBounds(200, 200, 360, 383);setVisible(true);addWindowListener(this);}public void windowClosing(WindowEvent e)System.exit(0);}public void windowDeactivated(WindowEvent e)public void windowActivated(WindowEvent e)public void windowOpened(WindowEvent e)public void windowClosed(WindowEvent e)public void windowIconified(WindowEvent e)public void windowDeiconified(WindowEvent e)}public class mywindowpublic static void main(String argc [])myframe f = new myframe();}}

    推荐阅读