小程序源码网java 微信小程序java开发

简介求可以下载JAVA小程序+源代码的网站http://www.codefans.net/sort/list_5_1.shtmljava小程序源代码求一个JAVA小程序的源代码,要求如下大概是这个样子。——————————————————————————————import java.awt.Graphics;import java.awt.Point;import java.awt.eve

  

求可以下载JAVA小程序+源代码的网站

小程序源码网java 微信小程序java开发

http://www.codefans.net/sort/list_5_1.shtml

java小程序源代码

求一个JAVA小程序的源代码,要求如下

大概是这个样子。
——————————————————————————————import java.awt.Graphics;import java.awt.Point;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import java.util.Date;import java.util.Timer;import java.util.TimerTask;import javax.swing.JButton;import javax.swing.J ;import javax.swing.JPanel;public class DateCheck extends J implements ActionListener { private boolean isOval = true; public DateCheck() { setSize(567, 419); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); getContentPane().setLayout(null); JButton btnNewButton = new JButton(“Oval”); btnNewButton.addActionListener(this); btnNewButton.setBounds(80, 10, 93, 23); getContentPane().add(btnNewButton); JButton btnNewButton_1 = new JButton(“Rect”); btnNewButton_1.setBounds(203, 10, 93, 23); btnNewButton_1.addActionListener(this); getContentPane().add(btnNewButton_1); JPanel panel = new MyPanel(); panel.setBounds(12, 47, 537, 337); getContentPane().add(panel); new Timer().schele(new MyTimesk(), new Date(), 100); setVisible(true); } public static void main(String[] args) { new DateCheck(); } public void actionPerformed(ActionEvent event) { isOval = “Oval”.equals(event.getActionCommand()); System.out.println(isOval); } class MyPanel extends JPanel implements MouseListener { Point point1 = null; Point point2 = null; // protected void paintComponent(Graphics g) { // super.paintComponent(g); // // } int click = 0; public MyPanel() { addMouseListener(this); } public void paint(Graphics g) { super.paint(g); Point p = this.getMousePosition(); if (p == null && click % 2 == 1) { return; } if (click % 2 == 0 && (point1 == null || point2 == null)) { return; } if (click % 2 == 0) { if (isOval) { int w = point2.x – point1.x; int h = point2.y – point1.y; int r = (int) Math.sqrt(w * w + h * h); g.drawOval(point1.x – r / 2, point1.y – r / 2, r + r / 2, r + r / 2); } else { g.drawRect(point1.x, point1.y, point2.x – point1.x, point2.y – point1.y); } return; } if (isOval) { if (click % 2 == 1) { int w = p.x – point1.x; int h = p.y – point1.y; int r = (int) Math.sqrt(w * w + h * h); g.drawOval(point1.x – r / 2, point1.y – r / 2, r + r / 2, r + r / 2); } } else { g.drawRect(point1.x, point1.y, p.x – point1.x, p.y – point1.y); } } public void mouseClicked(MouseEvent mouseevent) { click++; if (click % 2 == 1) { point1 = mouseevent.getPoint(); } else { point2 = mouseevent.getPoint(); } } public void mouseEntered(MouseEvent mouseevent) { } public void mouseExited(MouseEvent mouseevent) { } public void mousePressed(MouseEvent mouseevent) { } public void mouseReleased(MouseEvent mouseevent) { } } class MyTimesk extends TimerTask { public void run() { repaint(); } }}

下载链接:网站源码/小程序源码/网站模板下载

版权声明

   站内部分内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供网络资源分享服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请 联系我们 一经核实,立即删除。并对发布账号进行永久封禁处理。在为用户提供最好的产品同时,保证优秀的服务质量。


本站仅提供信息存储空间,不拥有所有权,不承担相关法律责任。

给TA打赏
共{{data.count}}人
人已打赏
网站技巧

小程序源码网健身房 健身教练约课小程序

2024-9-19 19:54:08

网站技巧

最好的小程序源码 个人小程序

2024-9-19 19:54:10

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索