没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/3733601/bg1.jpg)
Java 计算器源代码
该计算器有两个主要部分,标准计算器和
科学计算器,科学计算器功能尚未完成。
用的知识:按钮,菜单,布局,面板,窗
口,事件,对话框,标签,单选钮。
有兴趣的读者可以完成剩下的功能。
组成:
三 个 源 程 序 :
Cal.java,BPanel.java,KPanel.java
////////////////// ////////////////////////////////////////////////
//////////////////// Cal.java /////////////////////////////////
///////////////////////////////////////////////////////////////////
package cal;
![](https://csdnimg.cn/release/download_crawler_static/3733601/bg2.jpg)
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
![](https://csdnimg.cn/release/download_crawler_static/3733601/bg3.jpg)
import javax.swing.JPanel;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.KeyStroke;
public class Cal extends JFrame{
/**
*
*/
private static final long serialVersionUID = 1L;
private JMenuBar mb=null;
private JMenu m1=null;
private JMenu m2=null;
private JMenu m4=null;
private JMenuItem mt1=null;
public static JMenuItem mt2=null;
private JRadioButtonMenuItem mt3=null;
private JRadioButtonMenuItem mt4=null;
private JMenuItem mt6=null;
private JMenuItem mt7=null;
private BPanel bp=new BPanel();
private KPanel kp=new KPanel();
private JPanel p=new JPanel();
private static boolean card=true;
![](https://csdnimg.cn/release/download_crawler_static/3733601/bg4.jpg)
public static boolean fz=false;
public static String str=new String();
private JPanel p1=new JPanel();
private CardLayout c1=new CardLayout();
private JLabel b=new JLabel();
static Cal calc;
final JDialog d1=new JDialog();
final JDialog d2=new JDialog();
public static Color bc=new Color(255,204,204);
public static Color qc=Color.cyan;
private Font f=new Font("宋体", Font.BOLD, 15);
private Cal(){
super(" 计算器 ");
this.setLocation(400, 250);
this.setForeground(qc);
this.setBackground(bc);
this.setIconImage(new ImageIcon("jsq.jpg").getImage());
JFrame.setDefaultLookAndFeelDecorated(true);
p=(JPanel) this.getContentPane();
p.setLayout(new FlowLayout());
p.add(b);
p.add(p1);
![](https://csdnimg.cn/release/download_crawler_static/3733601/bg5.jpg)
p1.setLayout(c1);
p1.add("card1",bp);
p1.add("card2",kp);
this.setJMenuBar(getMb());
initDialog1();
initDialog2();
this.pack();
this.setResizable(false);
this.setVisible(true);
}
protected void processWindowEvent(WindowEvent e){
if(e.getID()==WindowEvent.WINDOW_CLOSING)
System.exit(0);
}
private JMenuBar getMb(){
mb=new JMenuBar();
mb.setPreferredSize(new Dimension(110, 35));
mb.setForeground(qc);
mb.setBackground(bc);
mb.add(getM1());
mb.add(getM2());
mb.add(getM4());
剩余44页未读,继续阅读
![text/x-java](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![jar](https://img-home.csdnimg.cn/images/20210720083455.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
jrlb0416
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论1