Skip to content

Instantly share code, notes, and snippets.

import java.awt.*;
import javax.swing.*;
/**
*
* @author Cherubi
*/
public class LayoutBlockOut implements Runnable {
private JFrame kehys;
@Cherubi
Cherubi / AjastinKuuntelija.java
Created June 20, 2012 20:35
Graafinen käyttöliittymä
package swing;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
/**
*
* @author Cherubi
*/
import java.awt.event.*;
public class AjastimenKuuntelija implements ActionListener {
private Nopeustesti ohjelma;
public AjastimenKuuntelija(Nopeustesti ohjelma) {
this.ohjelma = ohjelma;
}
public void actionPerformed(ActionEvent tapahtuma) {
@Cherubi
Cherubi / Nappula.java
Created June 10, 2012 22:47
näkyvyysratkaisu
package nopeustesti;
import java.awt.Graphics;
import javax.swing.JButton;
public class Nappula extends JButton {
public Nappula(String teksti) {
super(teksti);
}
@Cherubi
Cherubi / Main.java
Created June 3, 2012 20:03
Tekoaly
import java.util.*;
public class Main {
public static Scanner input = new Scanner(System.in);
public static void opettaminen(OppivaTekoaly a, OppivaTekoaly b) {
// BEGIN SOLUTION
for (int i = 0; i < 100000; i++) {
int tikut = 99;
int valinta;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import fi.helsinki.cs.tmc.edutestutils.Points;
import fi.helsinki.cs.tmc.edutestutils.Reflex;
import fi.helsinki.cs.tmc.edutestutils.Reflex.ClassRef;
import fi.helsinki.cs.tmc.edutestutils.Reflex.MethodRef1;
import org.junit.AfterClass;
@Cherubi
Cherubi / requireMethod
Created May 31, 2012 19:43
MurtolukuTest.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import fi.helsinki.cs.tmc.edutestutils.Points;
import fi.helsinki.cs.tmc.edutestutils.ReflectionUtils;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import org.junit.AfterClass;
@Cherubi
Cherubi / NimenToistaminenTest
Created May 12, 2012 23:01
05 NimenToistaminen
import org.junit.Test;
import org.junit.Rule;
import static org.junit.Assert.*;
import fi.helsinki.cs.tmc.edutestutils.Points;
import fi.helsinki.cs.tmc.edutestutils.MockStdio;
@Points("1.5")
public class NimenToistaminenTest {
@Rule
@Cherubi
Cherubi / LukujenSummaTest
Created May 10, 2012 11:23
06 LukujenSumma
import org.junit.Test;
import org.junit.Rule;
import static org.junit.Assert.*;
import fi.helsinki.cs.tmc.edutestutils.Points;
import fi.helsinki.cs.tmc.edutestutils.MockStdio;
@Points("1")
public class LukujenSummaTest {
@Rule
@Cherubi
Cherubi / TervehtijäTest
Created May 10, 2012 10:28
Tervehtijä
import org.junit.Test;
import org.junit.Rule;
import static org.junit.Assert.*;
import fi.helsinki.cs.tmc.edutestutils.Points;
import fi.helsinki.cs.tmc.edutestutils.MockStdio;
@Points("1")
public class TervehtijaTest {
@Rule