Java Code Snippets

Feb 28, 2013
Simple Code
Dec 20, 2012
This snippet constructs a JButton whose color fades in to black when hovered and fades out to a light grey when the mouse leaves it. I mainly use it as a close button, hence its name. All..
3 comment(s)  ·   ·  Java Snippet
Dec 14, 2012
Java code to read cookies, part of my WebAdmin project at BMT ARGOSS. The cookies are set in the frontend of this web tool using javascript, the cookie includes which Database an user..
2 comment(s)  ·   ·  Java Snippet
Nov 22, 2012
The first method, toLong(String), will convert the provided ip address to its long format. For instance, invoking toLong("255.255.255.255") will return 4294967295 whereas the second..
1 comment(s)  ·   ·  Java Snippet
Nov 14, 2012
Editing the Windows Registry for whatever reason can be a tricky task using Java since it doesn't technically run in the OS environment, rather than a virtual machine. This makes accessing..
3 comment(s)  ·   ·  Java Snippet
Oct 08, 2012
This snippet connects to a server and port of your choice and reads input. It does not handle output: you will have to do it yourself. An example will be provided in this description. What..
6 comment(s)  ·   ·  Java Snippet
Sep 14, 2012
This is a Java applet. Move your mouse around to create particles of random colors. To run this snippet, you can either load it into an IDE of your choice or embed it into a webpage using..
Sep 13, 2012
This is mainly for local use, to deter anyone or anything from plainly viewing any sensitive information you may have stored in files or what not. I mainly use it to encode passwords for..
Sep 12, 2012
The following snippet returns the shorthand of the given value. Examples: shorthand(1234567, 0, false); 12M shorthand(1234567, 2, false); 12.35M shorthand(1234567, 2, true); 12.34M shorthand(1234567,..
Jul 10, 2012
Hawkee seems to be a little lack luster lately, and with my lack of development lately I figured I'd toss in a small snippet I made to make handling files easier. Java can be somewhat difficult..
0 comment(s)  ·   ·  Java Snippet
May 16, 2012
I had convert() as a static method before, but I've changed it prior to uploading. The computer I'm on doesn't have any IDE and I can't be bothered compiling and running through a CLI, so..
May 01, 2012
Working on a project recently, I came across the need for an array that could dynamically adjust its size for a fluctuating capacity. This is a neat little snippet that can very easily change..
4 comment(s)  ·   ·  Java Snippet
Mar 07, 2012
In an attempt to cut down in the amount of regex, I decided to make Java replicas of mIRC's token identifiers. This is intended to be integrated as a package to be referenced using Java's..
7 comment(s)  ·   ·  Java Snippet
Dec 13, 2010
meh just a snake game....i made this like a year ago when i was just learning java ;p i was bored and saw no one has posted one so i figure i'll post the first one. :) *known bugs:..
7 comment(s)  ·   ·  Java Snippet
Nov 12, 2010
Basically demonstrates mouse events within an applet, continuously draws cross hairs to pinpoint the mouse's coordinates. Clicking and dragging creates a new set of coordinates on which..
4 comment(s)  ·   ·  Java Snippet
Jul 22, 2010
create a maplet class and get URL parameter and put them in database by using JDBC and sql .maplet is a framework base on MVC. It make project shorter and cleaner. Since you dont need to..
Jun 07, 2010
Haven't posted a snippet in awhile so decided id use a common idea and try to write it in another language Im new to java so any advice or different approaches to go about it is appreciated To..
Feb 24, 2010
Hey guys, it's WP (Wariopower). I've been posting numerous mIRC Snippets for a while so I decided to post a snippet for the first time in a different language; that being Java. So, this..
Oct 03, 2009
Level up in this fun game. Create a character and you're good to go! Iron sword does nothing but heal potion heals you.. for 20. So yeah.. you can save/load your progress. Earn exp and..
8 comment(s)  ·   ·  Java Snippet
Aug 03, 2009
This is a generic socket server. Now, it's not documented very well, but I'll explain things you can change here. I am working on fixing this.
2 comment(s)  ·   ·  Java Snippet
Jul 16, 2009
This is a Swing java program that uses the
14 comment(s)  ·   ·  Java Snippet
Jul 02, 2009
Just an idea I got from another post on this site, and remade it myself. Suggestions? Comments? Thanks!
May 30, 2009
This is my final project for APCS (Advanced Placement Computer Science). It's currently unfinished, we (my partner and I) still need to add a crash sequence as well as some modifications..
28 comment(s)  ·   ·  Java Snippet
Apr 15, 2009
This is a BreakOut game made in Java. You start off by hitting "Play Game" and then click to release the ball. The more bricks you hit, the more points you get. as long as..
10 comment(s)  ·   ·  Java Snippet
Apr 10, 2009
This is a Pong game applet that I made in Java. It's player vs. computer, and the computer never loses. You just move the mouse up and down to control your paddle. I'd like to figure..
11 comment(s)  ·   ·  Java Snippet
  1. 1
  2. 2
  3. Next
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.