Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Servermaster Servermaster is offline
Member Aktif
 
Join Date: Nov 2011
Posts: 257
Rep Power: 14
Servermaster mempunyai hidup yang Normal
Default (ASK) Yang DEWA JAVA masuk!! ane butuh banget bantuannya..

Code:

package main;

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

class test implements ActionListener {
public JMenuBar menuBar;
public JMenu menu;
public JMenuItem menuItem;
public JMenuItem sdMenuItem;
public JTextField txtSearch;
public JButton btnGo;
public JList listWord;
public JList listDef;
public JScrollPane scrollDef;
public JScrollPane scrollWord;
public JLabel jLabel1;

public test() {
menuBar = new JMenuBar();
menuBar.setLocation(0,0);
menuBar.setSize(new Dimension(600, 20));

menu = new JMenu("File");
menu.setMnemonic('1');
menuBar.add(menu);

menuItem = new JMenuItem("Exit");
menuItem.setAccelerator(KeyStroke.getKeyStroke(Key Event.VK_X, ActionEvent.ALT_MASK));
menuItem.addActionListener(this);
menu.add(menuItem);

menu = new JMenu("Help");
menu.setMnemonic('2');
menuBar.add(menu);

sdMenuItem = new JMenuItem("About..");
sdMenuItem.addActionListener(this);
menu.add(sdMenuItem);

txtSearch = new JTextField();
txtSearch.setBounds(new Rectangle(10, 35, 225, 30));

btnGo = new JButton();
btnGo.setText("GO");
btnGo.setBounds(new Rectangle(245, 35, 60, 30));

listWord = new JList();
listWord.setBounds(new Rectangle(10, 100, 240, 300));
listWord.setSelectionMode(ListSelectionModel.SINGL E_SELECTION);
listWord.setBorder(BorderFactory.createEtchedBorde r());

scrollWord = new JScrollPane(listWord);
scrollWord.setBounds(new Rectangle(200,100,20,300));

listDef = new JList();
listDef.setBounds(new Rectangle(260, 100, 300, 300));
listDef.setBorder(BorderFactory.createEtchedBorder ());

scrollDef = new JScrollPane(listDef);
scrollDef.setBounds(new Rectangle(490,100,20,300));

jLabel1 = new JLabel();
jLabel1.setText("Copyright by Kelompok X @2010");
jLabel1.setBounds(new Rectangle(180, 430, 300, 35));
}
public void actionPerformed(ActionEvent event){
JMenuItem item = (JMenuItem) event.getSource();
if (item.getText().equals("Exit")){
System.exit(0);
} else if (item.getText().equals("About..")){
JOptionPane.showMessageDialog(null,"Thank you for using it");
}
}
public void createAndShowGUI(){
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("test");
frame.setLayout(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.getContentPane().add(menuBar);
frame.setBounds(0, 0, 580, 500);
frame.setLocationRelativeTo(null);
frame.setVisible(true);

frame.getContentPane().add(txtSearch,null);
frame.getContentPane().add(btnGo,null);
frame.getContentPane().add(listWord,null);
frame.getContentPane().add(listDef,null);
frame.getContentPane().add(scrollDef,null);
frame.getContentPane().add(scrollWord,null);
frame.getContentPane().add(jLabel1,null);

}

public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
test app = new test();
app.createAndShowGUI();

}
});
}
}

ini hasilnya..


Quote:











ane mau tanya nih, itu kan box nya ada kiri dan kanan..

ane buat aplikasi kamus gitu, utk box kiri buat istilah kamusnya dan box kanan untuk arti dari istilah kamusnya..

ane mau tanya gimana yah bikin list di box kiri tapi nanti setelah di klik keluar artinya di box kanan? dan utk search boxnya apa pakai codingan lagi??





MOHON BANGET BANTUANNYA...



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 07:00 AM.


no new posts