📄 driver.java
字号:
import javax.swing.JFrame;import java.awt.TextArea;/** Trig Table Program (Figure 10.19) * Author: David Riley * Date: January, 2005 */public class Driver { private JFrame window; private TextArea degreePane, sinePane, cosinePane; public Driver() { window = new JFrame("Table of sine and cosine"); window.setBounds(10, 10, 300, 300); window.setVisible(true); window.setLayout(null); degreePane = new TextArea(); degreePane.setBounds(10, 20, 50, 240); window.add(degreePane, 0); sinePane = new TextArea(); sinePane.setBounds(70, 20, 100, 240); window.add(sinePane, 0); cosinePane = new TextArea(); cosinePane.setBounds(180, 20, 100, 240); window.add(cosinePane, 0); displayTable(); window.repaint(); } /** post: degreePane, sinePane and cosinePane contain s table of * sine and cosine values beginning with 0 degrees through * 90 degrees in 10 degree increments. */ private void displayTable( ) { int degrees = 0; degreePane.append("Deg. \n"); degreePane.append("---- \n"); sinePane.append("Sine \n"); sinePane.append("------- \n"); cosinePane.append("Cosine \n"); cosinePane.append("------- \n"); do { degreePane.append( degrees + "\n" ); sinePane.append( Math.sin(degrees/180.*Math.PI) + "\n" ); // Math trig functions use radian measures for angles cosinePane.append( Math.cos(degrees/180.*Math.PI) + "\n" ); degrees = degrees + 10; } while (degrees != 100); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -