Create Java MP3 To Wav Converter
*********************************************************************
COMPLETE SOURCE CODE FOR : MainClass.java
*********************************************************************
*********************************************************************
COMPLETE SOURCE CODE FOR : SwingWorker.java
*********************************************************************
Select all JCheckBox in one click
Watch video below :
*********************************************************************
COMPLETE SOURCE CODE FOR : JCheckBoxMultipleSelectInOneClick.java
*********************************************************************
*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************
*********************************************************************
COMPLETE SOURCE CODE FOR : JCheckBoxMultipleSelectInOneClick.java
*********************************************************************
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class JCheckBoxMultipleSelectInOneClick extends JFrame implements ActionListener
{
//Create JCheckBox object
JCheckBox a=new JCheckBox("Select All");
JCheckBox b=new JCheckBox("Car");
JCheckBox c=new JCheckBox("Lorry");
JCheckBox d=new JCheckBox("Motorcycle");
//Constructor for JCheckBoxMultipleSelectInOneClick class
public JCheckBoxMultipleSelectInOneClick()
{
//Set JFrame title
super("Select All JCheckBox In One Click");
//Set JFrame layout
setLayout(new GridLayout(4,1));
//Add action listener to JCheckBox a
a.addActionListener(this);
//Add JCheckBox into JFrame
add(a);
add(b);
add(c);
add(d);
//Set JFrame's default close operation when click on close window button
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set JFrame size
setSize(400,400);
//Make JFrame locate at the center of screen
setLocationRelativeTo(null);
//Make JFrame visible to see
setVisible(true);
}
//Override actionPerformed method in ActionListener interface
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==a)
{
//Set all JCheckBox to select when JCheckBox a is select
if(a.isSelected()==true)
{
b.setSelected(true);
c.setSelected(true);
d.setSelected(true);
}
//Set all JCheckBox to unselect when JCheckBox a is select
else
{
b.setSelected(false);
c.setSelected(false);
d.setSelected(false);
}
}
}
//Main method where this program start
public static void main(String[]args)
{
JCheckBoxMultipleSelectInOneClick myFirstObject = new JCheckBoxMultipleSelectInOneClick();
}
}
*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************
A Java Program To Play A MP3 File Using JLayer
Watch video tutorial below :
*********************************************************************
COMPLETE SOURCE CODE FOR : TestPlay.java
*********************************************************************
*********************************************************************
COMPLETE SOURCE CODE FOR : TestPlay.java
*********************************************************************
import javazoom.jl.player.Player;
import java.io.FileInputStream;
public class TestPlay
{
public static void main(String[]args)
{
try
{
FileInputStream fis=new FileInputStream("C:\\Documents and Settings\\UserXP\\Desktop\\01-flo_rida_(feat_david_guetta)-clab_cant_handle_me.mp3");
Player playMp3=new Player(fis);
playMp3.play();
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Open folder or directory in Windows 7 using java
Complete source code below will show you, how to open folder through java in Windows 7.
************************************************************************
COMPLETE SOURCE CODE FOR : OpenFolderInJava.java
Thank you to Ankur Pandya for this source codes.
************************************************************************
************************************************************************
JUST COMPILE AND EXECUTE
************************************************************************
************************************************************************
COMPLETE SOURCE CODE FOR : OpenFolderInJava.java
Thank you to Ankur Pandya for this source codes.
************************************************************************
/// file OpenFolderInJava.java ////
import java.util.*;
import java.io.*;
import java.awt.Desktop;
class OpenFolderInJava{
public static void main(String[] arg){
String path = "."; // path to the directory to be opened
File file = new File("C:\\");
Desktop desktop = null;
// Before more Desktop API is used, first check
// whether the API is supported by this particular
// virtual machine (VM) on this particular host.
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
try {
desktop.open(file);
}
catch (IOException e){
}
}
}
/// end of file ///
************************************************************************
JUST COMPILE AND EXECUTE
************************************************************************
How To Retrieve Data Into Database
Contributor : Santosh Rai
Program Description : How To Retrieve Data Into Database
Java Hotel Management Program (Philippine)
*********************************************************************
COMPLETE SOURCE CODE FOR : TTKH.java
BY : Phi
*********************************************************************
*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************
COMPLETE SOURCE CODE FOR : TTKH.java
BY : Phi
*********************************************************************
/**
* @(#)TTKH.java
*
* TTKH application
*
* @author
* @version 1.00 2010/3/21
*/
import javax.swing.*;
import java.awt.*;
public class TTKH {
public static void main(String[] args) {
try {
// Set System L&F
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
}
catch (UnsupportedLookAndFeelException e) {
// handle exception
}
catch (ClassNotFoundException e) {
// handle exception
}
catch (InstantiationException e) {
// handle exception
}
catch (IllegalAccessException e) {
// handle exception
}
//=----------------------------------------------------
// TODO, add your application code
JFrame frame = new JFrame();
JPanel panel = new JPanel();
JPanel khungchitiet = new JPanel();
//JPanel p1 = new JPanel();
//JPanel p2 = new JPanel();
//p2.setLayout(new FlowLayout());
JPanel khungtimkiem = new JPanel();
GridLayout g2 = new GridLayout(2,2);
khungtimkiem.setLayout(new GridLayout(5,2,10,10));
GridLayout g1 = new GridLayout(1,1);
khungchitiet.setLayout(new GridLayout(7,2,10,10));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// frame.setLocationByPlatform(true);
frame.setSize(680,470);
// Giao dien
JLabel ldemuc = new JLabel("Thong Tin Khach Hang");
ldemuc.setFont(new Font("Tahoma", Font.BOLD, 25));
ldemuc.setLayout(new FlowLayout());
panel.add(ldemuc);
// Khung Chi tiet
JLabel ltenKH = new JLabel("Ten KH");
JTextField ttenKH = new JTextField("Nguyen Van A",1);
JLabel lngaynhan = new JLabel("Ngay Nhan Phong");
JTextField tngaynhan = new JTextField("12/05/2009",1);
JLabel lngaysinh = new JLabel("Ngay Sinh");
JTextField tngaysinh = new JTextField("11/09/1986",1);
JLabel lngaytra = new JLabel("Ngay Tra Phong") ;
JTextField tngaytra = new JTextField("22/05/2009",1);
JLabel lgioitinh = new JLabel("Gioi Tinh");
JTextField tgioitinh = new JTextField("Nam",1);
JLabel lsodt = new JLabel("So Dien Thoai");
JTextField tsodt = new JTextField("0912345677",1);
JLabel lloaiphong = new JLabel("Loai Phong");
JTextField tloaiphong = new JTextField("Vip",1);
JLabel lcmnd = new JLabel("So CMND");
JTextField tcmnd = new JTextField("036365888",1);
JLabel lmaKH = new JLabel("Ma KH");
JTextField tmaKH = new JTextField("001",1);
JLabel lemail = new JLabel("Email");
JTextField temail = new JTextField("nguoidep@gmail.com",1);
JLabel lspace = new JLabel("--------------");
JLabel lspace1 = new JLabel(" ");
JLabel lspace2 = new JLabel("");
JLabel lspace3 = new JLabel("--------------");
JLabel lspace4 = new JLabel(" ");
JLabel lspace5 = new JLabel(" ");
JLabel lchitiet = new JLabel("Chi Tiet Khach Hang") ;
lchitiet.setFont(new Font("Tahoma", Font.BOLD, 15));
JLabel ltimkiem = new JLabel("Tim Kiem Nhanh") ;
ltimkiem.setFont(new Font("Tahoma", Font.BOLD, 15));
khungchitiet.add(lchitiet);
khungchitiet.add(lspace);
khungchitiet.add(lspace1);
khungchitiet.add(lspace2);
//khungchitiet.add(lspace3);
khungchitiet.add(lmaKH);
khungchitiet.add(tmaKH);
khungchitiet.add(lngaynhan);
khungchitiet.add(tngaynhan);
khungchitiet.add(ltenKH);
khungchitiet.add(ttenKH);
khungchitiet.add(lngaytra);
khungchitiet.add(tngaytra);
khungchitiet.add(lgioitinh);
khungchitiet.add(tgioitinh);
khungchitiet.add(lsodt);
khungchitiet.add(tsodt);
khungchitiet.add(lngaysinh);
khungchitiet.add(tngaysinh);
khungchitiet.add(lloaiphong);
khungchitiet.add(tloaiphong);
khungchitiet.add(lcmnd);
khungchitiet.add(tcmnd);
khungchitiet.add(lemail);
khungchitiet.add(temail);
khungchitiet.add(ltimkiem);
khungchitiet.add(lspace3);
khungchitiet.add(lspace4);
khungchitiet.add(lspace5);
// phan tim kiem
JLabel lmaKH2 = new JLabel("Ma KH");
lmaKH2.setForeground(Color.red);
JTextField tmaKH2 = new JTextField("Nhap ma khach hang...");
Choice c1 = new Choice();
c1.addItem("Vip");
c1.addItem("Phong Gia dinh");
c1.addItem("Phong Quat");
c1.addItem("Phong May lanh");
//JLabel lgioitinh2 = new JLabel("Gioi tinh");
//JRadioButton rnam = new JRadioButton("Nam",true);
//JRadioButton rnu = new JRadioButton("Nu",false);
JLabel lngaynhan2 = new JLabel("Ngay Nhan");
lngaynhan2.setForeground(Color.red);
JTextField tngaynhan2 = new JTextField("Nhap ngay nhan dd/mm/yyyy");
JLabel lcmnd2 = new JLabel("So CMND");
JTextField tcmnd2 = new JTextField("Nhap so");
JLabel lngaytra2 = new JLabel("Ngay Tra");
lngaytra2.setForeground(Color.red);
JTextField tngaytra2 = new JTextField("Nhap ngay tra dd/mm/yyyy");
JLabel ltenKH2 = new JLabel("Ten KH");
JTextField ttenKH2 = new JTextField("Nhap ten KH");
JLabel ls1 = new JLabel(" ");
JLabel ls2 = new JLabel(" ");
JLabel ls3 = new JLabel(" ");
JLabel ls4 = new JLabel(" ");
JLabel ls5 = new JLabel(" ");
JLabel ls6 = new JLabel(" ");
JButton b1 = new JButton("Lam Moi");
JButton b2 = new JButton("Tim");
JButton b3 = new JButton("Thoat");
//JLabel ls5 = new JLabel(" ");
JLabel loaiphong = new JLabel("Loai Phong");
khungtimkiem.add(lmaKH2);
khungtimkiem.add(tmaKH2);
khungtimkiem.add(lngaynhan2);
khungtimkiem.add(tngaynhan2);
khungtimkiem.add(ltenKH2);
khungtimkiem.add(ttenKH2);
khungtimkiem.add(lngaytra2);
khungtimkiem.add(tngaytra2);
khungtimkiem.add(lcmnd2);
khungtimkiem.add(tcmnd2);
khungtimkiem.add(ls1);
khungtimkiem.add(ls2);
khungtimkiem.add(loaiphong);
khungtimkiem.add(c1);
khungtimkiem.add(ls3);
khungtimkiem.add(b2);
khungtimkiem.add(ls5);
khungtimkiem.add(ls6);
khungtimkiem.add(b1);
khungtimkiem.add(b3);
frame.setLayout(new BorderLayout());
frame.add(panel, BorderLayout.NORTH);
//frame.add(p1, BorderLayout.LINE_START);
frame.add(khungchitiet, BorderLayout.WEST);
//frame.add(p2, BorderLayout.WEST);
//frame.add(p2, BorderLayout.LINE_END);
frame.add(khungtimkiem, BorderLayout.SOUTH);
frame.setVisible(true);
}
}
*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************
Java radians to degree
*********************************************************************
COMPLETE SOURCE CODE FOR : RadiansToDegree.java
*********************************************************************
public class RadiansToDegree
{
public static void main(String[]args)
{
//radians value
double radians=1.5707963267948966;
//Get degree value for radians value equal to 1.5707963267948966
double degree=Math.toDegrees(radians);
System.out.println(degree);
}
}
*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************
Java degree to radians
*********************************************************************
COMPLETE SOURCE CODE FOR : DegreeToRadians.java
*********************************************************************
public class DegreeToRadians
{
public static void main(String[]args)
{
//90 degree
double degree=90;
//Get radians value for 90 degree
double radians=Math.toRadians(degree);
System.out.println(radians);
}
}
*********************************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************************
Subscribe to:
Posts (Atom)