Welcome![Sign In][Sign Up]
Location:
Search - static

Search list

[WEB Code细分时钟刻度算法.txt

Description: import java.awt.*; import javax.swing.*; public class Exercise8_12 extends JFrame { // Main method with three auguments: // args[0]: hour // args[1]: minute // args[2]: second public static void main(String[] args) { // Declare hour, minute, and second values int hour = 0; int minute = 0; int second = 0; // Check usage and get hour, minute, second if (args.length > 3) { System.out.println( "Usage: java DisplayClock hour minute second"); System.exit(0); } else if (args.length == 3) { hour = new Integer(args[0]).intValue(); minute = new Integer(args[1]).intValue(); second = new Integer(args[2]).intValue(); } else if (args.length == 2) { hour = new Integer(args[0]).intValue(); minute = new Integer(args[1]).intValue(); } else if (args.length == 1) { hour = new Integer(args[0]).intValue(); } // Create a frame to hold the clock Exercise8_12 frame = new Exercise8_12(); frame.setTitle("Exercise 8.12: Display Clock"); frame.getContentPane().add(new DrawClock(hour, minute, second)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 350); frame.setVisible(true); } } class DrawClock extends JPanel { private int hour; private int minute; private int second; protected int xCenter, yCenter; protected int clockRadius; // Construct a clock panel public DrawClock(int hour, int minute, int second) { this.hour = hour; this.minute = minute; this.second = second; } // Draw the clock public void paintComponent(Graphics g) { super.paintComponent(g); // Initialize clock parameters clockRadius = (int)(Math.min(getSize().width, getSize().height)*0.7*0.5); xCenter = (getSize().width)/2; yCenter = (getSize().height)/2; // Draw circle g.setColor(Color.black); g.drawOval(xCenter - clockRadius,yCenter - clockRadius, 2*clockRadius, 2*clockRadius); g.drawString("12",xCenter-5, yCenter-clockRadius); g.drawString("9",xCenter-clockRadius-10,yCenter+3); g.drawString("3",xCenter+clockRadius,yCenter+3); g.drawString("6",xCenter-3,yCenter+clockRadius+10); // Draw second hand int sLength = (int)(clockRadius*0.85); int xSecond = (int)(xCenter + sLength*Math.sin(second*(2*Math.PI/60))); int ySecond = (int)(yCenter - sLength*Math.cos(second*(2*Math.PI/60))); g.setColor(Color.red); g.drawLine(xCenter, yCenter, xSecond, ySecond); // Draw minute hand int mLength = (int)(clockRadius*0.75); int xMinute = (int)(xCenter + mLength*Math.sin(minute*(2*Math.PI/60))); int yMinute = (int)(yCenter - mLength*Math.cos(minute*(2*Math.PI/60))); g.setColor(Color.blue); g.drawLine(xCenter, yCenter, xMinute, yMinute); // Draw hour hand int hLength = (int)(clockRadius*0.6); int xHour = (int)(xCenter + hLength*Math.sin((hour+minute/60.0)*(2*Math.PI/12))); int yHour = (int)(yCenter - hLength*Math.cos((hour+minute/60.0)*(2*Math.PI/12))); g.setColor(Color.green); g.drawLine(xCenter, yCenter, xHour, yHour); // Display current time in string g.setColor(Color.red); String time = "Hour: " + hour + " Minute: " + minute + " Second: " + second; FontMetrics fm = g.getFontMetrics(); g.drawString(time, (getSize().width - fm.stringWidth(time))/2, yCenter+clockRadius+30); // Display more details on the clock for (int i=0; i<60; i++) { double percent; if (i%5 == 0) { percent = 0.9; } else { percent = 0.95; } //细分时钟刻度 int xOuter = (int)(xCenter + clockRadius*Math.sin(i*(2*Math.PI/60))); int yOuter = (int)(yCenter - clockRadius*Math.cos(i*(2*Math.PI/60))); int xInner = (int)(xCenter + percent*clockRadius*Math.sin(i*(2*Math.PI/60))); int yInner = (int)(yCenter - percent*clockRadius*Math.cos(i*(2*Math.PI/60))); g.drawLine(xOuter, yOuter, xInner, yInner); } } }
Platform: | Size: 4270 | Author: hellosoft010@sina.com | Hits:

[Software Engineeringadvanced.asic.synthesis.w.synopsis

Description: Advanced ASIC Chip Synthesis Using Synopsys Design Compiler. This second edition of this book describes the advanced concepts and techniques used towards ASIC chip synthesis, physical synthesis, formal verification and static timing analysis, using the Synopsys suite of tools.-Advanced ASIC Chip Synthesis Using Synopsys Design Compiler. This second edition of this book describes the advanced concepts and techniques used towards ASIC chip synthesis, physical synthesis, formal verification and static timing analysis, using the Synopsys suite of tools.
Platform: | Size: 2290136 | Author: testsb | Hits:

[Program docJava关键字总结

Description: Java关键字final、static使用总结
Platform: | Size: 48128 | Author: csuhuangqiang | Hits:

[EditBoxCEditExAndCStaticEx

Description: 类似VC编辑环境的特殊字符用特殊颜色显示的编辑框-The edit which can display the special chars in special color as VC IDE
Platform: | Size: 0 | Author: 站长 | Hits:

[Static controldigidisplay_demo

Description: 显示电子钟一样的数字和字母-The static control which can display number and letter of electronic clock style
Platform: | Size: 46080 | Author: 站长 | Hits:

[Static controlcdigitst

Description: 显示电子钟一样数字的静态控件-The static control which can display number of electronic clock style
Platform: | Size: 105472 | Author: 站长 | Hits:

[Static controldraw_bevel2

Description: 带bevel线的静态控件-The static control with beve line
Platform: | Size: 14336 | Author: 站长 | Hits:

[Static controlrotated_bevel_demo

Description: 带bevel线的静态控件-The static control with beve line
Platform: | Size: 54272 | Author: 站长 | Hits:

[Static controljumpytext_demo

Description: 有跳动感地显示文字的静态控件-The static control which can display jumping text
Platform: | Size: 141312 | Author: 站长 | Hits:

[Static controlCGradientStatic

Description: 一个背景颜色渐变的文字类--A font class whose background color can be gradually changed.
Platform: | Size: 19456 | Author: 站长 | Hits:

[JSP/Javafwxwfb1

Description: 简介: 采用了静态的HTML作为新闻存储的格式,先进的全文检索技术, 可视化的新闻发布界面 管理程序为admin/index.jsp,默认的管理员为admin(password:admin888), 编辑为: edit(password:edit888)-Introduction: the use of a static HTML format as a news storage, advanced full-text search technology, the press release visualization interface management procedures for the admin/index.jsp, the default administrator for admin (password: admin888), edit as follows: edit (password: edit888)
Platform: | Size: 901120 | Author: 莲叶 | Hits:

[MultiLanguageHanziStatics

Description: 汉字统计程序-Chinese statistical procedures
Platform: | Size: 1280000 | Author: | Hits:

[Othervc++

Description: 一个简单的数字时钟程序,其中的date类派生于MFC CStatic 基类。- A simple digital clock procedure, date kind of derivation to MFC CStatic base class.
Platform: | Size: 19456 | Author: | Hits:

[GUI DevelopWndCtrl_demo

Description: 可重复使用的WNDCTRL类 这个类基本上容纳了一些隐藏的控件和窗口。一个 WndCtrl对象有两个状态, 即开和关。你必须把这个控件加到m_WndCtrl中。当WndCtrl被打开的时候,控件被创建,当WndCtrl被关闭的时候,控件被隐藏或撤销。WndCtrl将会是所有加到它上面的控件的父节点。WndCtrl可以在关闭或开着的状态下改变大小或重新定位。然而,关闭状态下的大小是静态的,不能被改变。无论大小是否被改变,都将会影响WndCtrl开着的状态- Might duplicate a WNDCTRL kind of this kind which used basically holds some hideaways to control and the window. A WndCtrl object has two conditions, namely opens with the pass. You must control this to add to in m_WndCtrl. When WndCtrl is opened, controls to found, when WndCtrl is closed, controls to hide or to abolish. WndCtrl could be all adds to above it to control the father pitch point. WndCtrl may the condition change the size under the closure either is opening or relocate. However, under the off-position size is the static state, cannot change. Regardless of size whether is changed, all will be able to affect WndCtrl will be opening the condition
Platform: | Size: 31744 | Author: 李健 | Hits:

[Static controlXColorStatic-CStatic派生类,支持改变字体,字体和背

Description: XColorStatic-CStatic派生类,支持改变字体,字体和背景色等-XColorStatic-CStatic derived class, supports the change typeface, the typeface and the back scenery and so on
Platform: | Size: 36864 | Author: 熊友根 | Hits:

[OS program新建 文本文档

Description: 使用C#控制远程计算机的服务在Win32ServiceManager中通过RemoteConnectValidate静态方法来测试连接成功与否;另外提供了GetServiceValue方法和GetServiceList方法以及它的重载来获取服务信息;后面的四个方法就是对服务的状态控制了。 下面建立一个简单的窗口来使用它。- Uses C# to control the long-distance computer the service to test in Win32ServiceManager through the RemoteConnectValidate static state method connects successfully or not; Moreover has provided the GetServiceValue method and the GetServiceList method as well as its heavy load gains the service information; The behind four methods were control to the service condition. Under establishes a simple window to use it.
Platform: | Size: 2048 | Author: 王大风 | Hits:

[GUI Develop21-40

Description: vc灵感编程范例源代码 21 在窗口标题栏上显示文字的两种方法 22 控制窗口最大最小尺寸 23 隐藏或显示桌面图标 24 重新设置桌面 25 闪烁的标题栏 26 旋转字体 27 MyDialog 28 在任务栏上显示图标 29 MySplashWnd 30 PlaySound 31 SoundCardDetect 32 DriveNumber 33 图象旋转 34 将固定大小的位图在窗口平铺 35 打开关闭光驱门 36 使按钮变灰 37 位图按钮 38 改变按钮字体 39 带颜色的静态文本控件 40 MyButton-vc inspiration source code programming examples in 21 Biaodilanshang window display text of the two methods most 22 control window large minimum size of 23 or hidden Show Desktop icon 24 reconfigured desktop 25 flashing title bar font rotation 26 27 MyDialog 28 in the task bar icon displayed on the 29 MySplashWnd 30 PlaySo 32 und 31 SoundCardDetect image rotation DriveNumber 33 3 4 fixed size of the bitmap in the window of a flat bed 35 closed drive to open the door so that the button greyed 36 37 38 buttons to change plans Font button 39 with the color static text control 40 MyButton
Platform: | Size: 1824768 | Author: yiyizi | Hits:

[Crack Hack节省资源的MD5算法

Description: 为一个字节或字符数组或串计算md5值,内部只创建一个数组,节省分配时间,节省内存 完全是static方法,线程安全 注意对返回值的处理,见注释-for a byte array or character string or md5 value calculation, only to create an internal array, saving time allocated to save memory is completely static method, thread-safe attention to the return value, see note
Platform: | Size: 2048 | Author: 林华 | Hits:

[JSP/Javastatic factory

Description: java的静态工厂设计模式-factory design pattern
Platform: | Size: 0 | Author: 梁周明 | Hits:

[GUI Developstatictime

Description: 一个好用的时间选择控件,可以选一天的任一时间。-a handy control the timing, the election day as a time.
Platform: | Size: 105472 | Author: 陆东峰 | Hits:
« 1 2 ... 43 44 45 46 47 4849 50 »

CodeBus www.codebus.net