Best Blogger Tips

Wednesday 3 October 2012

Running the first servlet program!

0 comments

This brief tutorial will help you in running your first Java Servlet. As java Servlets are server side programs that are compiled by a java compiler and the their class files are executed by a web browser.
So it would be your first question how can we execute that class file(Servlet's Bytecode) on a web browser by submitting a URL of that servlet name?Definitely it's very easy and straight forward.

To run a Servlet you must have a web container installed and configured in your computer. In case of java Servlets you must have a Tomcat installed in your computer.It is a java based web server founded by the Apache Organization.

Apart from this, you should also have the standard JDK installed on your local machine.
So first of all i will teach you how to install standard JDK and it's configuration on local machine.

Sunday 23 September 2012

TIC TAC TOE Game code in java!

0 comments
//code start
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;

public class TicTacToe implements ActionListener {
 final String VERSION = "1.0";
//Setting up ALL the variables
 JFrame window = new JFrame("Tic-Tac-Toe " + VERSION);
 
 JMenuBar mnuMain = new JMenuBar();
 JMenuItem  mnuNewGame = new JMenuItem("New Game"), 
     mnuInstruction = new JMenuItem("Instructions"),
     mnuExit = new JMenuItem("Exit"), 
     mnuAbout = new JMenuItem("About");
 
 JButton  btn1v1 = new JButton("Player vs Player"),
    btn1vCPU = new JButton("Player vs CPU"),
    btnBack = new JButton("<--back");
 JButton btnEmpty[] = new JButton[10];
 

DIGITAL CLOCK CODE IN JAVA!

0 comments

Synchronized digital clock.

//code Start
import java.awt.Color;
import java.awt.Dialog;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Label;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Calendar;
import java.util.Random;

import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;


public class DigitalClock extends JPanel implements Runnable {

 static JMenuBar mainBar;
 static JMenu open,about;
 static JMenuItem exit,aboutme;
 
 Thread t;
 Random rand = new Random();
 
 
 public void paintComponent(Graphics g){
  
  super.paintComponent(g);
  g.setFont(new Font("Serif",Font.BOLD,50));
  //g.setColor(new Color(rand.nextInt(255), rand.nextInt(255),rand.nextInt(255)));
  g.setColor(new Color((0), (0),(255)));
  g.drawString(time(), 27, 62);
 }
 
 //Constructor to INITIALIZE THE CLOCK
 public DigitalClock() {
  Start();//Start The CLock 
  }
 
 public String time() {
  Calendar cal = Calendar.getInstance();
  int hour = cal.get(Calendar.HOUR_OF_DAY);
  int min = cal.get(Calendar.MINUTE);
  int second = cal.get(Calendar.SECOND);
  
  String time = includeZero(hour)+":"+includeZero(min)+":"+includeZero(second);
  
  return time;
 }
 
 public String includeZero(int number){
  
  String num=(number < 10) ? ("0"+number) : (""+number);
  return num;
 }
 
 
 
 public static void main(String[] args) {
  JFrame.setDefaultLookAndFeelDecorated(true);
  try {
   UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
  } catch (Exception e) {
   // TODO: handle exception
  }
  
  
  SwingUtilities.invokeLater(new Runnable() {
   
   
   
   
   @Override
   public void run() {
    JFrame frame=new JFrame("Clock");
    
   
    
    
    frame.add(new DigitalClock());
    frame.setSize(250, 150);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.setResizable(false);
    
    mainBar = new JMenuBar();
    frame.setJMenuBar(mainBar);
    
    open = new JMenu("Open");
    mainBar.add(open);
    about = new JMenu("About");
    mainBar.add(about);
    exit = new JMenuItem("Exit");
    open.add(exit);
    aboutme = new JMenuItem("About me");
    about.add(aboutme);
    
    exit.addActionListener(new ActionListener() {
     
     @Override
     public void actionPerformed(ActionEvent arg0) {
      System.exit(0);
      
     }
    });
    
    
    aboutme.addActionListener(new ActionListener() {
     
     @Override
     public void actionPerformed(ActionEvent arg0) {
     JDialog dialog = new JDialog();
     dialog.setTitle("About Me");
     dialog.setVisible(true);
     dialog.setSize(400, 400);
     dialog.setLocation(790, 300);
     dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
     dialog.setLayout(null);
     Label label =new Label( "Created by : Zeeshan Jamal");
     label.setBounds(0, 0, 200, 20);
     
     dialog.add(label);
       
      
     }
    });
   }
  });
  
 
  
 }

 
 public void Start() {
 if (t==null){
 t= new Thread(this);
 t.start();
 
 
 }
 }
 public void run(){
  while (t == Thread.currentThread()){
   repaint();
   try {
    Thread.sleep(1000);
    
   } catch (Exception e) {
    System.out.println(e.getLocalizedMessage());
   }
  }
  
 }

}
//code end


Monday 17 September 2012

Cool Unsynchronized Code for a digital clock in java!

0 comments
java digital clock code
import java.awt.FlowLayout;
import java.awt.Font;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextField;


class clock extends JFrame
{
 int sec = 0;
    int min = 0;
    int hour = 0;
   
 
 public clock(){
  super("Clock");
  setVisible(true);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  setSize(90, 80);
  setLocationRelativeTo(null);
  setLayout(new FlowLayout());
  JTextField fr = new JTextField(10);
  
  fr.setFont(new Font("Serif",Font.BOLD,19));
  fr.setEditable(false);
  add(fr);
             for(hour=1;hour<24;hour++)
             {
                 for(min=0;min<60;min++)
                 {
                     for(sec=0;sec<60;sec++)
                     {
                      
                      
                         fr.setText("          "+hour+":"+ min+":"+sec);
                         try{Thread.sleep(1000);}
                         catch(Exception e){}
                       
                     }

                 }
             }

         
  
 }
 
 
 
    public static void main(String args[])
    {
     
     new clock();   
    }
}



Saturday 1 September 2012

Get Access to Weird SMS application for just 5$!

0 comments
This application is one amongst the best miracles in the cyber world. You would be wondering about what the heck is this stuff offering to cyber citizens that other SMS applications don't!
Take a break for a while, sit relax, and have patience! I will be telling you very shortly.
It is a massive fun for the pakistani citizens, because this application is developed in Pakistan and it is only accessible within Pakistan and few other Asian countries. This application is hosted on cloud and it's visitors are increasing rapidly. It is one of the best practical implementation of javascript and jsp technologies. Also includes other technologies like agax in traces.

What you can do with this site:

YES THIS IS THE BIGGEST QUESTION THAT EVERYONE WANTS TO ASK! I will go straightforward! YOU CAN SEND SMS TO ANY NUMBER (it's look common, because every free sms sending site sends sms to any number but take a look at next statement) FROM ANY NUMBER(Now that's look quite weird!:))YES FROM ANY NUMBER! EVEN FROM YOUR FATHER's NUMBER TO YOUR MOTHER's NUMBER, FROM YOUR FRIEND's NUMBER to Your FRIEND's NUMBER.HAHAHAH...QUITE EXCITING! HUH!...APSOLUTELY FREE

Get Access to the site:

Because of the current circumstances of the country! This site is posing the risk Because of the weird facility it provides! That's why i am giving away the for Only 5$ as terms and policies applied by the folks.

Thursday 23 August 2012

Color Code Generator

0 comments
Color Code Generator The two tools below will help you get the six digit color code i.e hexadecimal value. These tools will help you a lot in customizing your Blogger templates and for writing more appealing posts. Kindly Follow the instructions for each tool before using it.

Color Code Generator

Instructions:
  1. First drag the bar on the "Hue" selector to the area of your desired colour palate. 
  2. Then click inside the Brightness/Saturation area and drag the cursor until you have achieved your desired colour. The "Swatch" bar shows you the final colour result.
  3. The hexadecimal colour code is generated in the "Hex" box. Simply copy the six digit code i.e #000000
  4. That’s it!

Color Wheel For Choosing Matching Palate Colors

This is a pretty useful tool to achieve matching or cohesive colours for navigation menu, background, hyperlinks, header etc. Instructions:
  1. Simply paste the six digit colour code in the form below without the hash (#) sign and then hit Update
  2. The matching colour codes will appear inside the four boxes at the right side.
  3. You can then copy the hex values and start using them!

Tools by 2CreateAWebsite.com


Color Piker

0 comments
Color Picker

Hex code



Character Counter

0 comments
Character Counter plus free html code

Check Typing Speed:

To check typing speed, press the Start button and type. Find how many words you type for a minute. This is your WPM.

Count Characters:




Meta Tag Generator

0 comments
Meta Tag Generator plus free code

Free Meta Tag Tool

Title:
Description:
Keywords:



Monday 13 August 2012

Free Books

0 comments

Sunday 12 August 2012

Tutorials

0 comments
Following are some of the best web resources through you can learn to create dynamic websites and concurrent software applications:

Java Tutorials

  1. Thenewboston.org
  2. Creativity-tuts channel on youtube
  3. FireCat channel on youtube
  4. RoseIndia.com
  5. MrJavaHelp youtube channel

Web Development

  1. Thenewboston.org
  2. Learnerstv.com
  3. Lynda.com
  4. Tutorialspoint.com
 

| Bloggers Broadcast © 2010. All Rights Reserved | Back To Top |

Your Text Link Here