Skip to content

Instantly share code, notes, and snippets.

@omatt
omatt / Colors
Created September 22, 2013 14:25
Set colors in Java using hex color codes. Generate hex color codes in here - http://hexcolorgenerator.com/
Color colorA = new Color(0xFF0096); // Use the hex number syntax
Color bColor = Color.decode("0xFF0096"); // or with the use of decode
object.setColor(Color.white);
setBackground(Color.white);
/** Alternatively using hex color codes to expand the color library **/
object.setColor(new Color(0xFF0096));
object.setColor(Color.decode("0xFF0096"));
@omatt
omatt / BufferedReader
Created September 22, 2013 09:53
Data readers
/** Java BufferedReader **/
import java.io.*;
// initialize class
{
public static void main(String [] args)throws IOException{
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String inputString = buffer.readLine();
int inputInt = Integer.parseInt(buffer.readLine());
@omatt
omatt / EncapsulationSample
Created September 19, 2013 06:40
Simple implementation of the Object Oriented Concept - Encapsulation
/**
* Sample for Object Oriented Programming Concepts
*
* Encapsulation
*
* @author Reyes, Omar Matthew B.
* @version 2013/09/07
*/
public class EncapsulationSample{
@omatt
omatt / TropoDataStorage
Last active December 16, 2015 04:29
Tropo Sample storing online accounts user data.
var askAccount = ask("What's the online account details that you want to know?You can select Facebook or Twiiter", {
choices: "facebook, twitter, github",
timeout: 20.0,
attempts: 3,
onBadChoice: function(askAccount) {
say("I'm sorry, I didn't understand that. You can select facebook or twitter.");
},
onChoice: function(askAccount) {
if(askAccount.value == "facebook"){
say("Your username is sample@facebook.com");