Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Java Button Link

Posted on 1997-06-02
4
Medium Priority
?
248 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 300 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

730 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