Article View: aus.computers.java
Article #700URL
From: Richie
Date: Mon, 22 May 2000 00:00
Date: Mon, 22 May 2000 00:00
117 lines
4189 bytes
4189 bytes
HI my names Richie and i'm 13. I'm writeing this application for my dad
that when you press a button it transferes you to the site. I'm using
Jbuilder 2. This is the code.
package Project;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.lang.*;
import borland.jbcl.control.*;
import borland.jbcl.layout.*;
public class Frame1 extends DecoratedFrame {
file://Construct the frame
MenuBar menuBar1 = new MenuBar();
Menu menuFile = new Menu();
MenuItem menuFileExit = new MenuItem();
MenuItem menuFileZD = new MenuItem();
MenuItem Yahoo = new MenuItem();
MenuItem menuItem1 = new MenuItem();
CheckboxPanel checkboxPanel1 = new CheckboxPanel();
FlowLayout flowLayout1 = new FlowLayout();
TextArea opinion = new TextArea();
BevelPanel bevelPanel1 = new BevelPanel();
Button No = new Button();
Button Yes = new Button();
FlowLayout flowLayout2 = new FlowLayout();
public Frame1() {
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
file://Component initialization
private void jbInit() throws Exception {
this.setLayout(flowLayout1);
this.setSize(new Dimension(475, 450));
this.setTitle("Frame");
menuFile.setLabel("File");
menuFileExit.setLabel("Exit");
menuFileZD.setFont(new Font("Dialog", 0, 12));
menuFileZD.setLabel("ZD Net");
menuFileZD.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
menuFileZD_actionPerformed(e);
}
});
Yahoo.setLabel("Yahoo");
menuItem1.setEnabled(false);
checkboxPanel1.setGrouped(true);
checkboxPanel1.setLabels(new String[] {"Yahoo", "ZD Net", "None"});
checkboxPanel1.setSelectedLabels(new String[] {"None"});
checkboxPanel1.setSelectedLabel("");
checkboxPanel1.setTextureName("");
opinion.setBackground(Color.white);
opinion.setText("What is your opinion of this Java applet");
bevelPanel1.setOpaque(false);
bevelPanel1.setVisible(false);
No.setLabel("button1");
Yes.setLabel("button2");
bevelPanel1.setLayout(flowLayout2);
opinion.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(KeyEvent e) {
opinion_keyPressed(e);
}
});
menuItem1.setLabel("New Link");
menuFileExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fileExit_actionPerformed(e);
}
});
this.setBackground(SystemColor.info);
menuFile.add(menuItem1);
menuFile.add(Yahoo);
menuFile.add(menuFileZD);
menuFile.addSeparator();
menuFile.add(menuFileExit);
menuBar1.add(menuFile);
this.add(checkboxPanel1, BorderLayout.CENTER);
this.add(opinion, null);
this.add(bevelPanel1, null);
bevelPanel1.add(Yes, null);
bevelPanel1.add(No, null);
this.setMenuBar(menuBar1);
}
file://File | Exit action performed
public void fileExit_actionPerformed(ActionEvent e) {
System.exit(0);
}
public void menuFileZD_actionPerformed(ActionEvent evt) {
URL url = null;
try {
url = new URL("http://www.mp3corner.net/hitmix.shtml");
}
catch (MalformedURLException a) {
System.out.println("Bad url :" + url);
}
}
}
The end bit is what I think needs something to chage to the page. I tried to
put in this but it wouldn't allow it,
getAppletContext().showDocument(url);
Technical Details
Message-ID:
<8gc02r$kq4$1@news7.svr.pol.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,ae3fff3b0d8f1b0f,start X-Google-Attributes: gid10d6db,public From: "Richie" <Richard-Scott@ty-chwcham.freeserve.co.uk> Subject: URL Date: 2000/05/22 Message-ID: <8gc02r$kq4$1@news7.svr.pol.co.uk> X-Deja-AN: 625961412 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Complaints-To: abuse@theplanet.net X-Trace: news7.svr.pol.co.uk 959021979 21316 62.136.88.214 (22 May 2000 18:59:39 GMT) Organization: Customer of Planet Online X-MSMail-Priority: Normal NNTP-Posting-Date: 22 May 2000 18:59:39 GMT Newsgroups: aus.computers.java