@@ -0,0 +1,2405 @@
+package textprac;%0D%0A%0D%0Aimport java.awt.*;%0D%0Aimport java.awt.event.*;%0D%0Aimport javax.swing.JButton;%0D%0Aimport javax.swing.JFrame;%0D%0Aimport javax.swing.JTextField;%0D%0A %0D%0Apublic class TextPrac %7B%0D%0A    final static boolean shouldFill = true;%0D%0A    final static boolean shouldWeightX = true;%0D%0A    final static boolean RIGHT_TO_LEFT = false;%0D%0A    private static JTextField textField = new JTextField();%0D%0A%0D%0A    %0D%0A    %0D%0A    public static void addComponents(Container pane) %7B%0D%0A        %0D%0A        if (RIGHT_TO_LEFT) %7B%0D%0A            pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);%0D%0A        %7D%0D%0A        %0D%0A        JButton button1;%0D%0A        %0D%0A        %0D%0A    class ButtonListener implements ActionListener %7B%0D%0A        String storage = %22%22;%0D%0A    public void actionPerformed(ActionEvent e) %7B%0D%0A    String inputs = ((JButton)e.getSource()).getText();%0D%0A    storage = storage + inputs;%0D%0A    textField.setText(storage);%0D%0A%7D %0D%0A    %7D%0D%0A        %0D%0A    pane.setLayout(new GridBagLayout());%0D%0A    GridBagConstraints c = new GridBagConstraints();%0D%0A            if (shouldFill) %7B%0D%0A            //max height/width%0D%0A         c.fill = GridBagConstraints.BOTH;%0D%0A            %7D%0D%0A            %0D%0A    ButtonListener bl = new ButtonListener();%0D%0A    button1 = new JButton(%221%22);%0D%0A        //if (shouldWeightX) %7B%0D%0A        //c.weightx = 1;%0D%0A        //%7D%0D%0A            c.weightx = 1;%0D%0A            c.weighty = 1;%0D%0A            c.ipady = 10;%0D%0A            c.ipadx = 10;%0D%0A            c.gridx = 0;%0D%0A            c.gridy = 1;%0D%0A            pane.add(button1, c);%0D%0A            button1.addActionListener(bl);%0D%0A            %0D%0A           //text box %0D%0A            //give the textfield an area to exist%0D%0A            c.weightx = 1.0;%0D%0A            c.weighty = 1.0;%0D%0A            c.gridx = 0;%0D%0A            c.gridy = 0;%0D%0A            c.gridwidth = GridBagConstraints.RELATIVE;%0D%0A            pane.add(textField, c);%0D%0A %0D%0A    %7D%0D%0A    %0D%0A%0D%0A    %0D%0A %0D%0A    private static void createAndShowGUI() %7B%0D%0A        //Create and set up the window.%0D%0A        JFrame frame = new JFrame(%22My First Calculator%22);%0D%0A        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);%0D%0A        addComponents(frame.getContentPane());%0D%0A        frame.pack();%0D%0A        frame.setVisible(true);%0D%0A    %7D%0D%0A%0D%0A    public static void main(String%5B%5D args) %7B%0D%0A        javax.swing.SwingUtilities.invokeLater(new Runnable() %7B%0D%0A            public void run() %7B%0D%0A                createAndShowGUI();%0D%0A            %7D%0D%0A        %7D);%0D%0A    %7D%0D%0A%7D

Add files via upload