[Java] [Java] Creating a calculator program 1

less than 1 minute read

Purpose

About a month has passed since I first learned Java by myself, and I want to create a GUI application using Java, so I will create a calculator application. This time, we will first create the appearance of the calculator application.

reference

▼website ・Let’s programming-Let’s try using SwingProgramming to start with Java-Chapter12 Try to make a calculatorClass BorderLayout

usage environment

OS: Mac Language: JavaSE1.8 Eclipse

Artifacts

The website that I referred to when creating the program Start programming with Java

Created program

image.png Lines 1-8: Import required libraries

image.png image.png Lines 18 to 21: Frame generation (adding a frame title, determining the frame size, etc.)

Lines 22-25: Creating a text box

Lines 27-51: Generation of numeric keypad. Arrange buttons such as numbers in a 4x4 grid.

Execution result

image.png Next time, we will create the processing of buttons such as number buttons.

Tags:

Updated: