New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching language of Java
package controller;
 
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Enumeration;
 
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.JToggleButton;
Today @ 6:40am
Tags:
6 Views
no comments
 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class demoClassOne {
 
    private static String myString = null;
 
    public static void main(String args[]) {
        myString = getUserInput();
Today @ 5:26am
Tags:
5 Views
no comments
 
public void actionPerformed(ActionEvent arg0) {
        boolean fileExists = true;
        StringBuffer buffer = new StringBuffer();
 
        try {
            File datei = new File(SaveListener.FILEPATH, SaveListener.FILENAME + SaveListener.FILEEXTENSION);
            if (!datei.exists()) {
                fileExists = false;
                // Create new HamsterProgram.java
                parent.getSaveListener().actionPerformed(arg0);
Today @ 1:32am
Tags:
6 Views
no comments
 
package view;
 
import java.awt.Color;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
Today @ 1:27am
Tags:
6 Views
no comments
 
package de.ba.hamster.events;
 
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
 
import javax.swing.JTextPane;
Today @ 1:24am
Tags:
6 Views
no comments
 
import java.util.ArrayList;
 
 
public class demoClassOne {
    
    private static ArrayList<Integer> myList = new ArrayList<Integer>();
    private static Integer myStringAsInteger;
    
    public static void main(String args[])
    {
Yesterday @ 6:01am
Tags:
7 Views
no comments
 
//SimulationPressedListener.class
Enumeration<AbstractButton> tools = frame.getButtonGroup().getElements();
        while(tools.hasMoreElements()){
            AbstractButton curButton = tools.nextElement();
            if(curButton.getName().equals("wall") && curButton.isSelected()){
                territory.setWall(new Point(x,y));
            }else if(curButton.getName().equals("delete") && curButton.isSelected()){
                territory.deleteFieldItems(new Point(x,y));
            }else if(curButton.getName().equals("corn") && curButton.isSelected()){
                territory.incrFieldGrains(new Point(x,y));
Yesterday @ 5:26am
Tags:
8 Views
no comments
 
package versuch2;
 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
 
public class Namen implements Comparable<Namen>{
    private String name;
    private String vorname;
Wednesday @ 4:39am
Tags:
10 Views
no comments
 
package versuch2;
 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
 
public class NamensListe {
Wednesday @ 4:38am
Tags:
8 Views
no comments
 
import java.util.ArrayList;
 
 
public class demoClassOne {
    
    private static ArrayList<Integer> myList= new ArrayList<Integer>();
    private static Integer myStringAsInteger;
    
    public static void main(String args[])
    {
Wednesday @ 4:17am
Tags:
8 Views
no comments
 
Enumeration<AbstractButton> e = hamsterFrame.getButtonGroup().getElements();
        while(e.hasMoreElements()){
            AbstractButton curButton = e.nextElement();
            if(curButton.getName().equals("wall") && curButton.isSelected()){
                territory.addWall(new Point(x,y));
            }else if(curButton.getName().equals("clear") && curButton.isSelected()){
                territory.removeWall(new Point(x,y));
            }else if(curButton.getName().equals("corn") && curButton.isSelected()){
                
                territory.increaseGrains(new Point(x,y));
Tuesday @ 1:23am
Tags:
9 Views
no comments
 
import random
lifechance = .1 ## 10 % chance for life in square
board = []
for x in range (50):
    # '*' == life, '' == dead
    board.append(['*' if random.random()<lifechance else ''
                  for notcare in range(50)])
# make strings for lines replacing '' values (which are considered False) with ' '
print '\n'.join(''.join(life if life else ' '
                        for life in row)
by tonyjv   Monday @ 11:27pm
9 Views
no comments
 
/* Polish calculator.
 * Postfix expressions.
 */
 
import java.io.*;
 
class Stack
{
    private double array[];
    private int index;
by Angad   Sunday @ 5:37am
Tags:
12 Views
no comments
 
import java.net.*;
import java.io.*;
import java.util.Calendar;
import java.util.TimeZone;
 
public class Connect {
 
    public static void main(String[] argv) {
 
        String server_name = "irc.rizon.net";
by No   August 27, 2010 @ 8:37pm
Tags:
11 Views
no comments
 
package org.cafer.ws;
 
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
 
@Path("/test")
public class TestService {
    @GET
August 27, 2010 @ 2:34am
Tags:
10 Views
no comments
 
class While {
 
   public static void main (String args[]) {
    
     System.out.print("Hello while"); 
     int i = 0;  
     while (i < args.length) { 
       System.out.print(args[i]);  
       System.out.print(" ");
       i = i + 1;   
August 25, 2010 @ 9:13am
Tags:
17 Views
no comments
 
public class DummyGUI {
    Controller myController;
    
    public DummyGUI()
    {
        myController = new Controller();
        myController.AddMovie("First Movie", 90, 2011, Genre.DRAMA, Audio.DOLBYPROLOGICII, AspectRatio.ASPECT133);
        myController.AddMovie("Second Movie", 90, 2001, Genre.ACTION, Audio.STEREO, AspectRatio.ASPECT178);
        myController.AddMovie("Another Movie", 75, 2015, Genre.SCIENCEFICTION, Audio.DTS, AspectRatio.ASPECT185);
        myController.AddMovie("Yet Another Movie", 114, 2013, Genre.WAR, Audio.DOLBYSURROUND, AspectRatio.ASPECT185);
August 24, 2010 @ 2:11am
Tags:
16 Views
no comments
 
 
import java.util.Collection;
 
public class Model {
    private Collection<Movie>movies;
    
    public Model()
    {
    }
    
August 24, 2010 @ 2:10am
Tags:
17 Views
no comments
 
public class Movie {
    private String title;
    private int runtime;
    private int year;
    private Genre genre;
    private Audio audio;
    private AspectRatio aspectRatio;
 
    public Movie(String title_, int runtime_, int year_, Genre genre_, Audio audio_, AspectRatio aspectRatio_) {
        this.title = title_;
August 24, 2010 @ 2:09am
Tags:
17 Views
no comments
 
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
 
public class Controller implements IController {
    Model myModel;
    
    public Controller()
    {
        myModel = new Model();        
August 24, 2010 @ 2:09am
Tags:
15 Views
no comments
 
package org.cafer.ws;
 
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
 
import com.sun.jersey.spi.inject.Inject;
import org.cafer.controllers.HelloControllerImpl;
import javax.ws.rs.PathParam;
August 23, 2010 @ 12:20pm
Tags:
17 Views
no comments
 
 
 
import java.awt.Color;
import org.rsbot.script.methods.Camera;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
August 22, 2010 @ 8:16am
Tags:
17 Views
no comments
 
import javax.swing.*;
import java.awt.*;
 
public class Gui {
    /**
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
     */
    private static void createAndShowGUI() {
August 17, 2010 @ 11:00am
Tags:
15 Views
no comments
 
public static void bindNodeBuffer(RenderNode node, GL10 gl) {
   
   if (node.isBuffersBound())
      return;
   
   if (gl instanceof GL11) {
      GL11 gl11 = (GL11) gl;
      int[] buffer = new int[1];
 
      // Vertex Buffer
August 16, 2010 @ 8:20am
Tags:
19 Views
no comments
 
package gui;
 
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
 
import javax.swing.JButton;
import javax.swing.JFrame;
August 10, 2010 @ 5:13am
Tags:
16 Views
no comments
 
brought to you by:
West Wind Techologies


If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate