Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures

Home

Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips

Books

Submit News
Search the site here...
Search...
 
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

Java Newsletters Archive: 9

JavaFAQ Home » Java Newsletters Go to all tips in Java Newsletters


Bookmark and Share

******************************************************************
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *
* > The Java FAQ Daily Tips, weekly publication < *
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *
* *
* Issue No: 9 1 November 2000 *
* http://www.javafaq.nu/java *
* *
* *
* Please recommend us to your friends and colleagues! *
******************************************************************

Table of Contents

> How would I add a help file to a java application?
> How do I encode the value of a variable of type long (or int) into bytes?
> Is there any Java API allowing creating easily PDF files (Adobe Acrobat type) including images?
> Are there any public domain matrix/linear algebra java packages out there?
> Again about Swing
> Does anyone know how to write multi-line string in Java?
> I need to include a few " in a string. How can I do this?
******************************************************************

We have one book more now on our site!
"Shlurrrpp......Java" is as authors say
the first user-friendly tutorial on Java.

You can also load it! Please check it here:
http://www.javafaq.nu/book_shlurrrpp/1/index.shtml


Tip 1

How would I add a help file to a java application?
Would it have to be platform specific, or is there a Java api for
making help files? If so, what is it?

A: See JavaHelp at http://www.javasoft.com/products/javahelp/
you create HTML pages for the main text, and add some XML files
for a hierarchical table of contents and a map from TOC tags to
relative URLs giving document locations.

******************************************************************

Tip 2

How do I encode the value of a variable of type long (or int) into
bytes? And how do I restore the original value of the long (or int)
variable back?

How do I encode the value of a variable of type long (or int) into
bytes such that the number of bytes used will always be the same,
say 4 bytes?

int in; ...
byte b1 = (byte)(in & 0xff);
byte b2 = (byte)((in >> Cool & 0xff);
byte b3 = (byte)((in >> 16) & 0xff);
byte b4 = (byte)(in >>> 24);

: How do I restore the original value of the long (or int)
: variable back
: from the bytes that i have just created then?

int in = (b1 & 0xff) | ((b2 << Cool & 0xff00) |
((b3 << 24) >>> Cool | (b4 << 24);




******************************************************************

Tip 3

Is there any Java API allowing creating easily PDF files
(Adobe Acrobat type) including images?

No, just text
Etymon™ PJ is a developer toolkit for parsing, modifying, and
creating PDF documents.
http://www.etymon.com/pj/index.html



Tip 4

Are there any public domain matrix/linear algebra java packages out
there?
I'm mainly interested in solving systems of equations and finding
matrix inverses.

A: http://math.nist.gov/javanumerics/
The JavaNumerics page provides a focal point for information on
numerical computing in Java.




******************************************************************

Tip 5


Swing is "lightweight" components. Its graphics primitives are
implemented in 100% Pure Java. How does it draw pixels on screen?

Does it still rely on any native code to access the frame buffer?

Answer: We mentioned before in our tips that Swing components is
100% pure Java.
It isn't fully correctly if we are speaking about containers on
which they can draw. Swing is still based on AWT, and even Swing
components must have at least one heavyweight container. In other
words, JFrame, JApplet are *not* lightweight.

******************************************************************

Tip 6


Does anyone know how to write multi-line string in Java?

Something like this:

String a =
"This is a
multiline string.";

It is really pain to print HTML or XML from the Java program.
Perl offer something like this:

print <

this is html.




END_HTML;

Answer: Try this:
String a = "This is a multiline string"

A " " stands for a line feed. Take a look at the
Java language specification (downloadable on Sun's site), it has
a section about strings.

A2: You mean like this?

String a = "" +
" " +
"

this is html.

" +
" " +
"";

******************************************************************

Tip 7

I am doing some servlet programming and I need to include
a few " in a string. How can I do this?

A: By using the escape character like so:
String s = """;




The Java FAQ Daily Tips is a newsletter that is only sent to those
who have specifically subscribed to it.


John Andersson, Editor mailto:info@javafaq.nu

To subscribe to The Java FAQ Daily
print in subject field: "Subscribe" and
mailto:subscription@javafaq.nu

To unsubscribe print in subject field: "Unsubscribe"
mailto:subscription@javafaq.nu

Copyright (c) 2000 John Andersson
-------------------------------------------------------------------
You can find our tips on site also!
Please recommend us to your friends and colleagues!


 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search



Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy