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;
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();
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);
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;
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;
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[]) {
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));
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;
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 {
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[]) {
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));
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)
9 Views
no comments
/* Polish calculator. * Postfix expressions. */ import java.io.*; class Stack { private double array[]; private int index;
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";
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
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;
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);
16 Views
no comments
import java.util.Collection; public class Model { private Collection<Movie>movies; public Model() { }
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_;
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();
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;
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;
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() {
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
19 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
