ForumPortaliGalleryPytėsoriKėrkoLista AnėtarėveGrupet e AnėtarėveRegjistrohuidentifikimi

Share | 
 

 Ja Nje Aplikacion Vijuesi ne Java

Shko poshtė 
AutoriMesazh
Xhulio
Moderator/e
Moderator/e
avatar

Numri i postimeve : 357
Registration date : 27/07/2008

MesazhTitulli: Ja Nje Aplikacion Vijuesi ne Java   Mon Aug 11, 2008 10:41 pm

Vendose ne Programin tuaj te preferuar si ne JGraspy apo Ne Java Builedr Kompajlloje dhe egzekutoje si applet
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import java.net.MalformedURLException;

publicclass ShowDocument extends Applet
implements ActionListener {
URLWindow urlWindow;

publicvoid init() {
Button button = new Button("Vendose Linkun");
button.addActionListener(this);
add(button);

urlWindow = new URLWindow(getAppletContext());
urlWindow.pack();
}

publicvoid destroy() {
urlWindow.setVisible(false);
urlWindow = null;
}

publicvoid actionPerformed(ActionEvent event) {
urlWindow.setVisible(true);
}
}

class URLWindow extends Frame
implements ActionListener {
TextField urlField;
Choice choice;
AppletContext appletContext;

public URLWindow(AppletContext appletContext) {
super("Shiqo Dokumentin!");

this.appletContext = appletContext;

GridBagLayout gridBag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridBag);

Label label1 = new Label("Linku i Dokumentit Tuaj",
Label.RIGHT);
gridBag.setConstraints(label1, c);
add(label1);

urlField = new TextField("http:/khg-crew.ws", 40);
urlField.addActionListener(this);
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
gridBag.setConstraints(urlField, c);
add(urlField);

Label label2 = new Label("Window/dritare per te par:",
Label.RIGHT);
c.gridwidth = 1;
c.weightx = 0.0;
gridBag.setConstraints(label2, c);
add(label2);

choice = new Choice();
choice.addItem("(browser's choice)"); //don't specify
choice.addItem("Dritare ime Personale"); //a window named
//"My Personal Window"
choice.addItem("_blank"); //a new, unnamed window
choice.addItem("_self");
choice.addItem("_parent");
choice.addItem("_top"); //the Frame that contained this
//applet
c.fill = GridBagConstraints.NONE;
c.gridwidth = GridBagConstraints.REMAINDER;
c.anchor = GridBagConstraints.WEST;
gridBag.setConstraints(choice, c);
add(choice);

Button button = new Button("Show document");
button.addActionListener(this);
c.weighty = 1.0;
c.ipadx = 10;
c.ipady = 10;
c.insets = new Insets(5,0,0,0);
c.anchor = GridBagConstraints.SOUTH;
gridBag.setConstraints(button, c);
add(button);

addWindowListener(new WindowAdapter() {
publicvoid windowClosing(WindowEvent event) {
setVisible(false);
}
});
}

publicvoid actionPerformed(ActionEvent event) {
String urlString = urlField.getText();
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
System.err.println("Malformed URL: " + urlString);
}

if (url != null) {
if (choice.getSelectedIndex() == 0) {
appletContext.showDocument(url);
} else {
appletContext.showDocument(url,
choice.getSelectedItem());
}
}
}
}
Mbrapsht nė krye Shko poshtė
Shiko profilin e anėtarit
 
Ja Nje Aplikacion Vijuesi ne Java
Mbrapsht nė krye 
Faqja 1 e 1

Drejtat e ktij Forumit:Ju nuk mund ti pėrgjigjeni temave tė kėtij forumi
AlbaOne :: Informatika, Shkarkime :: Gjuhe programuese :: Java Script-
Kėrce tek: