Sagewire Logo

java api RSS Feed

Recent Posts View Recent Posts | View Archived Posts

Message from Hal Vaughan
Most recent post: 5/4/2007
3 authors and 7 replies.

I have been trying to Google for this, but considering one of the terms
is "screenshot," it's almost impossible to get past the noise on this. I
want to have my program take a screenshot of the entire screen when a
button in a Swing window is pressed. I do mean I need a full screenshot,
as in not just the JAVA windows, but everything on the screen at that time.

I admit I do not know the graphics API (application programming interface)too well, but I can not find a reference
to any thing in there. If I have missed the obvious, it'd certainly make
things a lot easier. I figure, though, I will need to find an open source
class somewhere that does this.

Thanks for any help or suggestions!

Hal read more about Taking a Screenshot in JAVA


Message from Singleton
Most recent post: 1/24/2006
4 authors and 4 replies.

How do I write a JAVA program that does not have any "public static void

main(String[] args)" method and prints "Hello World" to the console ? read more about Hello world with main?? need help


Message from Wayne Gibson
Most recent post: 1/17/2006
4 authors and 8 replies.

Hi,
I need some advise with a JAVA applet. I am nearing completing of the
project and am getting a little concerned how long it is taking for the
applet to load. I've developed the JAVA applet with Jbuilder using the
JDK 1.1.8 as I need to support users with that have not installed the latest
version of the JAVA Runtime.

So I've been searching the internet trying to see how to speed up the
loading process. I have notice that some applets on the web have a loader,
that displays a nice background image and shows a progress bar of the jar
files downloading. These applets are not using the JAVA 1.4 parameters to
display a background.

So I have been trying to achieve this, but for the life of me I can not find any
examples of how to do this!!! Which is very frustrating as I know it's
possible.
Whilst on my search I noticed a few people talking about preloaders, where
the jar files are downloaded on a previous page showing a progress bar.
Then once all the files have been download it redirects the user to the page
with the applet.

So the question is, does anybody have any examples for either of the two
options?

Many thanks

Wayne read more about Help with Multi Jar Files


Message from Wayne Gibson
Most recent post: 1/10/2006
2 authors and 4 replies.

Hi,
Was wondering if somebody could help..

I've a semi-large applet that I want to show the progress of whilst it's
being loaded and need to cater for the users running the JDK 1.1 runtime.

Any samples or references?

Thanks

Wayne Gibson read more about Applet Loader


Message from Asif Khan
Most recent post: 11/17/2005
2 authors and 2 replies.

Exception in thread "main" JAVA.lang.UnsatisfiedLinkError: no QTJAVA in
JAVA.lib
rary.path
at JAVA.lang.ClassLoader.loadLibrary(Unknown Source)
at JAVA.lang.Runtime.loadLibrary0(Unknown Source)
at JAVA.lang.System.loadLibrary(Unknown Source)
at quicktime.jdirect.JDirectLinker$1.run(JDirectLinker.JAVA:266)
at JAVA.security.AccessController.doPrivileged(Native Method)
at
quicktime.jdirect.JDirectLinker$1$PrivelegedAction.establish(JDirectL
inker.JAVA:264)
at quicktime.jdirect.JDirectLinker.<clinit>(JDirectLinker.JAVA:272)
at quicktime.jdirect.QTNative.loadQT(QTNative.JAVA:11)
at quicktime.jdirect.QuickTimeLib.<clinit>(QuickTimeLib.JAVA:17)
at quicktime.QTSession.<clinit>(QTSession.JAVA:106)
at Zoo1.main(Zoo1.JAVA:89)I've this JAVA program using Quick Time Movie APIs of JAVA. It compiles
fine, but upon execution it gives the above runtime error.

I've JAVA 1.3 installed and have the classpath set right. Can you advise
what the problem could be?

In the program, I've imported the following:

import JAVA.io.IOException;
import JAVA.io.*;
import quicktime.QTSession;
import quicktime.QTException;
import quicktime.app.QTFactory;
import quicktime.io.OpenMovieFile;
import quicktime.std.movies.Movie;
import quicktime.*;
import quicktime.qd.*;
import quicktime.std.*;
import quicktime.io.QTFile;
import quicktime.std.StdQTConstants read more about quicktime for JAVA


Message from Thomas G. Marshall
Most recent post: 5/9/2005
2 authors and 4 replies.

This message is sent to these newsgroups because they are no longer valid:

comp.lang.JAVA
comp.lang.JAVA.api
comp.lang.JAVA.bugs
comp.lang.JAVA.misc
comp.lang.JAVA.setup
comp.lang.JAVA.tech

These are long since retired newsgroups. You may have ended up in one by
posting on google groups, or verizon, or any number of ISP's that still
carry them (and shouldn't). You'll get a *far* better audience by
redirecting your future posts to one of the "officially active" newsgroups
below.

Here are the JAVA groups with descriptions, as posted monthly in
news.announce.newgroups, under the subject "List of Big Eight Newsgroups":

http://groups-beta.google.com/group/news.announce.newgroups/browse_frm/thread/f5264fa272cf2cbb/1edfac4b68b6de8c#1edfac4b68b6de8ccomp.lang.JAVA.3d 3D Graphics API's for the JAVA language.
comp.lang.JAVA.advocacy Support for and criticism of the JAVA System.
comp.lang.JAVA.announce Announcements re the JAVA System. (Moderated)
comp.lang.JAVA.beans JAVA software components (JAVABeans).
comp.lang.JAVA.corba Topics relating to JAVA and CORBA.
comp.lang.JAVA.databases Databases, JAVA.sql, JDBC, ODBC.
comp.lang.JAVA.gui GUI toolkits and windowing: AWT, IFC etc.
comp.lang.JAVA.help Set-up problems, catch-all first aid.
comp.lang.JAVA.machine JVM, native methods, hardware.
comp.lang.JAVA.programmer Programming in the JAVA language.
comp.lang.JAVA.security Security issues raised by J read more about *NOTE* This is a RETIRED JAVA newsgroup. Please redirect.


Message from bandreescup
Most recent post: 11/23/2004
5 authors and 5 replies.

Does anybody know where could I download the JAVAx.xml.parsers package
from? I'm new in the JAVA-xml field... read more about JAVAx.xml.Parsers location


Message from karwan1982
Most recent post: 11/19/2004
3 authors and 3 replies.

Dear:Miss/Mr

May I know where can I get the JAVA software that just similiar to VB
which can be drag and drop for the GUI design.

Thanks read more about JAVA GUI DESIGN SOFTWARE


Message from karwan1982
Most recent post: 11/19/2004
2 authors and 2 replies.

Dear Mr/Ms

Here I submmited my coding to all of you, could you please check for
me which line of coding statement is error.
I can't link to Client Registration frame when I click the New Client
button in my ServiceRequest frame. when I click the new client
button,it successful link to the client registration frame but all the
GUI in client registration cannot be see. so thanks for your help...

here I attach my coding:
******************************************************************************
ServiceRequest frame

import JAVA.awt.*;
import JAVA.awt.event.*;
import JAVA.applet.Applet;
import JAVAx.swing.*;

public class ServiceRequest extends Applet implements ActionListener {
JLabel label_1;
JLabel label_2;
JLabel label_3;
JLabel label_4;
JLabel label_5;
JLabel label_6;
JScrollBar scrollbar_v_1;
JLabel label_7;
JComboBox combobox_1;
JLabel label_8;
JTextArea textarea_1;
JScrollPane sp_textarea_1;
JTextField textfield_1;
JButton button_1;
JButton button_2;
JButton button_3;
JTextField textfield_2;
JTextField textfield_3;
JTextField textfield_4;
JTextField textfield_5;

public void init() {
ServiceRequestLayout customLayout = new
ServiceRequestLayout();

setFont(new Font("Helvetica", Font.PLAIN, 12));
setLayout(customLayout);

label_1 = new JLabel("Client Service Request");
add(label_1);

lab read more about Button calling Event failure


Message from dba_222
Most recent post: 11/19/2004
5 authors and 7 replies.

Dear Experts,

I'm attempting to marry a system to an Oracle 817 datbase.
Oracle is my specialty, the back end mainly, so I do not
know much about JAVA or JAVAscript.

The system uses JAVAscript to make ODBC calls to the db.

The particular system I'm working with, won't work
with an Oracle stored procedure I'm told. However, it
will work with a stored function.

I made a simple function in Oracle to return a single
integer. It works in sqlplus, but not via JAVAscript.-----------------------

Create or replace function fnc_rtn_integer
Return integer
As
Ln_temp integer := 0;
Begin
Select count(*)
Into ln_temp
From dual;
Return LN_TEMP;

End;-----------------------
Sqlplus:

declare
ln_temp integer := -1;
begin
ln_temp := fnc_rtn_integer;
dbms_output.put_line (ln_temp);
end;

1-----------------------
JAVAscript:ESC.tb.pop_addr=1;{call fnc_rtn_integer}

Netscape Privledge Manager exception
netscape.security.ForbiddenTargetException: access to target denied
davox.host.AnswerSoftDB:Using local character set: 0 :
davox.host.AnswerSoftDB:? [State: S1000] [Oracle][ODBC][Ora]ORA-24334:
no descriptor for this position

davox.host.AnswerSoftDB:-2 ? [State: S1000]
[Oracle][ODBC][Ora]ORA-24334: no descriptor for this position

davox.host.HostConn:get ESC.tb.pop_addr Host -2 ? [State: S1000]
[Oracle][ODBC][Ora]ORA-24334: no descriptor for this position

-----------------------
2)

The developers need to get a nu read more about JAVAscript, ODBC, and Oracle functions returning cursors


Message from Klaic
Most recent post: 11/19/2004
2 authors and 2 replies.

Every time I compile my source I get this error message:

JAVAx doesn't exist

I guess my compiler can not find or does not reference to this package.
Do I need to download this package and where? or I need to do something
else? read more about JAVAx


Message from splash78kas
Most recent post: 11/10/2004
2 authors and 2 replies.

Hi:
Is there a publicly avalaible JAVA financial library which can do
things like calculating interests ..simple, compound and other common
financial calculations.

tia

splash read more about JAVA financial api


Message from pdnews
Most recent post: 10/21/2004
2 authors and 4 replies.

I obtain an InputStream from a JAVA.net.URLConnection and need to read
bytes from it until EOF. If I call available(), create an array
of byte[] of that size and read that amount, I don't get the entire
content. Why does not available return the entire size of the response?
Also, what is the best way to read the response up until EOF?
I need binary data, because the content is a PDF file.
TIA read more about reading bytes from an inputstream


Message from Paul Woodman
Most recent post: 10/15/2004
2 authors and 3 replies.

I have got a windows service executable that starts a COM+ application dll
that, when started, calls JNI_CreateJAVAVM to invoke the JAVA Virtual
Machine.
When the machine is logged off though, the COM+ dll stops running.
If I comment out the call to JNI_CreateJAVAVM, the COM+ dll remains running
on log out.
Anyone any ideas as to why?Can JAVAVM be used in this way, ie does the fact
it's run from a service cause thread issues which'd explain this
problem?

Thanks in advance read more about Invoking JAVAVM from a Service


Message from ypjofficial
Most recent post: 9/13/2004
3 authors and 3 replies.

Does "JAVA apis for gui development(swing and awt)" for Windows use
the underlying windows API (application programming interface)at its core ?
As I read it that
a)it is completely impossible to avoid the "standard windows look and
feel" when using the windows api.
b)it is also difficult on Windows to develop a rich gui program
without using the Windows api.
JAVA has a very rich set of gui elements and that also are totally
different from windows look and feel.regards,
Yogesh P Joshi read more about JAVA gui and windows api


Message from vsrirama
Most recent post: 9/13/2004
9 authors and 15 replies.

Hi,
I've wriiten a program to transfer a binary file.

After transfer. The file contents in the destination machine is getting
changed.

Please Help. Please advice if I am doing any wrong. The number of bytes getting transfered
is correct. only some of the bytes in the file (in the destination machine)
are different.

I dont know why is this happening. I've appened code segment.

{

Socket ds = new Socket(serverName, dataPort);

if ( f.sendCommand("type I" + f.eol, true) ) {
System.out.println("Main: bi");
System.out.println("bi results: " + f.cmdResponse );
String filePath="C:\\sri.bin";
int line = 0;

File f = new File(filePath);
FileInputStream srCFILE = new FileInputStream(f);
BufferedInputStream bufFile = new BufferedInputStream(srcFile);
DataInputStream inData = new DataInputStream(bufFile);

OUT = new PrintWriter( ds.getOutputStream(), true );
OUT.write("TYPE I"); /* setting transfer mode = BINARY */
while ((line=inData.read()) != -1 ){
OUT.write(line);
}
OUT.flush();
OUT.close() ;

}

Regards,
Ram read more about FTP File Transfer; file contents getting changed ?


Message from l.cleran
Most recent post: 9/2/2004
3 authors and 3 replies.

Hi all,

I'd like having more informations on how we could exchange
informations and/or objects between PERL and JAVA.

We've a JAVA programs that open, maintain and close telnet
connections, for PERL scripts...

Is it possible, to echange the JAVA telnet session object to PERL
programs ? Or thoses two languages couldn't exchange objects or such
structure ?

If it's not possible, how could I exchange textual informations
between a JAVA program and a PERL script on the same UNIX computer ?
Socket, Pipe,... ?

Or mayby, there is another solution ?

Thanks a lot for your help.

Best regards.

Lionel. read more about Exange of informations and objects between PERL and JAVA


Message from chris.marko
Most recent post: 8/27/2004
2 authors and 2 replies.

Hi!

Does anyone have experiences with the COMM API (application programming interface)and the usage of the
PCMCIA port? With the COMM API (application programming interface)the PCMCIA ports should also be found,
or not?

I've a PCMCIA port on my notebook, but this port won't be found, by
the appropriate class of the COMM API. As I read in other posts, the
port should be found. Can anyone help me?

Regards
Chris read more about COMM API (application programming interface)and PCMCIA


Message from jonathanm
Most recent post: 8/26/2004
2 authors and 8 replies.

I'm having issues dealing with Locale under 1.4.1_03-b02. The problem
seems to be with the JAVA Runtime having problems reading the system
locale. My system locale is set to UK, but when I run a test program
(code below) I get the date formatted to a US locale instead of UK. I
ran the same program under 1.4.2_03 on win xp, and 1.4.2_04-b05 on
win2k which both worked fine. Running the same program under 1.4.1_03
on win xp and win 2k results in the problem. Does anyone know of a
workaround to this problem without upgrading to 1.4.2_03 or higher?
Also does anyone know what the minimum version we should've if we
did decide to upgrade JRE's?

Thanks,

Jonathanimport JAVA.util.*;
import JAVA.text.*;

public class LocaleTest
{
public static void main(String[] args)
{
DateFormat format = DateFormat.getDateInstanc(DateFormat.SHORT);
format.setCalendar(Calendar.getInstance());
format.getCalendar().set(Calendar.MILLISECOND,0);
format.getCalendar().set(Calendar.SECOND,0);
format.getCalendar().set(Calendar.MINUTE,0);
format.getCalendar().set(Calendar.HOUR,0);
System.out.println("date is "+
format.format(format.getCalendar().getTime()));
}
} read more about Locale problems in 1.4.1_03-b02


Message from grisha
Most recent post: 8/23/2004
7 authors and 9 replies.

Hi all,

Here's an idea for a framework I thought about because I can make use
of it in my project. Maybe such a thing exists,
if so, I'd like pointers; if not, I will start working on it myself.

The project is for JAVA, so ...

I want something that'd make it easier for various modules to be
able to instrument themselves so they can
write logs, which can later be parsed again for replaying
the original behavior. (If that helps, consider something like
a recordable app on a Mac, where AppleScript can be used
to play it back).

P.S. Forgive my crossposting, but I hope google's posting DTRT, and
what really is the difference between, say, comp.lang.JAVA.programmer
and comp.lang.JAVA.developer; and what are comp.lang.JAVA.misc and
comp.lang.JAVA.help supposed to do above and beyond comp.lang.JAVA? read more about An idea for a framework (does such a thing exist?)


Message from marco.montestruque
Most recent post: 8/23/2004
2 authors and 2 replies.

Hi,

Is there an API (application programming interface)that allows me to merge PDF files from JAVA?
thanks

Marco read more about Merging PDF files


Message from Tony Lockyer
Most recent post: 7/28/2004
2 authors and 2 replies.

I'm trying to customize the output of JAVA Logger (format the output)
like you can do using Log4J. Anyone know if it is possible? read more about JAVA Logger vs Log4J


Message from Maurice Hulsman
Most recent post: 7/25/2004
2 authors and 2 replies.

LS,

concider the following (ran on a winxp machine under jdk1.3.1)

1: out.println(new Locale("nl", "BE").getDisplayLanguage(new Locale("en",
"US")))
Belgium



2: out.println(new Locale("nl", "BE").getDisplayLanguage(new Locale("nl",
"NL")))
België



3: out.println(new Locale("en", "US").getDisplayLanguage(new Locale("en",
"US")))
english



4: out.println(new Locale("en", "US").getDisplayLanguage(new Locale("nl",
"NL")))
english



line 1, 2 and 3 function properly
line 4 does not, I'd expect "engels" (which is the dutch translation of
"english")

we already determined this behaviour is caused by the
<JAVA_home>/jre/lib/i18n.jar, which is not fitted with al of the language
specific details.
We know this because when I unpack the jar, decompile the class
JAVA.text.resources.LocaleElements_nl, add translation "engels"* and compile
and jar again, line 4 functions properly

my question is as follows:

Does anybody know the proper way to do this, eg: without decompiling the
i18n.jar
I can not imagine sun proposes such a way.
I can not find any references to how this should be done properly.

Maurice Hulsman
maurice.hulsman@xxxxxxxxxxx

*) if somebody'd like to know exactly what we did, you can always ask read more about i18n problem, involving Locale.getDisplayLanguage and Locale.getDisplayCountry


Message from hasanbabu
Most recent post: 7/21/2004
2 authors and 2 replies.

I too do have the same problem. My bean updates a log file which is
accessed by an absolute path. "C:\Apache Software\Tomcat
5\webapps\myApp\log.txt". But due to this it's difficult for me to
port my application to a different machine. Each time I have to edit
the JAVA file and recompile.

Is there any way to find the current filepath at run time. This
would solve many of my tomcat problems.

Hasan Babu H read more about relative path


Message from alisyedm
Most recent post: 7/9/2004
3 authors and 3 replies.

Hi all,

I am working on a conversion code (from C++ to JAVA) - now in C++
there is a Rougwave Hashtable that can create hashtables with the
contains() or equals() method which does lookups based on values....

However in JAVA the hashtable looksup objects based on
Object-Reference, so the following lookup fails in JAVA and works in
C,

(Hashtable containing an Object called MyObject with Key as a simple
object as Integer)

JAVA version:

Hashtable myHash = new Hashtable();

Integer I = new Integer(1);
Integer j = new Integer(1);
// I & j are same values but different objects in
memory

MyObject myObj = new MyObject();

MyObject tmpObj = null;

// Adding myObj into myHash
myHash.put(i, myObj);

// Now logically tmpObj should get the myObj ref.
tmpObj = myHash.get(j);

// But tmpObj will be null cuz I & j are different
wrote in message my own methods, which get
Objects from hashtable based on the keyType - i.e. for the key as
wrote in message hash.getUsingInt() - which extracts Enumeration from
the hash, and then compares the keys (Integer's values) to find the
match...

This works, but I am sure it makes the processing slow... (I think?)

Please help if you got any ideas to improve performance !!!! read more about JAVA Hashtable performance for contains() method.


Message from grisha
Most recent post: 7/8/2004
2 authors and 4 replies.

Hi all,

Has anyone come across documentation that thoroughly describes metadata
functionality that will be available in JDK 1.5? I only saw some brief
examples of what it's supposed to do, and I downloaded JDK, but I can not find
any docs. Any pointers? read more about JDK 1.5 metadata feature docs?


Message from plusaquac
Most recent post: 7/8/2004
4 authors and 6 replies.

Hi.

Is there a way to get an unbuffered InputStream from Process?

I found out that JAVA.lang.Win32Process and JAVA.lang.UNIXProcess both
wraps the stdout with JAVA.io.BufferedInputStream, but I need an
unbuffered one. read more about How can I get unbuffered InputStream from Process?


Message from gundamseed
Most recent post: 7/1/2004
2 authors and 2 replies.

Brief description:

1) HTMLBrower (my class which extends JEditorPane) is initialized with an
HTML file.
2) I'm passing this HTMLBrowser object into a thread.
3) The thread is listening to a server process and will call setPage( ) from
HTMLBrowser when the condition is met.

Sometimes, I got the following exceptions. Problem is, it doesn't thrown
all the time.
JAVA.lang.ArrayIndexOutOfBoundsException: 0
at
JAVAx.swing.text.html.BlockView.layoutMinorAxis(BlockView.JAVA:273)
at JAVAx.swing.text.BoxView.setSpanOnAxis(BoxView.JAVA(Compiled
Code))
at JAVAx.swing.text.BoxView.layout(BoxView.JAVA(Compiled Code))
at JAVAx.swing.text.BoxView.setSize(BoxView.JAVA(Compiled Code))
at
JAVAx.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.JAVA:1639)
at
JAVAx.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.JAVA:1358)
at
JAVAx.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.JAVA:668)
at JAVAx.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.JAVA:802)
at JAVAx.swing.plaf.basic.BasicTextUI.update(BasicTextUI.JAVA:781)
at JAVAx.swing.JComponent.paintComponent(JComponent.JAVA:574)
at JAVAx.swing.JComponent.paint(JComponent.JAVA:841)
at
com.ibm.ws.install.htmlshell.uicomponents.HTMLBrowser.paint(HTMLBrowser.JAVA
:114)
at
JAVAx.swing.JComponent.paintWithOffscreenBuffer(JComponent.JAVA:4910)
at JAVAx.swing.JComponent.paintDoubleBuffered read more about ArrayIndexOutOfBoundsException - Pls help


Message from massmail
Most recent post: 6/29/2004
2 authors and 2 replies.

I've a jar (cfg.jar) which contains a configuration file (cfg.txt)
for an application. The format of the configuration file is such that
the '#' char at the beginning of the line indicates comments to be
ignored. The uncommented lines contain key value strings for the
application. Below is the first few lines of the expanded
configuration file
#****************************************************
# Lines beginning with "#" char are comments.
SEQUENCE_SELECT_DISAPPEAR_PAUSE=500
#****************************************************
# Pause duration after sequence finishes
SEQUENCE_SELECT_REAPPEAR_PAUSE=250The following code outputs no lines of the compressed cfg.txt file.
When the System.out.println line is uncommented in main, the output
looks as follows:

false
#****************************************************
truepublic class ReadJarCFG
{
public static void main(String[]args){
try{
MyJarLineReader reader = new MyJarLineReader();
String line = reader.readLine();
while(line != null){
System.out.println(line == null);
if( line.startsWith("#") ){
//System.out.println(line);
line = reader.readLine();
System.out.println(line == null);
}
else{
System.out.println(line);
line = reader.readLine();
}
}
}catch(IOException e2){System.out.println("Exception caught");}
}
}

class MyJarLineReader
{
String CFGJAR = new String("C:\\Program
Files\\LptJarResrcs\\ReadJar\\cfg.jar") read more about readLine from a Jar file


Message from jas_2_cool
Most recent post: 6/24/2004
2 authors and 2 replies.

Hi,

Is there an equivalent of the C function:

char* strerror (int errno); (defined in string.h)

in JAVA? I need to obtain the corresponding error string for the error
code returned by a process, in my JAVA code.

Thanks,
Jaskaran read more about strerror equivalent JAVA


Message from _mario.lat
Most recent post: 6/9/2004
2 authors and 2 replies.

I'd like to know the mouse position out the window.
No the position in the window program but the coordinates whe the mouse is
out of the program window.
I try to do it in a lot's of way... but I can not: how can I do?
Thank you in advance, Mario. read more about get mouse position out of the windows:how?


Message from rosheni9999
Most recent post: 6/9/2004
2 authors and 2 replies.

Hi

I am using the response.sendRedirect(url) method. url is path to
another servlet. Example:

response.sendRedirect(response.encodeRedirectURL
("/EcBugManager/servlet/bugmanager.bugmanager.gui.BugsheetPage?
type="+bugsheetType+"&page="+page);

I am using the response.encodeRedirectURL to encode the url as I dont
want the parameters to be seen in the explorer - address bar.

?? But nothing happens, it just returns the same string with all the
paramteers without being encoded.

Am I using the correct way to encode the url, or is there another way
to do it.

Please, help me on this
Thanks for your time

Rose. read more about JAVA Help - Servlet


Message from pool0078
Most recent post: 6/9/2004
2 authors and 2 replies.

Hello.

As far as I know, to print messages whose Level is lower or equal to
FINE can be printed only when extra handler is assigned to the logger.

So, I have added the ConsoleHandler to logger like below.

Logger logger = Logger.getLogger(WildcardQueryGenerator.class.getName());
logger.setLevel(Level.FINEST);

ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.FINEST);
logger.addHandler(handler);

This works fine with Level.FINEST, or Level.FINE. What makes things
messy is Level.INFO. When I log message using logger.info(), two
messages are displayed on screen; though I have used the logger.info()
exactly once.

What's wrong with the code snippet above?

TIA
Minkoo Seo read more about JAVA.util.Logger prints message twice


Message from Oleg Konovalov
Most recent post: 6/4/2004
6 authors and 7 replies.

Hi,

I am writing a JAVA application which among many other things
has to call some Microsoft Office [PowerPoint] internal methods,
which only seems to be possible from either VBA or C#.

Can anybody suggest a way of JAVA calling VBA or C# ?

I do know how to call an executable from JAVA
or JAVA interface with C/C++ through JNI.Thank you in advance,
Oleg.

P.S.: If you know how to call PowerPoint from JAVA or VC++,
please speak out too. read more about JAVA calling C# or VBA (MS Office API) ?


Message from Oleg Konovalov
Most recent post: 6/1/2004
3 authors and 3 replies.

Hi,

I am trying to implement an application administrative tool with interactive
console
(i.e. showing some info to the user and taking user input) using Swing and
JDK 1.4.

Up until now I've done info display part after selecting items from the
menu
(using JTextArea and append() ),
but now I realized that user input has to be provided and processed.

I do not see that I can associate an i/o stream with JTextArea. Is there a
way to do that ?

Or is there other Swing widget better suitable for that ?

Please advise.

Thank you in advance,
Oleg. read more about Interactive console using Swing


Message from Asko Seeba
Most recent post: 5/22/2004
3 authors and 4 replies.

Hey,

I'm using the j2sdk1.4.2 downloaded from JAVA.sun.com. I stuck into a
problem of reading int from byte[]. I've a 4-bytes integer stored in
byte[] variable and I want to get this integer into an int variable.
Sorry, if my problem is distinctive as a newbie problem. I already had
also a communication session with google, but it did not help. I scaled
down the reproducing code of the problem:

import JAVA.io.ByteArrayInputStream;
import JAVA.io.IOException;
import JAVA.io.ObjectInputStream;

public class StreamTest {
public static void main(String[] args) {
byte[] intbytes = new byte[4];
ByteArrayInputStream is;
ObjectInputStream ois;
int result;

intbytes[0] = 0;
intbytes[1] = 0;
intbytes[2] = 0;
intbytes[3] = 0;

is = new ByteArrayInputStream(intbytes);
try {
ois = new ObjectInputStream(is);
result = ois.readInt();
System.out.println("Result: " + result);
} catch (IOException ex) {
System.out.println("Exception: " + ex.getMessage());
}
}
}

When executed, the ois = new ObjectInputStream(is) statement throws a
JAVA.io.StreamCorruptedException with message "invalid stream header".

Does anybody know how to overcome the problem? Maybe there is an
alternative way to read int from byte[]?

--
Asko Seeba read more about reading int from byte[] -> StreamCorruptedException


Message from Denis
Most recent post: 5/8/2004
2 authors and 2 replies.

Hi,
I need to do read a value from user but also give him/her a default value
which they can edit ( all in text mode, no windows) how can I do that?
For example

Enter number 1 - 1000 : 55_

55 appears
user can delete part by backspace or type extra digits
or just press enter to submit.

Please help!
very urgent !
Thank you so much !

Den read more about Default value for console input, please help


Message from brad
Most recent post: 5/7/2004
2 authors and 2 replies.

Can anyone tell me how to retrieve the RGB values from a color. I have
read through the color class and can not determine which method will
perform this task for me. Thanks for any tips.

....Brad read more about Retrieve RGB Values from a Color


Message from andreas.toresater
Most recent post: 5/6/2004
11 authors and 20 replies.

Hi group!

I am using C++ and JAVA with JNI to get some text in a RICHEDIT to my
JAVA program. I do so by accessing a C++ method every second. It all
works fine except that it leaks memory every call I make to the C++
method.

Can anyone please help me with this problem? I am not sure wether the
leakage is in the C++ or JAVA code. But I guess it's on the C++ side
since I'm kind of newbee there.

Is there perhaps a way to release the memory allocated for a LPTSTR in
C++?
Please take a look at the code below, it is the method I call every
second from JAVA. I belive it is the LPTSTR that is leaking, since it
leaks more when the string gets larger.

<---------------
LPTSTR output;

JNIEXPORT jstring JNICALL
JAVA_JNIHandler_getDealerOutput(JNIEnv *env, jobject obj){

size = SendMessage(
(HWND) textarea, // handle to destination window
WM_GETTEXTLENGTH, // message to send
(WPARAM) 0,
(LPARAM) 0 ) +1;

output = new TCHAR[size];

SendMessage(textarea,
WM_GETTEXT,
size,
(LPARAM)(void*)output);

return env->
NewStringUTF(dealerStr);

}
------------------>

I've tried to release the memory allocated when the NewStringUTF is
made with the JNI.h method env -> ReleaseStringUTFChars(str,
dealerStr) to no avail.
I hae also tried to use a try/finally block and in the finally set:
output= NULL; delete output; but there is no difference.

Cheers
Andreas read more about C++ / JNI memory leakage, help needed


Message from M
Most recent post: 5/3/2004
4 authors and 4 replies.

Hi,

Has anyone defined JAVAbeans for JAVAMail api?
Thanks. read more about JAVAmail beans


Message from Ben Munday
Most recent post: 5/2/2004
5 authors and 8 replies.

Hi all,
I've a problem with a Checkbox in a JTable.
When I add the Checkbox into the JTable it displays the String
representation of the Checkbox, which isn't what I want.
So, I created a CheckBoxRenderer which extens Checkbox and implements
TableCellRenderer. This seems to have done the job, in that the Checkbox
is displayed and not the String representation. But, and it's a big
'but', the column that holds the Checkbox continually updates the
fields. I cannot select the Checkbox and I can only just see that the
correct info for the Checkbox is in the cell.
I think it has something to do with repainting the Checkbox, but I can't
figure out how to stop it from happening.

Here is some of the code, the bit's I think are relevent:
All code is at:
http://www.users.on.net/benmunday/Label/
public class CheckBoxRenderer extends Checkbox implements TableCellRenderer
{

...

public Component getTableCellRendererComponent(JTable table, Object
cBox, boolean isSelected, boolean hasFocus, int row, int column)
{
Checkbox newCheckbox = (Checkbox)cBox;
newCheckbox.setState(false);
return newCheckbox;
}
}

JTable itemDataTable = new JTable(new MyTableModel(data));
itemDataTable.setDefaultRenderer(data[0][0].getClass(), new
CheckBoxRenderer());

itemDataScrollPane.getViewport().setView(itemDataTable);
itemDataScrollPane.setVisible(true);

contentPane.add(itemDataScrollPane, BorderLayout.CENTER); read more about Help to solve flickering Checkbox in JTable


Message from Spare Brain
Most recent post: 4/28/2004
4 authors and 4 replies.

Hi,

Even though the code defines an output file when initializing the
JAVA.util.Logger, the output always goes to the stdout. The application is
part of a WebLogic application. What needs to be done to change this
behavior? Any suggestions/hints?

Here's how the code looks:

protected final Logger logger =
Logger.getLogger(System.getProperty("JAVA.logger.logDir", "./logs") +
System.getProperty("file.separator") + getClass().getName() + ".log");
...
...
...

if (logger.isLoggable(Level.INFO)) {
logger.info("Executing static SQL query '" + sql + "'");
}
...
... read more about Logger inputs only to STDOUT?


Message from gilgantic
Most recent post: 4/26/2004
4 authors and 5 replies.

How do you deal with floating points in J2ME? From my understanding
MIDP 1.0 doesn't allow you to use float or double primitives. I want
to be able to perform a calculations which give float or double
values.

Thanks read more about J2ME: Dealing with Floating Points?


Message from WIlson Beagle
Most recent post: 4/21/2004
2 authors and 2 replies.

I've an "orphaned" website that was developed in Symantec Visual Cafe 3.0
using the class files that come with it.
If you've a licenced copy that you'd be willing to sell, please e-mail
to wilson_beagle@xxxxxxxxxxx read more about Need a copy of Visual Cafe 3.0


Message from francisardi
Most recent post: 4/19/2004
2 authors and 2 replies.

Nowadays when you obtain the SDK form JAVA.com
you get a new interactive programming environemt
much like the Borland C++ IDE.

Up to now I have been developing applications "the old way"
using the operating system command line method.

Then my computer at home crashed and I decided to install the
JDK on my office computer. This was when I got the new
Net Beans IDE. It all seemed good in theory, having eveything
conveniently in one package, the editing, compiling and
executing of your program. It even promised a way to assemble
Jar files.

The problem is that application programs which compoiled just fine
using the Command line compiler (JAVAc MyApp.JAVA) seemed to generate
numerous "can not Resolve Symbol" errors on this new IDE thing.
This is despite I had all necessary classes in the same directory.

I just do not understand. What's worse is that there are no readily
available online resources to address such issues.

Thank goodness I did not have to pay for this thingy.

I finally got my home computer up and running ag