hello..i am having a difficulties in calling the function in other file.
for example..this is the file that use xxx.java;
how i can display the xxx.java program when i click the second button?
for example..this is the file that use xxx.java;
Code:
package netbean5test;
import netbean5test.xxx;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*; //button
import java.io.*;
public class testpopup extends JFrame implements ActionListener{
private JButton satu = new JButton("SATU");
private JButton dua = new JButton("DUA");
public testpopup(){
setBackground(Color.ORANGE);
JPanel one = new JPanel();
Container c = getContentPane();
c.setLayout(new FlowLayout(FlowLayout.CENTER,10,20));
c.add(satu);
c.add(dua);
satu.addActionListener(this);
dua.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==satu){
JOptionPane x = new JOptionPane();
x.setMessageType(JOptionPane.ERROR_MESSAGE);
x.showMessageDialog(null, "Ini adalah popup..");
}
else if(e.getSource()==dua){
}
}
public static void main(String[] args){
testpopup kawasan = new testpopup();
kawasan.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
kawasan.setTitle("POPUP!!");
kawasan.setSize(400,400);
kawasan.setVisible(true);
}
}
Comment