Contoh Source Code Java Kalkulator

import java.awt.*;
import java.awt.event.*;

public class my_calculator5
{

    Font Bold=new Font("Helvetica", Font.BOLD, 20);
    Label  lcdDisplay = new Label("0",Label.RIGHT);
    Label  leftlcdDisplay = new Label("",Label.RIGHT);
    Label  rightlcdDisplay = new Label("",Label.RIGHT);
    Button mem_recall=new Button("MR");
    Button mem_clear=new Button("MC");
    public void map_calculator()
        {

        event_handler e1=new event_handler();

        Frame calc=new Frame("My Calculator :Beta version 5");
        calc.setResizable(false);
        calc.setSize(450,360);
        calc.setBackground(Color.gray);
        calc.setLayout(null);

        //lcdDisplay.setEditable(false);not used for label
        lcdDisplay.setBounds(68,58,320,30);
        lcdDisplay.setFont(new Font("Helvetica", Font.PLAIN, 20));
        lcdDisplay.setForeground(Color.orange);
        lcdDisplay.setBackground(Color.black);
        calc.add(lcdDisplay);

        rightlcdDisplay.setBounds(388,58,30,30);
        rightlcdDisplay.setFont(new Font("Helvetica", Font.PLAIN, 20));
        rightlcdDisplay.setForeground(Color.green);
        rightlcdDisplay.setBackground(Color.black);
        calc.add(rightlcdDisplay);
        //adding button 1 to 0

        Button mplus=new Button("M+");
        mplus.setBounds(72,96,60,34);
        mplus.setBackground(Color.black);
        mplus.setForeground(Color.red);
        mplus.setFont(Bold);
        mplus.addActionListener(e1);
        calc.add(mplus);


        mem_clear.setEnabled(false);
        mem_clear.setBounds(136,96,60,34);
        mem_clear.setBackground(Color.black);
        mem_clear.setForeground(Color.red);
        mem_clear.setFont(Bold);
        mem_clear.addActionListener(e1);
        calc.add(mem_clear);


        mem_recall.setBounds(200,96,60,34);
        mem_recall.setBackground(Color.black);
        mem_recall.setForeground(Color.red);
        mem_recall.setFont(Bold);
        mem_recall.addActionListener(e1);
        mem_recall.setEnabled(false);
        calc.add(mem_recall);


        Button one=new Button("1");
        one.setBounds(72,134,60,34);
        one.setBackground(Color.orange);
        one.setFont(Bold);
        one.addActionListener(e1);
        calc.add(one);

        Button two=new Button("2");
        two.addActionListener(e1);

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Leave a comment

Diharapka Memberikan Informasi Dan Feedback Yang sekiranya pantas Untuk Dibaca Ok .Kritikan Diterima Dengan Senang Hati....