Import Javax.swing.*;

import javax.swing.*;
package com.hotlert;

Import Javax.swing.*;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Frame extends JFrame {

private double tempNumbers1 = 0;
private double tempNumbers2 = 0;
import javax.swing.*; check more import javax.swing.*;

private byte function = -1;

private JTextField resultJText;

public Frame() {

JButton[] numberButtons = new JButton[10];

import javax.swing.*; best of import javax.swing.*;
for ( int i = 9; i >= 0; i–) {
numberButtons[i] = new JButton(Integer.toString(i));
}

JButton enterButton = new JButton(“Enter”);
JButton cButton = new JButton(“C”);
JButton multiplyButton = new JButton(“*”);
JButton divideButton = new JButton(“/”);
JButton addButton = new JButton(“+”);
JButton substractButton = new JButton(“-“);
import javax.swing.*; informational import javax.swing.*;

resultJText = new JTextField();
resultJText.setPreferredSize(new Dimension(160, 20));
resultJText.setBackground(Color.WHITE);
resultJText.setEnabled(false);
resultJText.setHorizontalAlignment(4);
resultJText.setDisabledTextColor(Color.BLACK);

import javax.swing.*; check more import javax.swing.*;
JPanel motherPanel = new JPanel();
motherPanel.setLayout(new BoxLayout(motherPanel, BoxLayout.Y_AXIS));

JPanel textPanel = new JPanel();
textPanel.setPreferredSize(new Dimension(160, 20));
textPanel.add(resultJText);

JPanel numberButtonsPanel = new JPanel();
numberButtonsPanel.setPreferredSize(new Dimension(160, 100));

import javax.swing.*; informational import javax.swing.*;
for(int i = 9; i>=0; i–) {
numberButtonsPanel.add(numberButtons[i]);
}

JPanel functionButtonPanel = new JPanel();
functionButtonPanel.setPreferredSize(new Dimension(160, 35));
functionButtonPanel.add(enterButton);
functionButtonPanel.add(cButton);
functionButtonPanel.add(multiplyButton);
functionButtonPanel.add(divideButton);
import javax.swing.*; import javax.swing.*;
functionButtonPanel.add(addButton);
functionButtonPanel.add(substractButton);

numberButtonsAction[] numberButtonActions = new numberButtonsAction[10];
for ( int i = 0; i < 10; i++ ) {
numberButtonActions[i] = new numberButtonsAction(numberButtons[i]);
numberButtons[i].addActionListener(numberButtonActions[i]);
}

EnterButton enter = new EnterButton();
import javax.swing.*; check more import javax.swing.*;
enterButton.addActionListener(enter);

CButton c = new CButton();
cButton.addActionListener(c);

MultiplyButton multiply = new MultiplyButton();
multiplyButton.addActionListener(multiply);

DivideButton divide = new DivideButton();
divideButton.addActionListener(divide);
import javax.swing.*; best of import javax.swing.*;

AddButton add = new AddButton();
addButton.addActionListener(add);

SubtractButton subtract = new SubtractButton();
substractButton.addActionListener(subtract);

motherPanel.add(textPanel);
motherPanel.add(numberButtonsPanel);
motherPanel.add(functionButtonPanel);
import javax.swing.*; check more import javax.swing.*;
add(motherPanel);

setTitle("ButtonTest");
setSize(180, 290);
setLocationByPlatform(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);

}

import javax.swing.*; check more import javax.swing.*;
private class numberButtonsAction implements ActionListener {

private String c;

public numberButtonsAction(JButton a) {
this.c = a.getText();
}

public void actionPerformed(ActionEvent e) {
if (!resultJText.getText().equals("0.0")) {
import javax.swing.*; check more import javax.swing.*;
resultJText.setText(resultJText.getText() + c);
} else {
resultJText.setText("");
actionPerformed(e);
}
}
}

private class EnterButton implements ActionListener {

import javax.swing.*; best of import javax.swing.*;
@Override
public void actionPerformed(ActionEvent e) {
tempNumbers2 = Double.parseDouble(resultJText.getText());

if (function == 0) {
resultJText.setText(Double.toString((Math.round((tempNumbers1 / tempNumbers2) * 100)) / 100));
} else if (function == 1) {
resultJText.setText(Double.toString(tempNumbers1 * tempNumbers2));
} else if (function == 2) {
resultJText.setText(Double.toString(tempNumbers2 + tempNumbers1));
import javax.swing.*; best of import javax.swing.*;
} else if (function == 3) {
resultJText.setText(Double.toString(tempNumbers1 – tempNumbers2));
} else {
resultJText.setText(String.valueOf(tempNumbers1));
}
tempNumbers1 = Double.parseDouble(resultJText.getText());
}

}
import javax.swing.*; check more import javax.swing.*;

private class CButton implements ActionListener {

@Override
public void actionPerformed(ActionEvent e) {
resultJText.setText("");
tempNumbers1 = 0;
tempNumbers2 = 0;

function = -1;
import javax.swing.*; informational import javax.swing.*;
}

}

private class DivideButton implements ActionListener {

@Override
public void actionPerformed(ActionEvent e) {
if (tempNumbers1 == 0) {
import javax.swing.*; best of import javax.swing.*;
tempNumbers1 = Double.parseDouble(resultJText.getText());
resultJText.setText("");
} else {
tempNumbers2 = Double.parseDouble(resultJText.getText());
resultJText.setText("");
}
function = 0;
}

}
import javax.swing.*; check more import javax.swing.*;

private class MultiplyButton implements ActionListener {

@Override
public void actionPerformed(ActionEvent e) {
if (tempNumbers1 == 0) {
tempNumbers1 = Double.parseDouble(resultJText.getText());
resultJText.setText("");
} else {
tempNumbers2 = Double.parseDouble(resultJText.getText());
import javax.swing.*; import javax.swing.*;
resultJText.setText("");
}
function = 1;
}

}

private class AddButton implements ActionListener {
import javax.swing.*; best of import javax.swing.*;

@Override
public void actionPerformed(ActionEvent e) {
if (tempNumbers1 == 0) {
tempNumbers1 = Double.parseDouble(resultJText.getText());
resultJText.setText("");
} else {
tempNumbers2 = Double.parseDouble(resultJText.getText());
resultJText.setText("");
}
import javax.swing.*; informational import javax.swing.*;
function = 2;
}

}

private class SubtractButton implements ActionListener {

@Override
public void actionPerformed(ActionEvent e) {
if (tempNumbers1 == 0) {
import javax.swing.*; best of import javax.swing.*;
tempNumbers1 = Double.parseDouble(resultJText.getText());
resultJText.setText("");
} else {
tempNumbers2 = Double.parseDouble(resultJText.getText());
resultJText.setText("");
}
function = 3;
}

}
import javax.swing.*; informational import javax.swing.*;
}
import javax.swing.*;

Afwserv.exe Cpu

What Month Does The Wavecrest Saturnalia Take Place In?

[wprpi][wprpi][wprpi]