السلام عليكم و رحمه الله و بركاته
انا كنت بعمل برنامج بيستخد الجوجل سيرش بس مش عارف بيطلعلي اكسبشنز مش فاهما
ياريت تساعدوني
ودا كود البرنامج
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
public class Search extends JFrame
{
private JTextField input ;
private String SearchKey ;
private JEditorPane contentArea ;
public Search()
{
super("Search engine");
input = new JTextField("Enter Search Key Word") ;
input.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent event)
{
SearchKey = "http://www.google.com/search?as_q="+input.getText()+"&as_sitesearch=.com/" ;
getThePage(SearchKey) ;// TODO Auto-generated method stub
}
}) ;
contentArea = new JEditorPane() ;
add(input,BorderLayout.NORTH) ;
add(contentArea , BorderLayout.CENTER) ;
}
protected void getThePage(String loc)
{
try
{
contentArea.setPage(loc) ;
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}// TODO Auto-generated method stub
}
/**
* @param args
*/
public static void main(String[] args)
{
Search app = new Search() ;
app.setVisible(true) ;
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ;
app.setSize(300, 300) ;// TODO Auto-generated method stub
}
}



