Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi, I need help on a simple GUI Program . The coding language is JAVA. The program needs to look close to the visual on
Hi, I need help on a simple GUI Program. The coding language is JAVA.
The program needs to look close to the visual on the right ->.
I cannot post the calculator.zip file, but it is basically a folder of icon-numbers from 1 to 9, a calculator icon, and computation icons ( +, - , *, / )
HERE IS THE CODE I WAS PROVIDED AS A 'TEMPLATE' TO START THE PROGRAM:
// Demonstrate JButton that use an icon. // Demonstrate JPanel import javax.swing.*; import java.awt.*; import java.util.Collection; public class PanelDemo { public PanelDemo() { JFrame frame = new JFrame("JPanel Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); JLabel label = new JLabel("- JPanel Demo -", JLabel.CENTER); label.setFont(new Font("Courier", Font.PLAIN, 30)); label.setOpaque(true); label.setBorder(BorderFactory.createLineBorder(Color.yellow, 2)); label.setBackground(Color.blue); label.setForeground(Color.white); int width = new ImageIcon("1.png").getIconWidth() * 3; System.out.println(width); JPanel panel = new JPanel(new GridLayout(3, 3)); panel.setPreferredSize(new Dimension(width, width)); for (int i = 1; i { new PanelDemo(); }); } }Description: Implement a simple integer Calculator program with the following features 1. 2. Center the calculator on the default screen at startup The display must have: a. Red border 4-pixel thick. b. 123 Red text with Courier 20-point font. Black background c. 3. All the operations are in the form (operand operatori operandz-operator operands- 4. The buttons will be decorated with the images posted in the calculator.zip file. This includes also the application icon to be used Calculator.png The C button will clear the calculator, eg. initial state. Must support Alt+ Ctrl C Ctrl+button (NOT key) combination will display "(c) your-name" Only the C button can be used to restore the current display. 5. 6. 7. The [Fbutton is the default button. 8. The result can be negative. 9. Only allow up to 8 digits 10. Display error such as "Overflow", "Div by ",.., and the button will clear the error and reset the calculator
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started