Saturday, October 29, 2011

What should I do? after download eclipse indigo

1. extract file or  Unzip the downloaded file to C:\Program Files or other patch.
2. Create Shortcut or if you using windows 7 pin to start menu 
3. Run eclipse ,


  Then   set the default installed JRE to Java 1.6 :
  •   Open the Eclipse Preferences Pane (Window -> Preferences) and go to the Java >> Installed JREs subpane.
  • Check the JRE 1.6.0_<version> as the default (where <version> is a two digit number representing the version number that you downloaded and installed). Click OK to save the settings.
 Then test the eclipse by creating project New->Project, create the class New -> Class , name the class myapp. copy this code to eclipse

public class myapp {

  public static void main(String[] args) {

      System.out.println("My first application");
  }
}



 Save then run the program , if succes now you can use it to coding.

Friday, October 28, 2011

Create mobile application with J2ME : FillRoundRect


The rectangular shape is definitely an part of the canvas described through 4 corners , as being a rectangular shape that you could pull utilizing document as well as pen. You define a rectangle’s dimensions by identifying coordinates for the upper-left corner and the lower-right corner. Four types of rectangles can be drawn on a canvas.

They are a good layed out rectangular shape, stuffed rectangular shape, layed out rectangular shape along with curved edges, along with a stuffed rectangular shape along with rounded corners.

An outlined rectangle is one where only line segments connecting the corners are drawn. The inside of the rectangle remains the same color as the outside of the rectangle. 
FillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
 Returns FillRoundRect by rounded rectangle 


example code :
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

/**
 * @author 1code
 */
public class fill extends MIDlet {
    private Write canvas;
     Display display;

    public void startApp() {
       display = Display.getDisplay(this);
       canvas = new Write(this);
       display.setCurrent(canvas);

    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}

class Write extends Canvas  {
     fill midlet;
    private final fill This;

    public Write(fill This) {
        this.midlet= midlet;
      this.This = This;
    }

    protected void paint(Graphics drwa) {
        drwa.setColor(255,255,255);  //the background
    drwa.fillRect(0,0,getWidth(),getHeight());
//fill background
drwa.setColor(0,0,255);
        drwa.fillRoundRect(getWidth()/5, getHeight()/4, getWidth()/6, getHeight()/2, 7, 10);

        drwa.setColor(254,0,255);
        drwa.fillRoundRect(getWidth()/2, getHeight()/4, getWidth()/6, getHeight()/4, 180, 360);
      
    }

 

Create mobile application with J2ME : line Canvas

Any canvas-based graphical user interface contains instances of the particular Canvas school inside of which usually the particular designer generates photos for instance people found in a  game. On this phase you’ll understand in regards to the Control class and stay released to be able to varieties. The canvas is divided into a virtual grid in which each cell represents one pixel. Coordinates mark the column and row of a cell within the grid . The x coordinate represents the column, and the y coordinate represents the cell’s row. The first cell located in the upper-left corner of the grid has the coordinate location of 0, 0, where the first zero is the x coordinate and the other zero is the y coordinate.

Low  lets coding , i will create simple line with canvas.
import the package ;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.*;



Or import all package from icdui
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;


Create Class

public class line extends MIDlet {
    private Write canvas;
     Display display;
    public void startApp() {
       display = Display.getDisplay(this);
       canvas = new Write(this);
       display.setCurrent(canvas);  
    }
    public void pauseApp() {
    }
    public void destroyApp(boolean unconditional) {
    }
}


Create class for drawing

class Write extends Canvas  {
     line midlet;
    private final line This;

    public Write(line This) {
        this.midlet= midlet;
      this.This = This;
    }

    protected void paint(Graphics drwa) {
        drwa.setColor(255,255,255);
    drwa.fillRect(0,0,getWidth(),getHeight());
        drwa.setColor(0,0,0);
        drwa.drawLine(getWidth(), getHeight(), 0, 0);
        drwa.setColor(255,0,0);
        drwa.drawLine(getWidth(), 0, 0, getHeight());
    }

Open Source IDE : KDevelop

KDevelop is a free software integrated development environment (IDE) for the KDE Platform on Unix-like computer operating systems. KDevelop is a cross platfrom IDE , can run in MS Windows, Mac OS X, Linux, Solaris and FreeBSD.

It is a feature-full, plugin extensible IDE for C/C++ and other programming languages. KDevelop includes no compiler.  As a substitute, the item works by using a additional compiler like gcc to provide executable value.
The current version, 4.2, was officially released on 27 January 2011. It builds on KDE 4 technology and supports C, C++ and PHP development.

The last stable release from the prior main edition, 3. 5. 5, that is dependant on K Desktop Environment 3 technology, facilitates numerous encoding 'languages' for example Ada, Party, D, C++, Fortran, Espresso, Pascal, Perl, PHP, Python as well as Dark red. Launched underneath the GNU Public Permit, KDevelop is actually free of charge software program.

Features
  • Display problems in source-code
  • Show information about declarations (classes, functions, templates...) in libraries and your application
  • Intelligent auto-completion showing those methods which could be used in the current context including their signature and documentation
  • Show usages of declarations/rename them
  • Context-specific highlighting
  • Debugging using gdb
  • SVN integration
  • Manage CMake-targets and build them
  • CMake-auto-completion showing defined macros and variables
  • Kate-integration
  • Custom makefiles
  • C++-specific:
    • Consideration of Qt's signals and slots by the auto-completion
    • Qt-Documentation
    • Unroll constants and typedefs (partial)
    • Create class dialog, which allows to select those methods which should be overloaded
  • PHP-specific:
    • Guess the type of variables
    • Show documentation from php.net
  • Experimental:
    • QtDesigner support
    • Valgrind
    • xdebug (PHP-debugger)
    • Unit testing
    • Java, C#, CSS and XML support
    • Mercurial support

Open Source IDE : Eclipse

Eclipse is an open source community, whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.

The Eclipse Foundation is a not-for-profit, member supported corporation that hosts the Eclipse projects and helps cultivate both an open source community and an ecosystem of complementary products and services.

Eclipse is often a multi-language software package development environment containing an integrated development environment (IDE) along with the extensible plug-in .  It is written mostly in Java and can be used to develop applications in Java and, by means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Perl, PHP, Python, R, Ruby (including Ruby on Rails framework), Scala, Clojure, Groovy and Scheme.



It can also be used to develop packages for the software Mathematica. The IDE is often called Eclipse ADT (Ada Development Toolkit) for Ada, Eclipse CDT for C/C++, Eclipse JDT for Java, and Eclipse PDT for PHP.

Eclipse was originally released under the Common Public License, but was later relicensed under the Eclipse Public License. The Free Software Foundation has said that both licenses are free software licenses, but are incompatible with the GNU General Public License (GPL). Mike Milinkovich, of the Eclipse Foundation commented that moving to the GPL would be considered when version 3 of the GPL was released.[

Open Source IDE : NetBeans


The NetBeans IDE is an open-source Integrated Development Environment, a free open-source Integrated Development Environment for software developers. All the tools needed to create professional desktop, enterprise, web, and mobile applications with the Java platform, as well as with C/C++, PHP, JavaScript and Groovy.

The NetBeans IDE is written in Java and can run anywhere a compatible JVM is installed, including Windows, Mac OS, Linux, and Solaris. A JDK is required for Java development functionality, but is not required for development in other programming languages.

NetBeans IDE supports development of all Java application types (Java SE including JavaFX, (Java ME, web, EJB and mobile applications) out of the box.

The philosophy behind Netbeans is to provide an extensible IDE that provides all the tools necessary to develop desktop, enterprise, web and mobile applications. The ability to install plug-ins allows developers to tailor the IDE to their individual development tastes.

This bundle includes:

    NetBeans Base IDE
    Java SE, JavaFX
    Web and Java EE
    Java ME
    C/C++
    PHP (Version 6.5 and later)
    GlassFish
    Apache Tomcat

License: From July 2006 through 2007, NetBeans IDE was licensed under Sun's Common Development and Distribution License (CDDL), a license based on the Mozilla Public License (MPL). In October 2007, Sun announced that NetBeans would henceforth be offered under a dual license of the CDDL and the GPL version 2 licenses, with the GPL linking exception for GNU Classpath

via  wikipedia , about.com

Thursday, October 27, 2011

Java JFrame Basic Tutorial : Video

The Frame describes the visual interface (GUI) component which is a top level window with a title and a border. The Frame that is put in place like a JFrame item , will often possess adornments like a edge along with a name. Apart from which, the actual JFrame item additionally facilitates control keys items that are accustomed to near or even iconify the actual eye-port. The actual edge region that's contained in the general dimension from the frame could be determined while using getInsets technique. A minumum of one body is usually contained in the GUI dependent software.

Following are the constructors used in creating JFrame components:-
1) JFrame()
which creates a new frame that is initially invisible. 
2) JFrame(GraphicsConfiguration gc)
which  creates a Frame in the specified GraphicsConfiguration of a screen device with a blank title. 
3) JFrame(String title)
which   creates a new, initially invisible Frame with the specified title. 
4) JFrame(String title, GraphicsConfiguration gc)
which creates a JFrame with the specified title and the specified GraphicsConfiguration of a screen device. 

This is best video tutorial JFrame basic , all tutorial using eclipse.

 






Tuesday, October 25, 2011

Add Ruby/Ruby on Rails Applications on netbeans


To do, the best stimulating innovative aspect with NetBeans 6 is definitely it has the aid to Ruby and the ruby for Rails framework. I actually lagged slightly together with the company of your step, ever since the not one but two job styles will be rather particular. With me they’re analogous to java application like ruby and
Web Framework (Ruby on Rails).

 Bring JRuby to your merge plus a large e book may possibly without difficulty (plus
could at some time) often be focused upon just simply the topic  ruby and Ruby on Rails, and NetBeans.

I actually was visiting explore ruby and Ruby on Rails when split themes.
Having said that, this can be suitable echoing a lot information and facts (updating, evaluating, et cetera). Hence, right after a DRY UP (really don't recurring you) guideline, I’ve resolved to talk about a things about ruby and Ruby on Rails, along, primarily considering Ruby and Ruby on Rails really is a little superset with Ruby—nearly anything you can use around ruby you can use around Ruby on Rails.


 I can expect for you to actually have a familiarity with Ruby and the Ruby on Rails framework.

• Learn how to get ruby aid around NetBeans
• Building, updating, evaluating, debugging, and going Ruby and the Ruby on Rails project
• Dealing with RubyGems and Rails plug ins
• IRB as well as Rails  console
• JRuby.



  1. Open the Plugin Manager by navigating to Tools ä Plugins.
  2. Select the Available Plugins tab and click the “Category” column header to sort the list.
  3. Select the check box next to the Ruby modules of interest. At a minimum, you will need “Ruby and Rails,” which provides all of the NetBeans support for Ruby and Ruby on Rails (projects, editing, and so on). 
  4. Unless you already have a Ruby or JRuby runtime installed, you will also want to select the “JRuby on Rails Distribution.” All of the other plugins in the Ruby category are optional (Depot Sample, Color Themes, and so on), but there’s really no reason not to install them as well.
  5. Click the Install button to launch the Plugin Installer.
  6. Accept the license and click Install to complete the Installation.

Sunday, October 23, 2011

Create simple application with netbeans : jMenuBar

This Application is example change a font in textfield with jMenu.
Creating the Project
You can create the project by performing the following steps:
1. Select File a New Project from the main menu.
2. In the New Project window, select Java from the Categories list and Java Application
from the Projects list. Click the Next button to continue.
3. In the Name and Location screen, enter a value for the “Project Name” field.
4. Next, select a value for the “Project Location” field by using the Browse button.
5. Finally, uncheck the “Create Main Class” field.

Creating JFrame Class
To add a Java JFrame class, do the following:
1. In the Projects window, right-click the Source Packages node and select New ä Other
    from the context menu.
2. In the New File window, select Swing GUI Forms from the Categories list on the left and
    JFrame Form from the File Types list on the right. Click the Next button to continue.
3. In the Name and Location screen, enter a value for the “Class Name” field..
4. Next, enter a Java package hierarchy in the “Package” field.
5. Finally, click the Finish button to generate the class. It will open in the Form Editor (a
    special GUI editing tool discussed in the next few sections).

Saturday, October 22, 2011

Create simple registration form : AJAX


Create  a Form and AJAX

 Create simple registration form (Name, Address, City , Telp , Email). All input required, AJAX  will return a response used to display success , error messages.  Multi-field registration form will submit with Ajax

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>AJAX Form</title>
<script type="text/javascript" src="jquery-1.2.3.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {


    $().ajaxStart(function() {
        $('#loading').show();
        $('#result').hide();
    }).ajaxStop(function() {
        $('#loading').hide();
        $('#result').fadeIn('slow');
    });


    $('#myForm').submit(function() {
        $.ajax({
            type: 'POST',
            url: $(this).attr('action'),
            data: $(this).serialize(),
            success: function(data) {
                $('#result').html(data);
            }
        })
        return false;
    });
})
</script>
<style type="text/css">
body, table, input, select, textarea { font: 11px/20px Verdana, sans-serif; }
h4 { font-size: 18px; }
input { padding: 3px; border: 1px solid #999; }
td { padding: 5px; }
#result { background-color: #F0F1EE; border: 1px solid #215800; padding: 10px; width: 400px; margin-bottom: 20px; }
</style>
</head>
<body>
<h4>SIMPLE AJAX Form</h4>
<div id="loading" style="display:none;"><img src="loading.gif" alt="loading..." /></div>
<div id="result" style="display:none;"></div>
<form id="myForm" method="post" action="proses.php">
    <table>
        <tr>
            <td width="100">Name</td>
            <td>
                <input name="name" size="30" type="text" />
            </td>
        </tr>
        <tr>
            <td>Address</td>
            <td>
                <input name="address" size="40" type="text" />
            </td>
        </tr>
        <tr>
            <td>City</td>
            <td>
                <input name="city" size="40" type="text" />
            </td>
        </tr>
        <tr>
            <td>Telp</td>
            <td>
                <input name="no_telp" size="30" type="text" />
            </td>
        </tr>
        <tr>
            <td>E-mail</td>
            <td>
                <input name="email" id="email" size="30" type="text" />
            </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <input type="submit" value="Submit" />
                <input type="reset" value="Reset" />
            </td>
        </tr>
    </table>
</form>
</body>
</html>


Create PHP script for form processing


<?php
if (trim($_POST['name']) == '') {
    $error[] = '- The name field is required.';
}
if (trim($_POST['address']) == '') {
    $error[] = '- The address field is required.';
}
if (trim($_POST['city']) == '') {
    $error[] = '- The city fields is required';
}
if (trim($_POST['telp']) == '') {
    $error[] = '- Telp fields is required';
}
if (trim($_POST['email']) == '') {
    $error[] = '- Email fields is required';
}


if (isset($error)) {
    echo '<b>Error</b>: <br />'.implode('<br />', $error);
} else {
    /*
    insert SQL Query here
    */

    $data = '';
    foreach ($_POST as $k => $v) {
        $data .= "$k : $v<br />";
    }

    echo '<b>Form successfully submited:</b><br />';
    echo $data;
}
die();
?>

create simple application with netbeans : CheckBox


Create a JFrame container
  1. In the Projects window, right-click the your project node and choose New > JFrame Form.
  2. Enter firscheckbox as the class name.
  3. Enter default package as the package.
  4. Click Finish.

Adding ComponentsNow you have JFrame Form.  Then  add three components three JLabels, two JChecBox, and one  JTextField.
  1.  Use  Event : StateChanged . Right click on the jCheckBox and click events >Action >Change >StateChanged
  2. Use isSelected() , if a checkbox is checked then result will be show  in JTextField.

This is complete script

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * cek.java
 *
 */

/**
 *
 * @author 1code
 */
public class cek extends javax.swing.JFrame {

    /** Creates new form cek */
    public cek() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jLabel3 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Chiller", 1, 14)); // NOI18N
        jLabel1.setText("Example code");

        jLabel2.setText("packet");

        jCheckBox1.setText("packet 1");
        jCheckBox1.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jCheckBox1StateChanged(evt);
            }
        });

        jCheckBox2.setText("packet 2");
        jCheckBox2.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jCheckBox2StateChanged(evt);
            }
        });
        jCheckBox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox2ActionPerformed(evt);
            }
        });

        jLabel3.setText("TOTAL");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel1)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jCheckBox2)
                            .addComponent(jCheckBox1))))
                .addContainerGap(262, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(jLabel1)
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jCheckBox1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jCheckBox2)
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(132, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                       

    private void jCheckBox1StateChanged(javax.swing.event.ChangeEvent evt) {                                       
        // TODO add your handling code here:
        if(jCheckBox1.isSelected()==true && jCheckBox2.isSelected()==false
                ||jCheckBox1.isSelected()==false && jCheckBox2.isSelected()==true)
        {
            jTextField1.setText("15.000");
        }
        else if(jCheckBox1.isSelected()==true && jCheckBox2.isSelected()==true)

        {
            jTextField1.setText("25.000");
        }
        else
        {
            jTextField1.setText("Rp.0.000");
        }
    }                                      

    private void jCheckBox2StateChanged(javax.swing.event.ChangeEvent evt) {                                       
        // TODO add your handling code here:
        if(jCheckBox1.isSelected()==true && jCheckBox2.isSelected()==false
                ||jCheckBox1.isSelected()==false && jCheckBox2.isSelected()==true)
        {
            jTextField1.setText("15.000");
        }
        else if(jCheckBox1.isSelected()==true && jCheckBox2.isSelected()==true)

        {
            jTextField1.setText("25.000");
        }
        else
        {
            jTextField1.setText("0.000");
        }
    }                                      

    private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                         

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new cek().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                    
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration                  

}

Friday, October 21, 2011

Comparison java and c++/c

Java is directly related to both C and C++. Java inherits its syntax from C. Its object model is adapted from C++. Java’s relationship with C and C++ is important for several reasons. First, many programmers are familiar with the C/C++ syntax. This makes it easy for a C/C++ programmer to learn Java and, conversely, for a Java programmer to learn C/C++. Second, Java’s designers did not “reinvent the wheel.” Instead, they further refined an already highly successful programming paradigm.

Many developers already have experience with an object-oriented programming language like C++. As you make the transition to Java, you will encounter many differences, despite some strong similarities.

Design java and c++  (via wikipedia)

The differences between the C++ and Java programming languages can be traced to their heritage, as they have different design goals.
  • C++ was designed for systems and applications programming, extending the C programming language. To this procedural programming language designed for efficient execution, C++ has added support for statically-typed object-oriented programming, exception handling, scoped resource management, and generic programming, in particular. It also added a standard library which includes generic containers and algorithms.
  • Java was created initially as an interpreter for printing systems but grew to support network computing. Sun Microsystems used it for the basis of their "HotJava" thin client system. It relies on a virtual machine to be secure and highly portable. It is bundled with an extensive library designed to provide a complete abstraction of the underlying platform. Java is a statically-typed object-oriented language that uses a syntax similar to C++, but is not compatible with it. It was designed from scratch with the goal of being easy to use and accessible to a wider audience.
 see other comparation java benchmark

The modern age of programming began with C. It moved to C++, and now to Java. By inheriting and building upon that rich heritage, Java provides a powerful, logically consistent programming environment that takes the best of the past and adds new features required by the online environment. Perhaps most important,
because of their similarities, C, C++, and Java define a common, conceptual framework for the professional programmer. Programmers do not face major rifts when switching from one language to another.

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes