- Back to Home »
- Java Applet »
- Contoh Program Java Applet Sederhana
Posted by : Unknown
Monday, December 5, 2011
Pertama - tama ane tunjukin tampilan program yang udah jadi. Seperti inilah hasilnya.....
Nah, sekarang untuk programnya, dapat agan sedot di DIMARI. Untuk codingnya langsung ane tulis aja lah gan. Nih codingnya.
package pkg40_Wahyu_Nardianto;
import java.awt.Color;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.media.Manager;
import javax.media.Player;
import javax.swing.JOptionPane;
public class FormComplete extends javax.swing.JApplet {
public Player player;
public String text,namafiletext;
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
}
catch (Exception ex) {
ex.printStackTrace();
}
}
@SuppressWarnings("unchecked")
//
private void initComponents() {
jButton1 = new javax.swing.JButton();
jTabbedPane1 = new javax.swing.JTabbedPane();
jTabbedPane2 = new javax.swing.JTabbedPane();
jTabbedPane3 = new javax.swing.JTabbedPane();
pecah_angka = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
outputpecah = new javax.swing.JTextArea();
jLabel1 = new javax.swing.JLabel();
inputangka = new javax.swing.JTextField();
tombolpecah = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
Play1 = new javax.swing.JButton();
labelMP3statis = new javax.swing.JLabel();
stop = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
browse1 = new javax.swing.JButton();
text1 = new javax.swing.JTextField();
play2 = new javax.swing.JButton();
stop2 = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
nama = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
areatext = new javax.swing.JTextArea();
baca = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
namafile = new javax.swing.JTextField();
browse2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
isi2 = new javax.swing.JTextArea();
panelwarna = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
inputwarna = new javax.swing.JTextField();
panggil = new javax.swing.JButton();
jButton1.setText("jButton1");
outputpecah.setColumns(20);
outputpecah.setRows(5);
jScrollPane1.setViewportView(outputpecah);
jLabel1.setText("Inputkan angka");
inputangka.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
inputangkaActionPerformed(evt);
}
});
tombolpecah.setText("pecah");
tombolpecah.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tombolpecahActionPerformed(evt);
}
});
javax.swing.GroupLayout pecah_angkaLayout = new javax.swing.GroupLayout(pecah_angka);
pecah_angka.setLayout(pecah_angkaLayout);
pecah_angkaLayout.setHorizontalGroup(
pecah_angkaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pecah_angkaLayout.createSequentialGroup()
.addGap(49, 49, 49)
.addGroup(pecah_angkaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pecah_angkaLayout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(inputangka, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)))
.addGap(31, 31, 31)
.addComponent(tombolpecah)
.addContainerGap(243, Short.MAX_VALUE))
);
pecah_angkaLayout.setVerticalGroup(
pecah_angkaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pecah_angkaLayout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(pecah_angkaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(pecah_angkaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(inputangka, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tombolpecah)))
.addGap(8, 8, 8)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(125, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Pecah angka", pecah_angka);
jLabel2.setText("File MP3:");
Play1.setText("PLAY");
Play1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Play1ActionPerformed(evt);
}
});
stop.setText("stop");
stop.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
stopActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(Play1)
.addGap(18, 18, 18)
.addComponent(stop))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(labelMP3statis, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(296, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(labelMP3statis, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(56, 56, 56)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Play1)
.addComponent(stop))
.addContainerGap(160, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Mp3-statis", jPanel1);
browse1.setText("Browse Music");
browse1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
browse1ActionPerformed(evt);
}
});
text1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
text1ActionPerformed(evt);
}
});
play2.setText("PLAY");
play2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
play2ActionPerformed(evt);
}
});
stop2.setText("STOP");
stop2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
stop2ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(play2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(stop2))
.addComponent(browse1)
.addComponent(text1, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(332, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(browse1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(text1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(38, 38, 38)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(play2)
.addComponent(stop2))
.addContainerGap(137, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Mp3-Dinamis", jPanel2);
jLabel5.setText("FILE");
jLabel5.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
jLabel5AncestorAdded(evt);
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
});
nama.setText("Nama File");
jLabel7.setText("Isi File");
areatext.setColumns(20);
areatext.setRows(5);
jScrollPane3.setViewportView(areatext);
baca.setText("Baca");
baca.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bacaActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(nama)
.addComponent(jLabel7)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(baca))
.addContainerGap(374, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nama)
.addGap(30, 30, 30)
.addComponent(baca)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(47, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Text-Statis", jPanel4);
jLabel3.setText("Nama File Text:");
namafile.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
namafileActionPerformed(evt);
}
});
browse2.setText("BROWSE TEXT");
browse2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
browse2ActionPerformed(evt);
}
});
jLabel4.setText("Isi File Text:");
isi2.setColumns(20);
isi2.setRows(5);
jScrollPane2.setViewportView(isi2);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(browse2)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(namafile, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(374, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(namafile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(browse2)
.addGap(30, 30, 30)
.addComponent(jLabel4)
.addGap(9, 9, 9)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(53, Short.MAX_VALUE))
);
jTabbedPane3.addTab("Text-Dinamis", jPanel3);
jLabel6.setText("40-2T3");
jLabel8.setText("WAHYU NARDIANTO");
jLabel9.setText("Masukkan Warna");
inputwarna.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
inputwarnaActionPerformed(evt);
}
});
panggil.setText("PANGGIL");
panggil.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
panggilActionPerformed(evt);
}
});
javax.swing.GroupLayout panelwarnaLayout = new javax.swing.GroupLayout(panelwarna);
panelwarna.setLayout(panelwarnaLayout);
panelwarnaLayout.setHorizontalGroup(
panelwarnaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelwarnaLayout.createSequentialGroup()
.addGap(39, 39, 39)
.addGroup(panelwarnaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel9)
.addComponent(jLabel6))
.addGap(26, 26, 26)
.addGroup(panelwarnaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel8)
.addComponent(inputwarna, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
.addComponent(panggil, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(115, Short.MAX_VALUE))
);
panelwarnaLayout.setVerticalGroup(
panelwarnaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelwarnaLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelwarnaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addGroup(panelwarnaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel9)
.addComponent(inputwarna, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panggil)
.addContainerGap(185, Short.MAX_VALUE))
);
jTabbedPane3.addTab("ulangan", panelwarna);
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)
.addComponent(jTabbedPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 555, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(48, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 310, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(21, Short.MAX_VALUE))
);
}//
private void inputangkaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void tombolpecahActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int uang,pul,ribu,ratus,lima;
uang = Integer.parseInt(inputangka.getText());
pul=uang/10000;
ribu=(uang-pul*10000)/5000;
ratus=(uang-(pul*10000+ribu*5000))/100;
lima=(uang-(pul*10000+ribu*5000+ratus*100))/50;
outputpecah.setText("10 ribuan\t: "+pul+"\n");
outputpecah.setText(outputpecah.getText()+"Lima ribuan\t: "+ribu+"\n");
outputpecah.setText(outputpecah.getText()+"Seratusan\t: "+ratus+"\n");
outputpecah.setText(outputpecah.getText()+"Lima puluhan\t: "+lima+"\n");
}
private void browse1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser fc= new JFileChooser();
JFrame jf= new JFrame();
int ret= fc.showOpenDialog(jf.add(fc));
if(ret==JFileChooser.APPROVE_OPTION)
{
File file=fc.getSelectedFile();
text=file.getPath().toString();
text1.setText(text);
}
}
private void text1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void Play1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(evt.getActionCommand().equals("PLAY")){
try{
player=Manager.createPlayer(new URL("file",null,"C:\\lingsir wengi.mp3"));
labelMP3statis.setText(labelMP3statis.getText()+"C:\\lingsir wengi.mp3");
player.start();
}
catch(Exception ex){}
}
}
private void play2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(evt.getActionCommand().equals("PLAY")){
try{
player= Manager.createPlayer(new URL("file",null,text));
player.start();
}
catch(Exception ex){}
}
}
private void stop2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
player.stop();
}
private void browse2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFileChooser fc= new JFileChooser();
JFrame jf= new JFrame();
int ret= fc.showOpenDialog(jf.add(fc));
if(ret==JFileChooser.APPROVE_OPTION)
{
File file=fc.getSelectedFile();
text=readFile(file);
isi2.setText(text);
namafiletext=file.getPath().toString();
namafile.setText(namafiletext);
}
}
private void namafileActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void bacaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aline;
try{
URL source=new URL("file",null,"C://contoh.txt");
BufferedReader br=new BufferedReader(new InputStreamReader(source.openStream()));
aline=br.readLine();
areatext.setText(aline);
System.out.println(aline);
while(null !=(aline=br.readLine())){
System.out.println(aline);
areatext.setText(areatext.getText()+"\n"+aline);
}
br.close();
nama.setText("contoh.txt");
}
catch(Exception e){
e.printStackTrace();
}
}
private void stopActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
player.stop();
}
private void jLabel5AncestorAdded(javax.swing.event.AncestorEvent evt) {
// TODO add your handling code here:
}
private void inputwarnaActionPerformed(java.awt.event.ActionEvent evt) {
int warna = 0;
String a = "merah";
String b = "hijau";
String c = "kuning";
String d = "wahyu";
if(evt.getActionCommand().equalsIgnoreCase(a)){
panelwarna.setBackground(Color.red);
}
else if(evt.getActionCommand().equalsIgnoreCase(b)){
panelwarna.setBackground(Color.green);
}
else if(evt.getActionCommand().equalsIgnoreCase(c)){
panelwarna.setBackground(Color.yellow);
}
else if(evt.getActionCommand().equalsIgnoreCase(d)){
panelwarna.setBackground(Color.blue);
}
else
JOptionPane.showMessageDialog(rootPane,"Warna yang anda masukkan salah");
}
private void panggilActionPerformed(java.awt.event.ActionEvent evt) {
if(evt.getActionCommand().equals("PANGGIL")){
try{
player=Manager.createPlayer(new URL("file",null,"C:\\lingsir wengi.mp3"));
player.start();
panggil.setText("STOP");
}
catch(Exception ex){}
}
if(evt.getActionCommand().equals("STOP"))
try{
player.stop();
panggil.setText("PANGGIL");
}
catch(Exception ex){}
}
private String readFile(File file){
String result="";
try{
FileInputStream fis=new FileInputStream(file);
BufferedInputStream bis=new BufferedInputStream(fis);
DataInputStream dis=new DataInputStream(bis);
while(dis.available()!=0){
result +=dis.readLine()+"\n";
}
}
catch(FileNotFoundException e){
}
catch(IOException e){
}
return result;
}
// Variables declaration - do not modify
private javax.swing.JButton Play1;
private javax.swing.JTextArea areatext;
private javax.swing.JButton baca;
private javax.swing.JButton browse1;
private javax.swing.JButton browse2;
private javax.swing.JTextField inputangka;
private javax.swing.JTextField inputwarna;
private javax.swing.JTextArea isi2;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JTabbedPane jTabbedPane2;
private javax.swing.JTabbedPane jTabbedPane3;
private javax.swing.JLabel labelMP3statis;
private javax.swing.JLabel nama;
private javax.swing.JTextField namafile;
private javax.swing.JTextArea outputpecah;
private javax.swing.JPanel panelwarna;
private javax.swing.JButton panggil;
private javax.swing.JPanel pecah_angka;
private javax.swing.JButton play2;
private javax.swing.JButton stop;
private javax.swing.JButton stop2;
private javax.swing.JTextField text1;
private javax.swing.JButton tombolpecah;
}
Nah, dengan ini semoga agan - agan sekalian bisa mengerti temtang Java Applet setelah mempelajari program sederhana dari ane ini gan. Jika ingin lebih megerti lagi tentang Applet, baca dasar pemrograman Applet di postingan ane yang lain gan.Semoga bermanfaat. Terima Kasih