Load Image dalam JInternalFrame
Post ini dibuat dengan salah satu alasan yaitu mengurangi penasaran saya terhadap pertanyaan teman. Pertanyaannya adalah bagaimana load image di internal frame sehingga pada nantinya framenya bisa diminimize/maximize. Oh ya hampir lupa, kita disini belajar mengenai Java, jadi program yang akan kita pakai juga java. Saya menggunakan Netbeans 7.0, dimana untuk look and feel user interfacenya, saya masih import manual.
Kurang lebih output programnya seperti ini.
Program dijalankan kemudian klik tombol browse, yang artinya memilih file gambar yang akan diinginkan, disini saya tidak menggunakan file filter untuk menyaring mana aja file yang akan diambil sebagai gambar. Setelah gambar dipilih dan klik tombol Open maka akan keluar tampilan seperti dibawah :
kGambar akan otomatis muncul dalam internalframe, dan selanjutnya bisa di minimize dan di maximize.
Baiklah kita langsung buka saja netbeansnya, silakan buat project baru, dan buat JFrame baru, silakan design sesuka hati. Tinggal drag and drop, untuk aturan mainnya sebelum memasukkan jinternalframe, drag dulu JDekstopPane nya. Setting di properties dengan klik kanan pada komponen JInternalFrame nya, aktifkan icon minimize dan iconifiable. Kurang lebih inspector dan design nya seperti gambar berikut :
Setelah membuat tampilan alias design, perhatikan dalam internalframe ada layout yang harus disetting yaitu BorderLayout, tinggal klik kanan pada komponen JInternalFrame, pilih SetLayout>>>BorderLayout. Kurang lebih code nya simpel begini :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* LoadImage.java
*
* Created on Apr 23, 2012, 5:28:51 AM
*/
package freeExercise;
import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
*
* @author Yuita Arum Sari
*/
public class LoadImage extends javax.swing.JFrame {
static ImageIcon gambar;
/** Creates new form LoadImage */
public LoadImage() {
initComponents();
this.setLocationRelativeTo(getRootPane());
}
/** 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() {
chooserGambar = new javax.swing.JFileChooser();
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jDesktopPane1 = new javax.swing.JDesktopPane();
jInternalFrame1 = new javax.swing.JInternalFrame();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Test Gambar");
setBackground(new java.awt.Color(153, 153, 255));
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(153, 153, 255));
jButton1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/freeExercise/tambah_data40.jpg"))); // NOI18N
jButton1.setText("BROWSE GAMBAR");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jInternalFrame1.setIconifiable(true);
jInternalFrame1.setMaximizable(true);
jInternalFrame1.setResizable(true);
jInternalFrame1.setTitle("Test Gambar");
jInternalFrame1.setAutoscrolls(true);
jInternalFrame1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jInternalFrame1.setVisible(true);
jLabel1.setText("jLabel1");
jInternalFrame1.getContentPane().add(jLabel1, java.awt.BorderLayout.CENTER);
jInternalFrame1.setBounds(70, 40, 490, 200);
jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);
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(220, 220, 220)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jDesktopPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 620, javax.swing.GroupLayout.PREFERRED_SIZE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(jDesktopPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE))
);
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 620, 360));
pack();
}// </editor-fold>
public void openGambar() {
if (chooserGambar.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
gambar = new ImageIcon(chooserGambar.getSelectedFile().getPath());
jLabel1.setIcon(gambar);
jLabel1 = new JLabel(gambar);
getContentPane().add(jLabel1);
// panelImage.repaint();
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
openGambar();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) throws UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LoadImage().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JFileChooser chooserGambar;
private javax.swing.JButton jButton1;
private javax.swing.JDesktopPane jDesktopPane1;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
Kurang lebih begitulah postingan saya, tadi saya ngutek2 automatic scrolling di internalframe belum nemu reference yang pas, tolong share ya kalau teman2 ada yang bisa. Thanks ya…
Salam java…
Garuda Muda ~ Guessing Word Games
April 16th 2012
- There are 5 question
- All members made a groups, in each group contains of 3 persons.
- There are 4 groups, (1) Hello Kitty, (2) Cobbler, (3) 3 Angels, (4) Swinging Grass
- Swinging Grass’ group won the game, then 3 Angels in the 3rd rank, Cobbler in 2nd rank
- Hello Kitty lose the game, so the members got a punishment. Hello Kitty’s group contains of Yayan and Arys. So funny when they gave song to us, “Twinkle…Twinkle…little stars..”
Via as a tutor was absent so I was change Via’s position, but Ivan still help me, also Mbak Een. Thanks
Matrix : Random Binary ~ Java
This is an example of matrix two dimension which is contain binary random. We can use class Random in Java
public class RandomBinarySet {
public static void main(String[] args) {
Random random = new Random();
int[][] inputArray = new int[5][5];
for (int i = 0; i < inputArray.length; i++) {
for (int j = 0; j < inputArray[i].length; j++) {
int result = random.nextInt(2);
System.out.print(result+"\t");
}
System.out.println();
}
}
}
“int result = random.nextInt(2);” means that the value limited to binary ( is not more than 2). And below the output :
Garuda Muda ~ Listening Song
My recent meeting with Garuda Muda was held on Thursday, April 12th 2012. In this meeting we listened a song under the title “Hero” which have sang by Mariah Carey. Who’s that? She is incredible singer that has beautiful voice. We obtained a paper that contains Hero’s lyric. The parts of lyrics is blank, and we have to filled in the blank correctly through listened the song. We listened the music and giving checked the answer about two times.
There were rules before we answered the question. We never don’t know who will answer the question next, we can’t guess it first, because it’s really depends on the lucky
. How come? Yes, we have to count first, we made a circle and each person counting sequentially. But wait! It just not counting, there is the rule of counting. For instance in any multiple number of 5 we have to say “kwek”. The instruction based on the last person who get lucky to answer the question. It’s really funny.
Just one song but it was spent many times, and we haven’t realized yet that the time is over. That’s all.See you again guys
First Meeting ~ Garuda Muda
Monday, April 9th 2012
~Garuda Muda~
Today is so remarkable day for me. I met new friends who incorporated in Garuda Muda. First meeting and here we learn english together, especially about the speak up. Something that should be memorized if we wanna practice speak up more, we might be forget about the grammar first, because grammar can make us afraid to arrange sentences. At the first time we learn about how to enrich many words and can put it in sentence.
Well, via and I distracted at the first, really awkward, but it was a moment, and everything turned on pleasant at once. Our new friends here is so friendly and the awkward thing was melt away, they’re so funny. We was laughing together when anybody made something “alay”. They said “alay” was processed that to be passed before get adult step. How funny it is. Is it really like that? What do you think, guys?
Their recent activity, they have learned in English under subject Simple Present Tense. Then Via have an incredible idea, to make us speak up at the first. We have to arrange a sentences using Simple Present Tense. And how about the result? Very enthusiastic. After crowded with Simple Present Tense sentences,then we learn about tongue twister. Tongue twister is one of ways how to increase our ability in pronunciation. Each person have to say “Lesley loves Roger, but Roger doesn’t love Lesley. Roger rather likes Lucy”. It looks like simple, however we met something difficult to say in some words, after we listened how well native speaker to speak. That sentence was taken from BBC tongue twister.
The time run so fast, we broke up this meeting, and maybe we can meet next week. Glad to see this friends and hopefully we can learn more and more about how to speak up in english.
See you guys ^__^
Correct me if I have mistake during using English..
(Kluwek) Pendaftaran Webinar : Women Technopreneur
“Dengan berjiwa enterpreneurship, kita memiliki kesempatan berbuat
lebih banyak untuk orang lain. Dan teknologi dapat memfasilitasi itu
semua. Selain itu, kelebihan di sosok perempuan sangat diperlukan
dalam membuat entitas.”
Pembicara : Yuyun Kusuma
Biografi
Tujuh tahun bekerja sebagai profesional IT di bidang di perusahaan
Nasional dan Multinasional dan menjadi Managing Director di perusahaan
yang telah di rintisnya sejak tahun 2006. Bekerja sebagai relawan
merupakan kegiatan paling membahagiakan bagi perempuan yang mempunyai
jargon “Technology is my fate”
Biaya pendaftaran Rp. 10.000,- bisa ditransfer melalui rekening:
- Mandiri. 1310005470416 an. Muhammad Azmi Farih
- BNI : 0129885136 an. Yuita Arum Sari
Silahkan isi form pendaftaran disini
http://www.anymeeting.com/AccountManager/RegEv.aspx?PIID=EB55D9888349
Untuk konfirmasi pembayaran bisa menghubungi Yuita Arum Sari via email
y.arumsari@gmail.com
Apakah Webinar itu ?
http://ai23.wordpress.com/2012/01/19/berseminar-di-depan-komputer/
Acara ini di selenggarakan oleh Kelompok Linux Cewek Indonesia
http://www.kluwek.linux.or.id
How to Download Website Contents Automatically
Just use available software, that u obtain free download. I recommends you to use this three kinds of software. Wget, Httrack, or WinWSD. Why just three software? Because i just have experience using three kind of that.
If you can find out more, you can share, right? ^__^ Those tools are helping you enough to download website contents automatically. For your information this software i use it in Windows.
1. Wget
What is wget? It is kind of download manager. You can download all contents in a website pages automatically. You can download it here. Then let’s join the instruction below
After you download then you have to remember where you put your wget in. Wget is binary file, so you can execute it with just double click
- Open your command line prompt
- Move to directory cd C:\
- Make sure that wget and folder which contains of website download – at the same folder.
- Then make a directory in drive C. For example C:\> cd md \site-example\. If you want to check wheter the folder “site -example exist in C drive or not, U just type cd site-example.
- Let’s type command wget -m (your URL website which would like to download). For example : wget -m http://arumsha.wordpress.com/
- Just press your enter
That’s all
Screenshoot of wget execution
2. Httrack
This is user friendly to use. You can download httrack here. After you installed it, you run.
- Press next
- Then you have to fill project name and base path (base path it mean where you will put the result of your download). Press next.
- Fill the address URL taht you will be captured, and you can choose one of actions based on your need.
- Just click Next, then Finish. You will can see the next execution progress like the picture below.
HTTrack execution progress
3. Win WSD
It’s so useful ones. You can download here. If you cannot captured well using wget and HTTrack, WinWSD is recommended for you (This is based on my experience). Sometimes, the conditions of each website is not good. Actually I still don’t know exactly reasons
. Just try and use, and you know the differences of them.^__^ :p
After you download,
- You have to make a project
- Make a folder then save it the project
- You just make a project name then save.
- There is an windows dialog, will pop up after you save the name project. You have to fill project name, and URL websites that you will download. Don’t forget to press “Add” button. And you can choose one of project type that you will download.
- Just ok, then wait till the run finish
Schreenshoot of WinWSD software
Well, that’s all my post. May be useful for you all. Thanks… ^_^
How to replace newline character to space using Ms.Word
In sounds of our hearing, i’t so simple way. How to replace a newline (well known as ENTER) become to space in Ms.Word? Just backspace and do space after that, right? But, are you sure for done by that way? if you found just not one “enter” to be replaced, you just use this way :
replace ^p with ” ” (blank space) or the others characters.
Further references you can find here http://support.microsoft.com/kb/95474.
All right, that’s all. ^_^
Konfigurasi Bluetooth di Fedora 15
Kembali lagi ke halaman pinguin, lama tidak berjumpa setelah perjuangan skripsi berakhir ^_^. Sebelumnya device bluetooth di fedora 15 tidak dapat berjalan dan difungsikan, ternyata sekarang telah banyak informasi yang menyediakan bagaimana konfigurasinya. Disini saya menggunakan beberapa referensi, dan akan saya share.
Keadaan default Bluetooth ON dan Visibility OFF. Masuklah ke terminal (pastikan masuk ke root) dan ketikkan baris code seperti berikut :
- systemctl status bluetooth.service
- systemctl enable bluetooth.service (mengaktifkan service bluetooth)
- systemctl start bluetooth.service (menjalankan bluetooth)
Log out, dan sekarang dapat dilihat bahwa visibility dari bluetooth akan terlihat ON.
Bagaimana untuk sharing file via bluetooth? Ada yang perlu ditambahkan disini. Ketik baris code berikut :
yum install gnome-user-share
Setelah terinstal maka buka Application dan klik pada Personal File Sharing. Contoh seperti gambar berikut :
Setting sesuai kebutuhan dan close.Sekarang teman-teman dapat menikmati fasilitas bluetooth dari Fedora 15 ^_^.
Reference :
Prosedur Kelengkapan Pasca Ujian Sarjana Ilkomp UB
Setelah melalui pertempuran, tenang gan, aktifitas masih berlanjut kok…^_^ bedanya ini sudah bisa dilakukan sambil tersenyum
Sudah beres belum persyaratan mengenai bebas lab dan bebas tanggungan? Kalau belum coba baca lagi disini gan. Setelah kalian ujian yo must to do :
- Revisi gan, cek dulu bagian mana yang harus direvisi. Sekedar saran, alangkah lebih baik jika revisian itu kita review kembali
( ini juga demi kebaikan generasi ilkomers2 berikutnya gan
) - Pastikan lembar revisian telah ditanda tangani dosen pembimbing dan penguji. Jika ada lembar yang belum ditandatangani, sebagai saran jangan PD langsung untuk njilid gan, itu artinya harus ke dosen tersebut untuk meminta tanda tangan kembali setelah revisi dilakukan.Tapi PD juga gapa2…:D gak dilarang, takutnya masi salah bongkar jilid lagi, jadi dobel-dobel kan?
Jika lembar persetujuan revisian sudah lengkap jilid semuanya. Ingat diprint sebanyak 5 eksemplar skripsi. Langsung minta tanda tangan ke TU jurusan pada kolom yang ada pada form Syarat Pendaftaran Wisuda (ini biar gak bolak balik gan!) - Selanjutnya minta tanda tangan Pembimbing I, Pembimbing II, dan Kajur, nah kalu mau ke Kajur tinggal titip ke TU gan (syaratnya bawa lembar revisian). OK?
- Gak cukup sampe disana kalian juga diwajibkan untuk membuat POSTER dan JURNAL dari skripsi kalian, diletakkan dalam sebuah CD. NB : Dalam CD tersebut berisi softcopy Program, skripsi, poster, dan jurnal, serta sekiranya data-data yang perlu dicantumkan, misalnya ada data penelitian, itu dimasukkan semuanya satu CD gan. Pastikan mengkopinya dalam 5 CD sesuai banyaknya eksemplar skripsi, dan jangan lupa memberi label CD. Gak ada ketentuan khusus, namun buat serapi mungkin. (Bukankah kerapian mencerminkan kepribadian Anda.Kata pepatah yang pernah ane denger sih seperti itu gan )
. - Skripsi 5 eksemplar dan 5 buah CD (yang ada isinya gan, bukan kosongan
) telah siap. Pastikan membawa Form Penyerahan Skripsi dan Form Pendaftaran Wisuda. Selanjutnya akan kita bagikan kepada :
- Fakultas MIPA : Setor di bagian akademik di Bu Mus.Serahkan 1 eksemplar skripsi dan 1 CD kemudian minta tanda tangan bukti penyerahan skripsi pada form penyerahan skripsi. Sekalian gan kumpulin semua berkas yang diletakkan dalam satu stopmap warna MERAH. Isi berkas : berkas kelengkapan bebas lab dan bebas tanggungan (kopma dan perpus) ***ane sudah posting ini gan, Biodata Sarjana, Fotocopy STTB SMU, Transkrip Akademik (transkrip sebelum ujian ini gan), dan Pas Photo Hitam Putih 3x 4 empat lembar dan 3×3 dua lembar. Bagi yang BERJILBAB ada syarat tambahan Menyerahkan surat pernyataan berjilbab,mengetahui pembantu dekan 1 sebanyak 2 lembar dan bermaterai 6000. Semua berkas dijadikan satu gan!
- Perpus PUSAT UB : 1 buah skripsi dan 1 buah CD, nanti kita disuruh isi form-form, ya isi ajalah ya. Nanti ada instruksi sendiri.Gak ribet kok tenang aja…^_^
- Pembimbing 1 : Satu eksemplar skripsi dan satu buah CD sekaligus minta tanda tangan di Form Pendaftaran Wisuda.
- Pembimbing 2 : Satu eksemplar skripsi dan satu buah CD sekaligus minta tanda tangan di Form Pendaftaran Wisuda.
- Tinggal 1 buat siapa? buat kita gan ^___^!
Skripsi+CD sudah disebarkan+berkas form kelengkapan ujian sarjana telah dikumpulkan, maka tinggal menunggu TRANSKRIP dan SKL nya jadi. Biasanya 2 hari, nanti ada instruksi setelahnya ikuti saja. Transkrip yang akan kita terima ada dalam 2 bahasa (Inggris dan Indonesia) dan jangan lupa untuk bawa 60rb. Setelah transkrip dan SKL jadi silahkan untuk tanda tangan ijazah ke Pak Dardiri di akademik FMIPA, dan sekali lagi jangan lupa membawa form pendaftaran wisuda untuk meminta tanda tangan
.
Selanjutnya postingan akan berlanjut ke Pendafataran Wisuda, tapi kalau teman-teman yang sudah ingin mendaftar wisuda dan telah melakukan pendaftaran wisuda (2007) monggo di share… ^_^ Sekali lagi saya ucapkan selamat kepada Sarjana Komputer .Tetap semangat dan semoga kelak kita selalu bisa bermanfaat bagi orang lain. Apapun pekerjaan dan aktivitas kita nanti semoga semuanya barokah. Semangat menatap dunia!










Recent Comments