Student Of Fortune
Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Free Download Software JCreator Pro v.5.00, JCreator Le v.5.00

JCreator is the development tool for every programmer that likes to do what he does best: programming. It is faster, more efficient and more reliable than other Java IDE. Therefore, it is the perfect tool for programmers of every level, from learning programmer to Java-specialist.

JCreator provides the user with various functions such as: Project management, project templates, code-completion, debugger interface, editor with syntax highlighting, wizards and a fully customizable user interface

Some Features of  JCreator :
  • Manage projects easily in an interface much like Microsoft Visual Studio.
  • Define your own color schemes in XML for unlimited ways to organize your code.
  • Use JCreator to wrap around existing projects and use different JDK profiles.
  • Get to writing code quickly with our project templates.
  • Want to see your project easier with our class browser. 
  • etc 
Download JC creator Here
Server1

Follow the instructions

Java Tips- Array With Java

Array is one type of data that consists of several elements or a set of values from a set of similar variables. For more details, see the following program code:
See The Code :
public class InitArray
  {
     public static void main( String args[] )
     {
        int array[] = new int[ 10 ];

        System.out.printf( "Index\tValue" );

        for ( int counter = 0; counter < array.length; counter++ )
  {
   System.out.printf( counter + “\t”+array[ counter ]);
  }
     }
  }
So after we compile will generate output like this:
See The Output Code :
Index  Value
    0      0
    1      0
    2      0
    3      0
    4      0
    5      0
    6      0
    7      0
    8      0
    9      0 
The above example is an array that has not been rated yet, so any index in the array will contain the value 0 by Java, well then we will discuss about how to assign values to the array, consider the example program below:
Se e The Code :
public class InitArray
  {
     public static void main( String args[] )
     {
        int array[] = { 32, 27, 64, 18, 95, 14, 90, 70, 60, 37 };

        System.out.printf( "Index\tValue" );

        for ( int counter = 0; counter < array.length; counter++ )
 {
           System.out.printf( counter + “\t”+array[ counter ]);
 }
     }
  }
So when we compile, the output array is no longer value 0, because already we fill the value in it, note the following output:
See The Output Code : 
Index  Value
    0     32
    1     27
    2     64
    3     18
    4     95
    5     14
    6     90
    7     70
    8     60
    9     37
Hopefully Useful

Java Tips- Method With Java

Method
Method in java is a way to break the program into several parts, so when working on these programs can do the division of duties among several individuals. When we've developed courses in a large scale then we need to use the name method. For more details, see the following programs:

See The Code :
public class Main
{
    public static void main(String[] args)
    {
        Print();
    }
    static void Print()
    {
        System.out.println("Print method successfully for Called!");
    }
}
See this Code
static void Print()
The above code is a useful methods to print the string "Print method successfully for Called!". Where methods is invoked on the Print (); Static keyword here is necessary because methods is located in the main class that also be static, so the methods should be static methods.
 
Keyword void is one indication that this methods does not return any value, for methods that return a specific value will be discussed later.
There was also the methods that has a return value, or return value, as an example consider the program to find the integer value of the square.
See The code :
public class Main
{

    public static void main(String[] args) {
        System.out.println( Square(5) );
    }
    static int Square(int a)
    {
        return a * a;
    }
} 

Readers-Writers problem In Java

Readers-Writers problem is a classic problem of synchronization. The solution to this problem needed to be able to maintain data consistency.

Many threads can share the same storage resources. There is a thread that read, there is also a write. Thread a reading called readers (reader), while the write-called writers (authors).

If more than one thread accessing the same data at a time, data corruption can occur. Conditions that must be met to prevent data corruption are:

1. A data object can be read by multiple threads simultaneously.
2. A data object that is being written by a thread can not be shared access to other threads that both readers and writers.

Download tutorial code here

Bounded-Buffer Problem In Java

Source code is the implementation of bounded-Buffer Problem (Producer Consumer Problem).Source code is programmed using Java programming language.Bounded buffer is a container for data whose size is limited, for example in the process of producers and consumer. Some producer-consumer problem:producers put the data in the buffer. If the buffer is already fully charged, thenproducers did not do nothing and wait until the consumer to empty the contentsbuffer and consumers take data from the buffer. If the buffer is empty,then the consumer does not do anything and wait until the buffer is filled by the manufacturers. Please download the tutorial code below.

Download tutorial code here

Tic tac toe Game Program With Java

This request friends who want to understand to make tic tac toe game using java. yesterday we had to make tic tac toe game in C / C + +. may be useful for friends to Soure code please download below.

download tutorial code here

Create a Textbox / Messages With Java

Create a textbox / messages with Java. simple java program in the language used to complete the report and hopefully my task was helped by friends that I made a program but do not forget to comment!

meth fight

download tutorial code here

Learning to Use Classes In Java

This is a simple program about how where we use the class of our own making and where we learn how to use static / instance variables, static / instance method, and we introduce a method name overloading, the same method but different abilities. Thanks already download this simple program.


Download tutorial code here

Hours to Seconds Conversion Program java language

It's a simple program example how we count the hours, minutes and seconds into second overall / total second, the main core of this program is as never before we bs utilize methods that derive our artificial class. Hopefully useful. Do not forget to comment

download tutorial code here

Calculating Program Employees With Java Salaries

This is a simple program using swing method ". This program was created to calculate the salary of employees, the contents of which have working group, calculates Overtime Allowance, meal, allowances dll.tp do not forget to comment.

Download tutorial code here

Sample Multiple Selection List Program In Java

Examples The following Java program is a variation of the previous lists program examples. In this program, a list was made in order to be selected more than one option.

Here is the view the program:

contoh-program-multiple-list-java

Here is the program :

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MultipleSelectionTest extends JFrame {
 private JList lstColor, lstCopy;
 private JButton btnCopy;
 private final String arrColorName[] =
  { "Black","Blue","Cyan","Dark Gray","Gray","Green","Light Gray",
    "Magenta","Orange","Pink","Red","Yellow","White"
  };

 public MultipleSelectionTest() {
  super ("Multiple Selection List");  

  Container container = getContentPane();
  container.setLayout(new FlowLayout());

  lstColor = new JList (arrColorName);
  lstColor.setVisibleRowCount(5);
 lstColor.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  container.add(new JScrollPane (lstColor));

  btnCopy = new JButton ("Copy >>>");  

  btnCopy.addActionListener(
   new ActionListener() {
   public void actionPerformed (ActionEvent e) {
   lstCopy.setListData(lstColor.getSelectedValues());
    }
   } //end of class
  );

  container.add(btnCopy);  

  lstCopy = new JList();
  lstCopy.setVisibleRowCount(5);
  lstCopy.setFixedCellHeight(15);
  lstCopy.setFixedCellWidth(100);
 lstCopy.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
  container.add(new JScrollPane(lstCopy))  

  setSize (400,300);
  setLocationRelativeTo(null);
  setVisible(true);
 }

 public static void main (String args[]) {
     MultipleSelectionTest test = new MultipleSelectionTest();
     test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}

Learning Java Programming "Hello World"

The first step before starting to learn coding to make the program, usually the first dumulai should I write the word, which is usually in a programming language called "Hello word".

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

/**
*
* @author Ecko Zulkaryanto
*/
public class Hello {

/**
* @param args the command line arguments
*/
        public static void main(String[] args) {
                 // TODO code application logic here
                 System.out.print(”\n\t\tThis is Java Programming Language\n”);
                 System.out.println(”\t\t Welcome to Java Programming”);
        }
}

If you've ever learned C / C + + usually understand coding directly above. For the new in java, install JDK first, then can compile and run / running this code. after the install and make his path, compile this program on the console or command prompt (type in start menu> run> type "cmd"> enter). then go to the directory on coding files that already given the name "Hello.java". to compile type the command "javac Hello.java" and for running type the command "java Hello". More easy to use compilers, ex: "NetBeans", can also peke eclipse, or the more easily use jcreator.

Example Program Setting Frame Display With Java

Display frames, or better known as the "Look and Feel" in java can be adjusted according to our wishes. Java have three basic Look and Feel of Metal, Motif and Windows. In addition, many available Look and Feel on the Internet that can be downloaded for free. Here are examples of programs that adjust the look or theme and frame.

And here are examples of how it looks:


Here is the full program :

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class LookAndFeelDemo extends JFrame {

 private final String lookName[] = {"Metal", "Motif", "Windows"};

 private UIManager.LookAndFeelInfo looks[];

 private JRadioButton rdLook[];

 private ButtonGroup btnGroup;

 private JButton btn;

 private JTextField txt;

 private JPanel panel1, panel2;

 public LookAndFeelDemo () {

  super ("Look and Feel Demo : Tampilan Frame");

  setSize (400,300);

  Container container = getContentPane();

  ItemHandler handler = new ItemHandler ();

  panel1 = new JPanel();

  panel2 = new JPanel();

  btnGroup = new ButtonGroup();

  rdLook = new JRadioButton [lookName.length];

  for (int i = 0; i < rdLook.length; i++) {

   rdLook[i] = new JRadioButton (lookName[i]);

   rdLook[i].addItemListener(handler);

   btnGroup.add(rdLook[i]);

   panel2.add(rdLook[i]);

     }

     btn = new JButton ("Tombol");

     txt = new JTextField (20);

     panel1.add(btn);

     panel1.add(txt);

     container.add(panel1, BorderLayout.NORTH);

     container.add(panel2, BorderLayout.SOUTH);

     looks = UIManager.getInstalledLookAndFeels();

  setLocationRelativeTo (null);

  setVisible (true);

 }

 private void changeLookAndFeel(int val) {

  try {

   UIManager.setLookAndFeel(looks[val].getClassName());

   SwingUtilities.updateComponentTreeUI(this);

     }

     catch (Exception ex) {

      ex.printStackTrace();

     }

 }

 public static void main (String args[]) {

  LookAndFeelDemo test = new LookAndFeelDemo();

  test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

 }

 private class ItemHandler implements ItemListener {

  public void itemStateChanged (ItemEvent e) {

   //

   for (int i = 0; i < rdLook.length; i++) {

    if (rdLook[i].isSelected()) {

     changeLookAndFeel (i);
    }
      }
  }
   }
  }

Draw Polygon in Java

Example The following program will present how to draw a polygon (polygon) in Java. To make it we use the classes and methods drawPolygon Polygon ().

Here is the view the program:

menggambar-poligon-java

import java.awt.*;
import javax.swing.*;

public class DrawPolygons extends JFrame {

    public DrawPolygons() {
        super ("Menggambar Polygon"); // you can change
Polygon Drawing
        setSize (400,300);
        show();
    }

    public void paint(Graphics g) {
        super.paint (g);

        int xValues[] = {20,40,50,30,20,15};
        int yValues[] = {50,50,60,80,80,60};
        Polygon poly1 = new Polygon (xValues, yValues, 6); //(arrX, arrY, jumTitik)

        g.drawPolygon (poly1);
        int xValues2[] = {70,90,100,80,70,65,60};
        int yValues2[] = {100,100,110,110,130,110,90};
        g.drawPolyline (xValues2, yValues2, 7);       

        int xValues3[] = {120,140,150,190};
        int yValues3[] = {40,70,80,60};
        g.fillPolygon (xValues3, yValues3, 4);

        Polygon poly2 = new Polygon();
        poly2.addPoint (220,100);
        poly2.addPoint (175,150);
        poly2.addPoint (270,150);
        g.fillPolygon (poly2);
    }

    public static void main (String args[]) {

        DrawPolygons test = new DrawPolygons();
        test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

}

Painter Class: Drawing with the Mouse in Java

Class Painter can be used to create small programs that make up the line with the mouse (when the mouse-drag).

Here's how it looks:

contoh-program-painter-java

import java.awt .*;
import java.awt.event .*;
import javax.swing .*;
public class Painter extends JFrame {
    
private int pointCount = 0;
    
private Point points [] = new Point [1000];

    
public Painter () {
        
super ("simple drawing program");

        
getContentPane (). add (new JLabel ("Drag the mouse to draw"), BorderLayout.SOUTH);

        
addMouseMotionListener (
            
MouseMotionAdapter new () {
                
public void mouseDragged (MouseEvent e) {
                    
if (pointCount
                        
points [pointCount] = e.getPoint ();
                        
+ + PointCount;
                        
repaint ();
                    
}
                
}
            
} / / End of anonymous class
        
); / / End method addMotionListener

        
setSize (300.150);
        
setLocationRelativeTo (null);
        
setVisible (true);
    
}

    
public void paint (Graphics g) {
        
super.paint (g);
        
for (int i = 0; i
            
g.setColor (Color.red);
            
g.fillOval (points [i]. x, points [i]. y, 4.4);
        
}
    
}

    
public static void main (String args []) {
    
Painter test = new Painter ();
    
test.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    
} }
Hopefully helpful
 
Recommended Post Slide Out For Blogger

Recent Comments

My Rank