Skip to content

Instantly share code, notes, and snippets.

@ZCBML13
ZCBML13 / Assignment3
Created October 11, 2023 14:37
Assignment with Multiple Functions
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class Assignment3 {
public static void main(String[] args) {
@ZCBML13
ZCBML13 / JFrameCalculator.java
Created October 17, 2023 13:46
Calculator using JFrame
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class JFrameCalculator {
private JFrame frame; // The main application window
private JTextField textField; // Text field for displaying and inputting numbers and operators
private String currentInput = ""; // Stores the current input string
private double currentResult = 0.0; // Stores the current calculated result
@ZCBML13
ZCBML13 / Buttons1.java
Created October 25, 2023 14:02
Radius Calculator
import javax.swing.*;
import java.awt.event.*;
public class Buttons1 {
public static void main(String[] args) {
// Create a new JFrame (window) with the title "Circle Area Calculator"
JFrame frame = new JFrame("Circle Area Calculator");
// Set the default close operation to exit the application when the window is closed
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Set the initial size of the window to 300 pixels wide and 150 pixels tall
@ZCBML13
ZCBML13 / Buttons2.java
Created October 25, 2023 14:03
Rectangle Area Calculator
import javax.swing.*;
import java.awt.event.*;
public class Buttons2 {
public static void main(String[] args) {
// Create a JFrame (window) with the title "Rectangle Area Calculator"
JFrame frame = new JFrame("Rectangle Area Calculator");
// Set the default close operation to exit the application when the window is closed
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Set the initial size of the window to 300 pixels wide and 150 pixels tall
@ZCBML13
ZCBML13 / Buttons3.java
Created October 25, 2023 14:03
Message Printer
import javax.swing.*;
import java.awt.event.*;
public class Buttons3 {
public static void main(String[] args) {
// Create a JFrame (window) with the title "Personalized Message Generator"
JFrame frame = new JFrame("Personalized Message Generator");
// Set the default close operation to exit the application when the window is closed
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Set the initial size of the window to 400 pixels wide and 200 pixels tall
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.Random;
public class RPSGame {
private JFrame mainFrame;