Saturday, August 22, 2020

Java Programming Math Problem Example | Topics and Well Written Essays - 1250 words

Java Programming - Math Problem Example import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JOptionPane; open class Calculator broadens JFrame executes ActionListener { /Variables last int MAX_INPUT_LENGTH = 20; last int INPUT_MODE = 0; last int RESULT_MODE = 1; last int ERROR_MODE = 2; int displayMode; boolean clearOnNextDigit, percent; twofold lastNumber; String lastOperator; private JMenu jmenuFile, jmenuEdit, jmenuView, jmenuHelp; private JMenuItem jmenuitemExit, jmenuitemCopy, jmenuitemPaste, jmenuitemStd, jmenuitemSci, jmenuitemDigitGrp, jmenuitemAbout; private JDialog discourse; private JLabel show; private JButton button[]; private JPanel masterPanel; private JTextArea textarea; Text style f12 = new Font(Times New Roman, 0, 12); Text style f121 = new Font(Times New Roman, 1, 12); ... jmenuitemSci = new JMenuItem(Scientific); jmenuitemSci.setFont(f12); jmenuitemDigitGrp = new JMenuItem(Digit Grouping); jmenuitemDigitGrp.setFont(f12); jmenuView.add(jmenuitemStd);jmenuView.add(jmenuitemSci);jmenuView.addSeparator();jmenuView.add(jmenuitemDigitGrp); jmenuHelp = new JMenu(Help); jmenuHelp.setFont(f121); jmenuitemAbout = new JMenuItem(About Calculator); jmenuitemAbout.setFont(f12); jmenuHelp.add(jmenuitemAbout); JMenuBar mb = new JMenuBar(); /mb.add(jmenuFile); mb.add(jmenuEdit); mb.add(jmenuView); mb.add(jmenuHelp); setJMenuBar(mb); /Set edge design director setBackground(Color.gray); /adds menubar to outline (end) masterPanel = new JPanel(); show = new JLabel(0); display.setAlignmentX(JLabel.RIGHT); display.setBackground(Color.gray); Holder contentPane = getContentPane(); /Add segments to outline contentPane.add(display, BorderLayout.NORTH); button = new JButton[23]; JPanel backSpace = new JPanel(); backSpace.setLayout(new GridLayout(1, 1, 2, 2)); button[20] = new JButton(Backspace); backSpace.add(button[20]); JPanel control = new JPanel(); control.setLayout(new GridLayout(1, 2, ,2)); button[21] = new JButton( CE ); button[22] = new JButton(C); control.add(button[21]); control.add(button[22]);

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.