Solved

Java Button Link

Posted on 1997-06-02
4
239 Views
Last Modified: 2010-04-16
How you setup a link, in java. When you click a button it will go to a hyperlink. I'm using Visual Cafe, I have my Button setup and my link setup. I used an Interaction Wizard between the two, and what I like to do is when I click this button it will go to this URL. Is there a single line of command or two, if I click this button it will go to a URL.
0
Comment
Question by:zomega
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:zomega
ID: 1221153
Since I'm here, How to you open a file and write into a file. To the server??
0
 

Author Comment

by:zomega
ID: 1221154
Edited text of question
0
 
LVL 6

Accepted Solution

by:
jpk041897 earned 150 total points
ID: 1221155
Eegarding your first question:

Use ShowDocument()

The showDocument() member is documented as follows:

void showDocument(URL url, String target)

· Requests that the browser show the specified document in a particular location either a browser window or a Netscape frame.

Options for target:
Value Document Displayed in:

· "_self" Current Frame
· "_parent" Parent Frame
· "_top" Top-most Frame
· "_blank" In a new and unnamed browser window
· "aNameofYourChoice" Creates a new browser window with the specified name. You may later display other documents in this window by using the same name as the target.

If you use "_self" as a target, the document will be loaded on the same Browser window in both IE and Netscape.

Don't be misslead by the frame part, if your document does not use frames, it will assume that the _self frame is the current page.

Regarding your second question

The simplest way tio do this is by assigning a URLConnection to a stream. A rather general eaxample would be:

String url = "http://" + getCodeBase().getHost() + "/file.dat";
DataInputStream data;
String line;

try{
try{
URL theURL = new URL("http", getCodeBase().getHost(), 80, "/rooms.dat");

data = new DataInputStream(new BufferedInputStream( theURL.openStream()));
while ((line = data.readLine()) != null) {
// whatever you want to do with the data
}
}catch( MalformedURLException e ) {
// process file not found error
}
}catch (IOException e) {
//Process I/O error
}
}

Of course, the type of stream you use will depend on exactly what it is that you want to do.

Writing to the URL is accomplished in the same fashion, just use writeLine instead of readLine.

For somewhat extensive coverage on the different types of streams you can use (and their methods) see:

http://www.mcp.com/que/et/se_java2e/18javafi.htm 


Just remember to asosiate a URLConection to whatever Stream type you decide to use.
0
 

Expert Comment

by:bill.m
ID: 1221156
If you don't care about Internet Explorer support, then
JavaScript supports that by just assigning a value to
the "location" variable (window.location).

But the aspect of LiveConnect that you'd have to use
(involving JSObject) is only supported under Netscape Nav 3.0.
(LiveConnect is the protocol for communicating between
Java and JavaScript.

I recall encountering something in Java (w/o JS) to
do it, but I can't remember at the moment.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question