This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
public class HappyOrSad extends JFrame implements ActionListener | |
{ | |
private JButton happyButton, sadButton; | |
private JPanel panel; | |
private ImageIcon happyImage, sadImage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
public class Movement extends JFrame | |
implements ActionListener { | |
private JButton upButton, downButton, rightButton, leftButton; | |
private JPanel panel; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
import javax.swing.event.*; | |
import java.util.*; | |
public class RandomMovement extends JFrame | |
implements ActionListener { | |
int xPos, yPos, direction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
import javax.swing.event.*; | |
import java.util.*; | |
public class RandomCircle extends JFrame | |
implements ActionListener { | |
int xPos, yPos, direction, distance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Money | |
{ | |
public String money(int totalCents) | |
{ | |
String ans = ""; | |
ans = ans + "[2 euro coins]: " + totalCents / 200 + "\n"; | |
ans = ans + "[1 euro coins]: " + (totalCents % 200) / 100 + "\n"; | |
ans = ans + "[50 cent coins]: " + (totalCents % 200 % 100) / 50 + "\n"; | |
ans = ans + "[20 cent coins]: " + (totalCents % 200 % 100 % 50) / 20 + "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
public class Safe extends JFrame implements ActionListener { | |
private JLabel greetingLabel; | |
private JTextField codeField; | |
private JButton button; | |
private JTextField outcomeTextField; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
import javax.swing.event.*; | |
public class Max extends JFrame implements ChangeListener, ActionListener { | |
private JSlider slider; | |
private JTextField textField; | |
private JButton button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Calendar | |
{ | |
private int[] monthDay = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
private String[] monthName = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; | |
public boolean leapYear(int year) | |
{ | |
boolean ans = false; | |
if(year % 4 == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Calendar | |
{ | |
private int[] monthDay = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
private String[] monthName = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; | |
private int day, month, year; | |
public Calendar(int d, int m, int y) | |
{ | |
year = y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Calendar | |
{ | |
private int[] monthDay = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
private String[] monthName = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; | |
private int day, month, year; | |
private int dayName; | |
public Calendar(int d, int m, int y) | |
{ | |
year = y; |
OlderNewer