Wednesday, May 8, 2019

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

Java Programming - Math Problem Example here and now java.awt.BorderLayout here and now java.awt.Colorimport java.awt.Containerimport java.awt.FlowLayoutimport java.awt.Fontimport java.awt.GridLayoutimport java.awt.Windowimport java.awt.event.ActionEventimport java.awt.event.ActionListenerimport java.awt.event.WindowAdapterimport java.awt.event.WindowEventimport javax.swing.JButtonimport javax.swing.JDialogimport javax.swing.JFrameimport javax.swing.JLabelimport javax.swing.JMenuimport javax.swing.JMenuBarimport javax.swing.JMenuItemimport javax.swing.JPanelimport javax.swing.JTextAreaimport javax.swing.JOptionPanepublic class computer extends JFrame implements ActionListener // Variables final int MAX_INPUT_LENGTH = 20 final int INPUT_MODE = 0 final int RESULT_MODE = 1 final int ERROR_MODE = 2 int displayMode boolean clearOnNextDigit, pct double lastNumber String lastOperator orphic JMenu jmenuFile, jmenuEdit, jmenuView, jmenuHelp private JMenuItem jmenuitemExit, jmenuitemCopy, jm enuitemPaste, jmenuitemStd, jmenuitemSci, jmenuitemDigitGrp, jmenuitem nearly private JDialog dialog private JLabel display private JButton button private JPanel masterPanelprivate JTextArea textarea Font f12 = sassy Font(Times in the altogether Roman, 0, 12) Font 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 frame layout manager setBackground(Color.gray) //adds menubar to frame (end) masterPanel = new JPanel() display = new JLabel(0) display.setAl ignmentX(JLabel.RIGHT) display.setBackground(Color.gray) Container contentPane = getContentPane() // Add components to frame contentPane.add(display, BorderLayout.NORTH) button = new JButton23 JPanel backSpace = new JPanel() backSpace.setLayout(new GridLayout(1, 1, 2, 2)) button20 = new JButton(Backspace) backSpace.add(button20) JPanel keep = new JPanel() control.setLayout(new GridLayout(1, 2, 2 ,2)) button21 = new JButton( CE ) button22 = new JButton(C) control.add(button21) control.add(button22)

No comments:

Post a Comment

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