 |
 |
Index ‹ java-programmer
|
- Previous
- 4
- javax.comm - SerialPort ProlemHi,
I tried to install the comm-extensions (with Java 1.5) and copied my files:
win32com.dll -> \myjdk\jre\bin
javax.comm.properties -> \myjdk\jre\lib
comm.jar -> \myjdk\jre\lib\ext
I'm using Eclipse.
Now to my problem:
A piece of my code:
portList = CommPortIdentifier.getPortIdentifiers();
try {
portId = CommPortIdentifier.getPortIdentifier( name );
} catch(Exception e) {System.out.println("error on comportIdentifier");}
After executing the first line portList is empty and 2 lines later a
NoSuchPortException is thrown -
it seems that I did something wrong because I don't get any portIdentifiers
at all ... but after searching for hours in the internet I only found hints
where to copy the files but nothing more ...
I would be glad if someone could help me!!
btw: I'm using WinXP
Thomas Pototschnig
- 4
- Java Interview Questions With "ANSWERS"Hi Friends,
Here is the link for "Java Interview Questions". I hope it will be
useful for all.
I collected the ANSWERS also. So, You can find answers also. Forward
the link to your friends.
Visit the following site :
http://metajai.googlepages.com/
All the Best
Yours Friendly,
Jai
- 4
- xp sp2 download problem would someone please explain to me why this routine work
on clients ranging from windows (including XP), to linux, but don't work in
my winXP clients that install SP2 ??? the download window don't appears.
OutputStream out = response.getOutputStream();
response.setContentType("application/octet-stream");
//* response.setHeader("Content-Disposition","attachment;
filename=\"" +request.getRequestURI()+ "\";");
FileInputStream fis = new FileInputStream(nomeFile);
byte[] buffer = new byte[1024];
int byteLetti;
while((byteLetti = fis.read(buffer)) != -1){
out.write(buffer, 0, byteLetti);
}
out.flush();
out.close();
fis.close();
thanks!
maz
- 5
- Mouse position while drag&drop-operationHi swing experts!
I have the following problem:
I want to move a custom Transferable via Drag&Drop from a JTree to a
JPanel.
The transferable should be shown on the JPanel on the position the
mouse is released.
The trouble is, I can't determine the mouse position on the JPanel.
The mouseListener and mouseMotionListener-routines on the JPanel
obviously don't work while in a standard-java-drag&drop operation.
For example: The JPanel doesn't fire a mouseEntered(..)-Event, when the
panel is entered during a drag&drop-operation.
So, without Mouse-Events, how do I get the drop-coordinates relative to
the JPanel?
Any clues?
Thanks in advance! Your help is very appreciated.
Best,
Michael
- 6
- Connecting J2ME application to Oracle databaseHello,
For my study I have some questions about Java J2ME:
1. Is it possible to develop a J2ME (CLDC/ MIDP) application, which has a
direct connection to a Oracle database?
2. Is there a way for using JDBC within a J2ME (CLDC/ MIDP) application?
Greetings,
Dennis
- 6
- Elipse and ATG DynamoGreetings,
I am new to Eclipse and am hoping to get it to work with ATG Dynamo.
Has anyone used Eclipse in conjunction with ATG's application server?
Eclipse does not seem to support JHTML syntax highlighting. Am I
wrong? Or is there a plug-in somewhere? Thanks.
-jay
- 6
- Struts Rapid DevelopmentHi,
I'm looking for a tool, which lets me build web applications using
struts in a rapid development manner.
I know that there exist several tools out there, however I focusing on
the commercial ones, like:
- Camino
- Adalon
- Struts Studio
Can somebody recommend one of them? Which of them is the most
sophisticated and feature reach, when it comes to building large
webapplications?
Thanks,
Fritz
- 8
- RandomAccessFile vs. FileChannelAside from memory mapped files for very large files, is there any
benefit between using the RandomAccessFile class and the FileChannel
class? They seem to be abstractions of the same low level I/O.
- 8
- Tutorial on java beansHi,
I am newbie to Java, though I know the syntax, OOP and have done
some small applications using it. Can someone suggest me a useful
tutorial to learn java beans.
Thanks in Advance
- 8
- GET and POST in jspHi,
I've been trying to get two parameters passed from a html to a jsp
page. I can read the correct values of the passed parameters but
I am having difficulties distinquishing between those values in an
if-else statement.
The idea is, I need my jsp page to know how the call to it was made. It
can be an INPUT or a VIEW mode.
I've got an entries.html which is:
<html>
<body>
<form action="DocView.jsp" method="POST" accept-charset="UTF-8">
Enter a document of type:
<SELECT NAME="doctype" SIZE=1>
<OPTION VALUE="article">article
<OPTION VALUE="book">book
<OPTION VALUE="manual">manual
</SELECT>
<INPUT TYPE="submit" VALUE="Go">
</FORM>
<BR>
<form action="DocView.jsp" method="POST" accept-charset="UTF-8">
Or view an existing document with id
<SELECT NAME="docid" SIZE=1>
<OPTION VALUE="1">1
<OPTION VALUE="2">2
<OPTION VALUE="3">3
</SELECT>
<INPUT TYPE="submit" VALUE="Go">
</FORM>
</body>
</html>
and a DocView.jsp one:
<%
String doctype = request.getParameter("doctype");
String docid = request.getParameter("docid");
String mode = "";
if(docid != "") {
mode = "VIEW";
}
else if( doctype != ""){
mode = "INPUT";
out.println("doctype = " + doctype + ", mode = " + mode +"<BR>");
out.println("docid = " + docid + ", mode = " + mode);
%>
The if-else statement should identify the type of call was made to
DocView, based on that, actions will be taken.
The code is just to demonstrate the idea of what I am doing. The
actuall code reads data from a MySQL database.
As a result of Docview.jsp I get the correct value of docid if I chose
an id value or a null if not. The same with doctype,
either the choosen doctype is displayed or a null. But the variable
mode does not change.
It is alway VIEW. Or actually it always gets the value that assigned
first to it. If I change else-if with the if statement, then the mode
will always be INPUT.
Now that leads to the conclusion that mode has to be reinitialized! but
How?
I can do the same thing with PHP, but there I can use $_GET['param']
and $_POST['param'] and different if-else statement, and it works
perfectly. Here is just a snip if the statements in PHP (sorry for
having to post a php code, but this might clearify my problem more).
$mode="";
$docid=$_GET['docid'];
$doctype=$_POST['doctype'];
if($docid!="") {
$mode="VIEW";
} else {
$docid=$_POST['docid'];
if ($doctype!="") {
$mode="INPUT";
} elseif ($docid!="") {
$mode="EDIT";
}
}
(the EDIT mode will be added to the jsp later), but this code does
exactly what I want. how can realize the same in my jsp code?
I appreciate any help on that.
Thankfully,
Michael
- 8
- You'll be alright.Hi Pandora Xero,
Even though it was more than obvious to everyone,
you felt compelled to make this confession:
" If I'm talking about anything,
I'm talking out my ass. "
Stick in there kid, You'll be alright.
P.S.
Can I help you get an ISP ?
Google is the mark of a troll.
- 8
- Acknowledgment class/deviceWe assume of having a device that generically we model with the Device
class and that will be best specified with the class VCR extension of
Device.
Moreover we assume of having an application (class) Host that knows the
class Device but not VCR;
I would to make so that the device recognizes himeself (based on its
property/features) and that the class Host make an istance of VCR.
Something like
Device dev = new VCR(... pars ...);
In practical on different devices I'll have the same classes Device and
Host and moreover for everyone device I'll have a specific class
extension of Device (is VCR, PC, Freezer etc.).
The class extension could be in one specific folder.
How to make?
Also ideas, suggestions, link
thanks
- 11
- abstract vs. finalLew wrote:
> It is not the compiler's responsibility to find test code; it's the compiler's
> responsibility to check the compilability of the artifact itself.
>
> Your idea that there should be a tool, perhaps as part of JUnit or similar
> framework, to check for test coverage is a good one.
(Isn't "test coverage" a stronger notion that just "every entity has a test",
more like "every /code path/ has a test"?)
> You could use the presence of such a tool as an evaluative factor in choosing
> an IDE.
>
> But it is no part of what the compiler should do.
Clearly we have different opinions on what compilers "should", or
perhaps "should not" do. I think it's clearly /useful/ for a compiler
to [be able to] note that there's no use made of some declared entity [1]
in some codebase and I would not apply a "should not" to remove a
useful feature. (Usual tradeoff remarks apply.)
I think I'm done.
[1] I spelled `entity` "thingy" in earlier posts, for want of remembering
the word; I'm not trying to change what I meant.
--
Chris "and you've got to be ready" Dollin
Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England
- 13
- Cell phone java questionAre there any sources of information on Java programming of Nokia phones?
Esp. w/ code examples about IRda ja network connetions...
- 16
|
| Author |
Message |
Glenn McCall

|
Posted: 2003-12-15 8:03:00 |
Top |
java-programmer, A splash screen
I am trying to create a splash screen. I would like it to be visible for a
few seconds while the application is initialising. After a timer expires,
the splash screen will close automatically. I have all of this working just
fine.
However, at some point during the application initialisation, it creates the
main window. When this occurs, the main window appears on top of the splash
screen. I would prefer that the splash screen be "top most" when this
occurs.
I have tried various combinations of toFront() and toBack() with no success
whatsoever.
How can I keep my splash screen topmost - preferably without having to mess
with "lost focus" type of events? In VC++, I could do this by creating the
splash screen window with the "TOPMOST" attribute set - but I can't find a
similar attribute in the java window classes.
TIA - Glenn Mc
P.S. For what it is worth, I have attached some snippets of the code I am
using. SplashPanel extends JPanel and contains all of the components making
up the splash screen.
public class SqlManEditor extends JFrame {
private static JWindow splash;
private static void showSplash (final int duration) {
/* final JWindow */ splash = new JWindow ();
SplashPanel content = new SplashPanel ();
splash.setContentPane(content);
splash.pack ();
// Center the splash screen in the display.
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize ();
int x = (screen.width - content.getWidth()) / 2;
int y = (screen.height - content.getHeight()) / 2;
splash.setBounds (x, y, content.getWidth(), content.getHeight());
Thread r = new Thread () {
public void run () {
// TODO: Figure out how to get the splash screen
to be "topmost"
// Currently when the main window is
created, it will appear
// in front of the splash screen.
splash.setVisible (true);
// wait for the specified number of milliseconds
try { Thread.sleep (duration); } catch (Exception e) {}
// When the timer expires hide the window and get
rid of it
splash.setVisible (false);
splash = null;
}
};
r.start ();
}
public static void main (String [] args) {
showSplash (5000);
SqlManEditor s = new SqlManEditor ();
s.toBack (); // After these two lines of
code execute
splash.toFront (); // s is in front and splash
is still in back!
}
}
|
| |
|
| |
 |
Alex Hunsley

|
Posted: 2003-12-15 9:45:00 |
Top |
java-programmer >> A splash screen
Glenn McCall wrote:
> I am trying to create a splash screen. I would like it to be visible for a
> few seconds while the application is initialising. After a timer expires,
> the splash screen will close automatically. I have all of this working just
> fine.
Hi there
just a few points, as I've tried to run your example but had a few problems.
If you post code, it helps if its complete. This includes:
1) including the correct imports
2) including all code needed to run the example - your code references a
SplashPanel class which isn't in your posted code.
Also, when writing java, it's a good idea to keep your lines within the
80 chars width limit. One of the downsides of not following this
guideline is that when you post wide code, your news posting software
may wrap the lines at 80 chars or similar, as it appears to have done in
this case. The end result is java code that has comments continuing onto
the next line, and the code won't compile without editing.
Post complete working code and I'll have a look at it!
alex
|
| |
|
| |
 |
Glenn McCall

|
Posted: 2003-12-15 12:11:00 |
Top |
java-programmer >> A splash screen
> Post complete working code and I'll have a look at it!
No problem. I can't post the complete code but here is a cut down version
that does the same thing.
You might need to mess with the window sizes to get them to overlap and you
can see parts of both.
I tried to make it so that they would overlap in the center of the screen. I
also included some comments about some of the the things I have tried.
Just to restate the problem:
The splash screen always appears underneath the main window when it becomes
visible.
First the SplashPanel
//-------------------------------------------------------------
import javax.swing.*;
import java.awt.*;
public class SplashPanel extends JPanel {
public SplashPanel () {
setLayout (new BoxLayout (this, BoxLayout.Y_AXIS));
setBounds (0, 0, 240, 120);
add (new JLabel ("A really really really wide splash screen."));
add (new JLabel ("So wide so that it hopefully will show under " +
"the main window."));
add (new JLabel ("And a few JLabels so that it will have a " +
"little height"));
setBackground (Color.WHITE);
setOpaque (true);
}
}
//-------------------------------------------------------------
Next the SqlManEditor
//-------------------------------------------------------------
import javax.swing.*;
import java.awt.*;
public class SqlManEditor extends JFrame {
public SqlManEditor () {
// Simulates initialisation activity in main thread.
// Moving this activity to after the setVisible (true)
// doesn't help much either.
try { Thread.sleep (500); } catch (Exception e) {}
pack ();
// You may need to adjust this to get the splash screen to overlap
// the main window.
setSize (200, 300);
// Code borrowed from showSplash to try
// and force the two windows to overlap.
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize ();
int x = (screen.width - getWidth()) / 2;
int y = (screen.height - getHeight()) / 2;
setBounds (x, y, getWidth(), getHeight());
setVisible (true);
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
// Putting the initialisation workload here after the setVisible (true)
// doesn't seem to help either.
}
private static JWindow splash;
private static void showSplash (final int duration) {
/* final JWindow */ splash = new JWindow ();
SplashPanel content = new SplashPanel ();
splash.setContentPane(content);
splash.pack ();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize ();
int x = (screen.width - content.getWidth()) / 2;
int y = (screen.height - content.getHeight()) / 2;
splash.setBounds (x, y, content.getWidth(), content.getHeight());
Thread r = new Thread () {
public void run () {
// TODO: Figure out how to get the splash screen to be "topmost"
// Currently when the main window is created, it will appear
// in front of the splash screen.
splash.setVisible (true);
// wait a little while
try { Thread.sleep (duration); } catch (Exception e) {}
splash.setVisible (false);
splash = null;
}
};
r.start ();
}
public static void main (String [] args) {
showSplash (5000);
SqlManEditor s = new SqlManEditor ();
s.toBack ();
splash.toFront ();
}
}
//-------------------------------------------------------------
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2003-12-15 13:17:00 |
Top |
java-programmer >> A splash screen
"Glenn McCall" <email***@***.com> wrote in message
news:email***@***.com...
>
> > Post complete working code and I'll have a look at it!
>
> No problem. I can't post the complete code but here is a cut down version
> that does the same thing.
Now we're cookin' with gas (is very good stuff)
Well, I was not able to solve the question of
why it did not work your way, but I have come
up with a rather 'hackish' fix that works for the
1.4.2 JVM on XP.
Maybe Alex or others wiil come up with
a better solution..
_______________________________________
import javax.swing.*;
import java.awt.*;
class SplashPanel extends JPanel {
public SplashPanel () {
setLayout (new BoxLayout (this, BoxLayout.Y_AXIS));
setBounds (0, 0, 240, 120);
add (new JLabel ("A really really really wide splash screen."));
add (new JLabel ("So wide so that it hopefully will show under " +
"the main window."));
add (new JLabel ("And a few JLabels so that it will have a " +
"little height"));
setBackground (Color.WHITE);
setOpaque (true);
}
}
/*-------------------------------------------------------------
Next the SqlManEditor
//-------------------------------------------------------------
*/
public class SqlManEditor extends JFrame {
public SqlManEditor () {
// Simulates initialisation activity in main thread.
// Moving this activity to after the setVisible (true)
// doesn't help much either.
try { Thread.sleep (500); } catch (Exception e) {}
pack ();
// You may need to adjust this to get the splash screen to overlap
// the main window.
setSize (200, 300);
// Code borrowed from showSplash to try
// and force the two windows to overlap.
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize ();
int x = (screen.width - getWidth()) / 2;
int y = (screen.height - getHeight()) / 2;
setBounds (x, y, getWidth(), getHeight());
setVisible (true);
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
// splash.toFront ();
if ( splash.getFocusableWindowState() )
{
splash.requestFocus();
splash.hide();
splash.show();
// splash.toFront ();
System.out.println("Window to front!");
}
else System.out.println("Window is not focusable!");
// Putting the initialisation workload here after the setVisible (true)
// doesn't seem to help either.
}
private static JWindow splash;
private static void showSplash (final int duration) {
/* final JWindow */ splash = new JWindow ();
SplashPanel content = new SplashPanel ();
splash.setContentPane(content);
splash.pack ();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize ();
int x = (screen.width - content.getWidth()) / 2;
int y = (screen.height - content.getHeight()) / 2;
splash.setBounds (x, y, content.getWidth(), content.getHeight());
Thread r = new Thread () {
public void run () {
// TODO: Figure out how to get the splash screen to be "topmost"
// Currently when the main window is created, it will appear
// in front of the splash screen.
splash.setVisible (true);
// wait a little while
try { Thread.sleep (duration); } catch (Exception e) {}
splash.setVisible (false);
splash = null;
}
};
r.start ();
}
public static void main (String [] args) {
showSplash (10000);
SqlManEditor s = new SqlManEditor ();
// s.toBack ();
}
}
___________________________________
HTH
|
| |
|
| |
 |
Adam

|
Posted: 2003-12-15 16:07:00 |
Top |
java-programmer >> A splash screen
"Glenn McCall" <email***@***.com> wrote in message
news:email***@***.com...
> I am trying to create a splash screen. I would like it to be visible for a
> few seconds while the application is initialising. After a timer expires,
> the splash screen will close automatically. I have all of this working
just
> fine.
>
> However, at some point during the application initialisation, it creates
the
> main window. When this occurs, the main window appears on top of the
splash
> screen.
Don't put 'show()' or 'setVisible(true)' in the constructor of your main
window.
The way I see it:
in main thread you should:
1.) create the splash screen and show it
2.) call a blocking method that will init your app,
that means creating the main window, but not
showing it.
3.) when all init is completed you get rid of the splash
screen and show the main window.
As simple as that. If you want your splash screen
to be visible longer than point 2.) duration,
you can just put sleep() right before point 3.)
Adam
|
| |
|
| |
 |
antroy

|
Posted: 2003-12-15 19:08:00 |
Top |
java-programmer >> A splash screen
Glenn McCall wrote:
> I am trying to create a splash screen. I would like it to be visible for a
> few seconds while the application is initialising. After a timer expires,
> the splash screen will close automatically. I have all of this working just
> fine.
>
> However, at some point during the application initialisation, it creates the
> main window. When this occurs, the main window appears on top of the splash
> screen. I would prefer that the splash screen be "top most" when this
> occurs.
Why not wait until all initialization is complete before calling
setVisible(true) on the main window? This is the usual way that splash
screens work.
Your method seems a bit strange - having the splashscreen timed to a
fixed duration. In my apps, the splashscreen is the first thing created
and displayed. I then initialize all components in the main window,
followed by the lines:
splash.setVisible(false);
main.setVisible(true);
How do you choose the duration of the timer? Surely it is not a reliable
way of getting the splash screen to disappear as the main window appears.
--
Ant...
|
| |
|
| |
 |
Glenn McCall

|
Posted: 2003-12-16 5:17:00 |
Top |
java-programmer >> A splash screen
Good questions.
The idea stems from a couple of other applications I use. Probably the most
common is paintshop pro. Where the splash screen remains displayed for a
minimum number of seconds or until the user clicks on it. Or the user can
simply start working in PaintShop Pro ignoring the splash screen.
To me (and this is just my opinion so you don't have to agree), the splash
screen is a number of things. It is a promotional thing, it is an
introductory/welcoming thing, it provides information and shows that the
application is on its way.
Sometimes like paintshop pro, the application initialises in about 1/2 a
second which is way to short a time to actually "see" the splash screen. If
Paintshop used the main.show (); splash.hide () approach, the splash screen
would be more like a flash screen. This would be true for my app as well.
However, there might be times when initialisation will take longer (eg.
depending upon the users configuration, I might establish some database
connections. For another user, this might not be necessary). So like paint
shop pro, I wanted to create an environment where the splash screen was
displayed for a minimum period of time, or until the user dismisses it or
the main window appears.
In terms of your specific question about the timer, the code I supplied here
is the starting point. If I can solve the problem of getting the splash
screen in front, then I will add functionality to close it if the user
clicks on it. Also, I will add functionality so that after the timer
expires, it will check to see if the main window is visible. If it is, then
the splash will close, otherwise it will remain visible until the main
window becomes visible - at that point it will close.
If I may be so presumptious to replace your word "strange" with "different",
I would then say it is our differences that make us unique (and hopefully
interesting).
"antroy" <email***@***.com> wrote in message
news:brk4nv$6m9$email***@***.com...
> Glenn McCall wrote:
> > I am trying to create a splash screen. I would like it to be visible for
a
> > few seconds while the application is initialising. After a timer
expires,
> > the splash screen will close automatically. I have all of this working
just
> > fine.
> >
> > However, at some point during the application initialisation, it creates
the
> > main window. When this occurs, the main window appears on top of the
splash
> > screen. I would prefer that the splash screen be "top most" when this
> > occurs.
>
> Why not wait until all initialization is complete before calling
> setVisible(true) on the main window? This is the usual way that splash
> screens work.
>
> Your method seems a bit strange - having the splashscreen timed to a
> fixed duration. In my apps, the splashscreen is the first thing created
> and displayed. I then initialize all components in the main window,
> followed by the lines:
>
> splash.setVisible(false);
> main.setVisible(true);
>
> How do you choose the duration of the timer? Surely it is not a reliable
> way of getting the splash screen to disappear as the main window appears.
>
>
> --
> Ant...
|
| |
|
| |
 |
Derek Clarkson

|
Posted: 2003-12-16 7:08:00 |
Top |
java-programmer >> A splash screen
Hi,
I would suggest that having a timed splash screen is not a good idea. I know
that there are a number of products which do this, but I consider it to be
generally not good. The reasons is that quite often a user is starting an
application in order to do something specific. I.e. it might be started in
response to an association on a file or the user might want to quickly
start it, modify a piece of information and then exit. These sorts of
situations are where users get frustrated with applications which take a
long time to start.
Having a splash screen which is sitting in front of them and not assisting
in what they are doing is only going to increase any such annoyance.
Especially if they can see that the application is up and ready behind it
and they can't get to it.
You can add a "close" button to the splash screen but then you are asking
users to perform an additional task in order to use your application. Again
they won't like it.
cruft like splash screens is a great way to make an application look
"pretty", but if they get in the way of the user in any way shape or form,
then you run the risk of the user going somewhere else. Remember, the main
job of any application is to perform a task for the user. Cruft should
never get in the way of this.
If your not convinced by these thoughts, I would suggest you doing some
ready on programs and user interaction. An especially good one that came
out recently was Eric S Raymonds "the Art of Unix Programming" which
highlights a lot of issues in regard to well behaved programs.
--
cio
Derek
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2003-12-16 14:34:00 |
Top |
java-programmer >> A splash screen
"Glenn McCall" <email***@***.com> wrote in message
news:GxpDb.54004$email***@***.com...
> Good questions.
What questions?
Please do not top-post. It makes
conversations difficult to follow
> In terms of your specific question about the timer, the code I supplied
here
> is the starting point. If I can solve the problem of getting the splash
> screen in front, then I will add functionality to close it if the user
> clicks on it.
Did my solution not work for you?
It worked fine in the 1.4.2 JVM on XP.
|
| |
|
| |
 |
clow

|
Posted: 2003-12-17 4:56:00 |
Top |
java-programmer >> A splash screen
There is something called glasspanel or something like that?
Toolbar dont use it?
|
| |
|
| |
 |
Roy Ratcliffe

|
Posted: 2004-1-3 20:37:00 |
Top |
java-programmer >> A splash screen
Derek Clarkson wrote:
> Hi, I would suggest that having a timed splash screen is not a good
> idea. I know that there are a number of products which do this, but I
> consider it to be generally not good. The reasons is that quite
> often a user is starting an application in order to do something
> specific. I.e. it might be started in response to an association on a
> file or the user might want to quickly start it, modify a piece of
> information and then exit. These sorts of situations are where users
> get frustrated with applications which take a long time to start.
>
> Having a splash screen which is sitting in front of them and not
> assisting in what they are doing is only going to increase any such
> annoyance. Especially if they can see that the application is up and
> ready behind it and they can't get to it.
>
> You can add a "close" button to the splash screen but then you are
> asking users to perform an additional task in order to use your
> application. Again they won't like it.
>
> cruft like splash screens is a great way to make an application look
> "pretty", but if they get in the way of the user in any way shape or
> form, then you run the risk of the user going somewhere else.
> Remember, the main job of any application is to perform a task for
> the user. Cruft should never get in the way of this.
>
> If your not convinced by these thoughts, I would suggest you doing
> some ready on programs and user interaction. An especially good one
> that came out recently was Eric S Raymonds "the Art of Unix
> Programming" which highlights a lot of issues in regard to well
> behaved programs.
Dear Derek,
I agree with your concerns about splash screens. I see them as helpful
user interface feedback but only as long as they do not detract from the
main requirement, i.e. loading and running the application. In my view,
if the application loads faster than the splash, the splash should *not*
appear.
Here http://royratcliffe.freewebpage.org/splash/splash.tgz is the
product of some spare time. I hope it might prove useful. Please
review and let me know what you think. Comments very welcome. You can
contact me at one of the following e-mail addresses:
email***@***.com (work)
email***@***.com (study)
Regards,
Roy
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-1-8 16:08:00 |
Top |
java-programmer >> A splash screen
"Roy Ratcliffe" <email***@***.com> wrote in message
news:3ff6b769$0$18030$email***@***.com...
...
| Here http://royratcliffe.freewebpage.org/splash/splash.tgz is
the
| product of some spare time. I hope it might prove useful.
Please
| review and let me know what you think. Comments very welcome.
I'd been meaning to get back on this..
Yeah.. Nice little splash screen. :-)
Well written, commented, and quite effective.
One _very_ minor complaint. You included
complete source, a pdf doc*, but not the single
image used in the demo. I suspect this was
purely an oversight, and a minor one at that.
If you are going to continue to offer the archive,
could you add the image to it?
* (Documentation? I was too lazy to read it,
the source was pretty damn clear.)
|
| |
|
| |
 |
Roy Ratcliffe

|
Posted: 2004-1-8 17:13:00 |
Top |
java-programmer >> A splash screen
Andrew Thompson wrote:
> I'd been meaning to get back on this..
>
> Yeah.. Nice little splash screen. :-)
>
> Well written, commented, and quite effective.
>
> One _very_ minor complaint. You included
> complete source, a pdf doc*, but not the single
> image used in the demo. I suspect this was
> purely an oversight, and a minor one at that.
>
> If you are going to continue to offer the archive,
> could you add the image to it?
>
> * (Documentation? I was too lazy to read it,
> the source was pretty damn clear.)
Dear Andrew,
Thanks. I'd hoped it might be useful to someone.
I've added some clarifications and additional timing test to the
documentation.
I'll keep the archive there for now. Werner Randelshofer has made some
valuable contributions and may include this or an improved version in
his pending site update. See http://www.randelshofer.ch/index.html
I'll post here when this happens.
Regarding the image, assuming you mean the splash.gif: not an oversight.
Rather you are meant to add this to your application resources
yourself. I did not include a /default/ image for fear of offending
someone's copyright or sensibilities ;-)
Thanks for your encouraging comments.
Regards,
Roy
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-1-8 23:54:00 |
Top |
java-programmer >> A splash screen
"Roy Ratcliffe" <email***@***.com> wrote in message
news:3ffd1f28$0$7009$email***@***.com...
| Andrew Thompson wrote:
...
| Regarding the image, assuming you mean the splash.gif: not an
oversight.
| Rather you are meant to add this to your application
resources
| yourself.
Well, that's like, ...effort!
No, seriously, it's so close to being download,
unzip, compile, run, _see_, it's a pity not to take
it the extra 1%.
|..I did not include a /default/ image for fear of offending
| someone's copyright or sensibilities ;-)
Excellent, that's the biz. :-)
Keep us updated, I might bookmark the URL..
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-1-9 0:01:00 |
Top |
java-programmer >> A splash screen
"Andrew Thompson" <email***@***.com> wrote in message
news:O2fLb.1320$email***@***.com...
| |..I did not include a /default/ image for fear of offending
| | someone's copyright or sensibilities ;-)
|
| Excellent, that's the biz. :-)
Waiiiit... I mis-read that.
Why not include a white 600x120 png
with red text 'splash image'? I could even
send you one (I'll whip it up myself).
Freely distributable.
[ And _stuff_ sensibilities! ]
|
| |
|
| |
 |
Roy Ratcliffe

|
Posted: 2004-1-9 1:27:00 |
Top |
java-programmer >> A splash screen
Andrew Thompson wrote:
> Well, that's like, ...effort!
>
> No, seriously, it's so close to being download,
> unzip, compile, run, _see_, it's a pity not to take
> it the extra 1%.
lol
Good point. You've convinced me!
Andrew Thompson wrote:
> "Andrew Thompson" <email***@***.com> wrote in message
> news:O2fLb.1320$email***@***.com...
>
> Waiiiit... I mis-read that.
>
> Why not include a white 600x120 png
> with red text 'splash image'? I could even
> send you one (I'll whip it up myself).
> Freely distributable.
>
> [ And _stuff_ sensibilities! ]
That's very kind, thanks. But could you make it look /really/ good.
Perhaps with Java's Duke mascot ``splashing'' around in the bath!
lol
Regards,
Roy
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- JEditorPane and HTML offset positionGiven the offset from the start of an HTML document, how I can
translate this into the offset when the HTML is rendered in a
JEditorPane? e.g. in the HTML document (not strict HTML but still
renders):
<HTML>test</HTML>
"test" starts at offset 6 in the HTML - but in the JEditorPane only
"test" would be displayed so it would start at offset 0 - if I wanted
to highlight it for example. You can imagine more complicated
documents...
Any ideas greatly apprieciated including if I can use an alternative
to the JEditorPane.
Thanks,
- 2
- 73 megabyte NullPointerException objects out of memory'ing our JVMOn our IBM 1.4.1 JVM we sometimes get an out of memory error.
According the IBM heapdump and heaproots, it is a large
NullPointerException being thrown from a finalize(). In our
application, should we catch all exceptions in our finalize() methods
and prevent them from being thrown further? What does the
"Finalizer" thread do with the exceptions that it gets from finalize()
methods? Why does this 73megabyte null pointer happen in the first
place??
Any suggestions?
Showing objects whose type is in 'A,R', sorted by total-size.
Addr Size Root-owner Parent Total-size Name
-------------------------------------------------------------------------------
R 0x10143330 32 - - 73,254,488
java/lang/NullPointerException
<0> [73,254,488] 0x10143330 [32] java/lang/NullPointerException
<1> [73,254,456] 0x10143308 [40] array of java/lang/Object
<2> [73,254,056] 0x4043b6f8 [304] class java/lang/ref/Finalizer
<3> [73,253,488] 0x1a450358 [32] java/lang/ref/Finalizer
<4> [73,253,416] 0x1a419818 [32] java/lang/ref/Finalizer
<5> [73,253,344] 0x14bfc2e0 [32] java/lang/ref/Finalizer
<6> [73,253,080] 0x1a3cce70 [32] java/lang/ref/Finalizer
<7> [73,216,312] 0x1a3b3a80 [32] java/lang/ref/Finalizer
<8> [73,216,280] 0x1a3a9938 [32]
java/lang/ref/Finalizer
<9> [73,216,136] 0x1a3858b8 [32]
java/lang/ref/Finalizer
<10> [73,216,064] 0x1a352f00 [32]
java/lang/ref/Finalizer
<11> [73,215,992] 0x1a344b60 [32]
java/lang/ref/Finalizer
<12> [72,964,856] 0x1a344b80 [16]
java/lang/ClassLoader$Finalizer
- 3
- XML and XPathCouple of quick questions regarding Java and XML
Is it possible to parse XML from a string instead of from a file?
Using javascript I could explicitly call a node using
xmlNode.selectSingleNode("/node1/node[@attribute='whatever']");
Are there such functions available with Jave?
Cheers
Xav
- 4
- hash functionsI have a very simple Position data type containing two nonnegative ints,
x and y. Obviously position1.equals(position2) iff they have identical
x and y coordinates. I am using them as keys to a hashmap; does anyone
have any suggestions as to the most efficient hash function for such a
structure? It seems like I can get some optimizations that improve on
hash functions with arbitrary-length input, but I'm not sure exactly
how. Thanks.
- 5
- How to change in CSS class at runtimeHi frinds,
Can anybody tell me that can I pass the dynamic data in my
CSS(Cascading Style Sheel) class.
If yes then how?
Actually I have a CSS which I am including in a number of JSP pages,
Problem is that I want to change the configuration of my CSS class
result differently for the diffrent JSPs.
Please help me out if anybody can.
Thanks & Regards
- 6
- Monday as first day of the week not sundayhey,
I'm having trouble to tell JAVA that monday is the first day of the week and
not sunday. This is what I have at the moment
Calendar time;
time = Calendar.getInstance();
time.setFirstDayOfWeek(Calendar.MONDAY);
when I output time.get(Calendar.DAY_OF_WEEK) it always gives me a number on
higher then it actually is since it assumes Sunday is day 1. This really is
a annoying bug in my program. Can anyone help me or set me on the right
track ?
thnx in advance
- 7
- Why -1 returned from session.getCreationTime() ?When testing my struts code using MockStrutsTestCase the HttpSession
method getCreationTime() returns -1. A negative value suggests some
kind of failure but I can't find any reference to this value in the
API doc. Is it possible to have a session that has a negative creation
time? If so how can this happen?
When I run my code as a regular webapp under Tomcat 5.0.18 all runs
ok.
Rick
- 8
- jzlibI downloaded the jzlib. I also compiled all the java source code in the
com directory. how can I use these classes to deflate and inflate
files?
Thanks in advance,
Mike
- 9
- Possible to store JSP output as a string?Greetings all,
Ultimately I'd like to use JSP/JSF for templating, very similiar to the
way I do now with FreeMarker.
I have a chunk of HTML which looks exactly the same on the web and in
email. I'd like to reuse the same template for both.
I've searched around and haven't been able to find a solution to my
problem. I could screen-scrape it, but yuck. Am I stuck with
FreeMarker/Velocity/Etc?
Thanks much!
Jeff Rodriguez
- 10
- ToggleButton oddityI'm trying to create a set of video controls on my application.
I've added JToggleButtons named jtoggleButtonPlay, jToggleButtonPause
and jToggleButtonRew. (All part of the same ButtonGroup
buttonGroupVideoControls)
There's also a combination of JSlider (jSliderFps) and a
JFormattedTextBox (jFormattedTextBoxFps) to set the display rate.
The below code is the change listener for the buttons.
(Each button has a
jToggleButtonX.addChangeListener(new ToggleButtonListener());
line for them)
class ToggleButtonListener implements ChangeListener{
/**
* stateChanged
*
* @param e ChangeEvent
*/
public void stateChanged(ChangeEvent e) {
JToggleButton source = (JToggleButton)e.getSource();
if(!source.isSelected()){
source.setSelected(true);
}
else{}
if(source==jToggleButtonPlay){
int fps = 25;
jSliderFps.setValue(fps);
}
else{
if(source==jToggleButtonPause){
int fps = 0;
jSliderFps.setValue(fps);
}
else{
if(source==jToggleButtonRew){
//at this time lacks any runnable code
}
else{
System.err.println("Event from an invalid source");
System.exit(-1);
}
}
}
}
}
The jSliderFps:s ChangeListener is set to activate the Play button if
frame rate is set above 0 and the Pause button if frame rate is set to 0.
However, when I run the application, only the first click on the control
buttons counts. After that, I can't either activate the other buttons or
set the active button from the slider's ChangeListener.
Every attempt to activate a button after that seems to cause a
java.lang.StackOverflowError.
Any ideas on what's causing this?
--
-Aki "Sus" Laukkanen
- 11
- [(int)Math.floor(x)] or just [x]?here is the situation...
i have an array... and i select something from random from it.
i pick a random number x by using Math.random() and multiplying it by the
length of the array.
but this gives me a double, not an int.
so when i go to use the array, it needs an int.
in the language spec, it tells me that round-towards-zero is used when
going from floating point to integer, and the casting is done
automatically if possible.
so, given that x is a double, both of these methods are basically
equivalent:
obj = myArray[(int)Math.floor(x)]
and
obj = myArray[x]
only the top version is "safer" in some sense... it helps explain to
anyone who would ever look at the code (including the author when having
to back to it) what is going on.
now, intution says the bottom one is NO SLOWER than the top, because the
top may incur extra overhead due to the function call stack (for
Math.floor)... but i'm not sure. when the runtime environment does the
automatic rounding toward zero, does it basically go through the same
operations as Math.floor anyhow?
which one would most people here use... and most importantly why?
(note, i may come up with a small test program and try to benchmark the
two to get a quantitative answer, and i will post when i do.)
thanks again for all the help,
murat
--
Murat Tasan
email***@***.com
email***@***.com
email***@***.com
http://genomics.cwru.edu
- 12
- Simple Question: How to see an Error stack trace in Tomcat... (Struts)Hi,
I have a simple probleme, I guees. I have build a simple Java Web App
(Struts, Log4J) with some JSP pages, and I have some difficulty to see
the stack trace of a Java Exception when running a JSP page. If the
page has started to be written, I can see the java exception (I see the
stack trace in a classic error page). But if the page has been started
to be written, per exemple when the the java exception is thrown in the
middle of the JSP page (in a DAO call), I cannot see any stack trace in
the page in the Log4J log or in the console... Tomcat is catching the
Exception but not writing it anywhere...
How can I change this? I would like to see the exception either in the
console or in the jsp page... I could maybe check in the Struts-config
to redirect Exception in a Error JSP page, but I doubt it would work,
because the jsp page has started to be written and cannot be change for
an other one in the process to be written.
Thanks for replying.
Etienne.
Montreal
- 13
- Tomcat help: Java Beans and servlets not working in user directories with UserConfig, jsp isHello all,
I'm using jakarta-tomcat-5.5.7 with jdk 1.5 on solaris 8.
I have configured in web.xml the UserConfig class as such
<Listener className="org.apache.catalina.startup.UserConfig"
directoryName="public_html" userClass="or
g.apache.catalina.startup.PasswdUserDatabase"/>
any jsps in home directories are working but servlets and beans that
are being
used
from jsps are not.
For example I have a directory
/jakarta-tomcat-5.5.7/webapps/steve
in it i have Test.jsp and a subdir WEB-INF in that I have a subdir
classes and
in that I
have a sub directory called blah and in that subdir I have
Product.class
Test.jsp uses blah.Product and this all works in the main webapps
directory.
However if I move the contents of the steve directory to
~steve/public_html/webapps
and I try to load Test.jsp (actually I renamed Test.jsp to
TestProduct.jsp) I
get the error
org.apache.jasper.JasperException: /webapps/TestProduct.jsp(3,0) The
value for
the
useBean class attribute blah.Product is invalid.
I however can use a jsp that does not use any beans in the
~steve/public_html/webapps
directory.
I also have a regular servlet that works in
/jakarta-tomcat-5.5.7/webapps/steve
(with the appropriate web.xml which has the servlet-mapping)
but it won't in
~steve/public_html/webapps
Any help is appreciated.
Thanks
- 14
- Java Audio question - PLEASE HELPCould some DSP or Java guru please help me ? I have a simple Java
application that records audio signals and does simple analysis on the
collected data. I am using PCM encoding, with sampling frequency 16000
Hz, 16 bits resolution, single or mono channel, little endian and
signed.
The data is read into a ByteArrayOutputStream and then as soon as I
stop recording, the stream contents are written to a byte array, using
'toByteArray()'. After that, I can get the size of this byte array,
which gives me the total number of bytes collected, keeping in mind
that I am using 16 bit resolution, i.e., each sound sample is 16 bits
long. I am using a software tone generator, with the frequency set at
500.0 Hertz.
Now, from simple DSP principles, we know that if the number of samples
collected is 'n' and the sampling frequency is 'fs', then the time
needed to collect these 'n' samples is n/fs, and the fundamental
frequency recorded is the inverse of this time value.
However, I am only getting frequencies as low as 7 Hz, or 8Hz, which
is just absurd. Could someone please tell me if I am doing something
totally incorrect, or where the flaw in my reasoning is. Any help
would be greatly appreciated. Thanks in advance for your help.
- 15
- JDBC extensionHi java developers,
if you are tired on writing SQL-statements and coding java-classes
with get- and set-methods for every column, look at
http://butler.sourceforge.net. It is a object model on top of JDBC
that makes database programming easier. It also has a generator for
generating table classes. Feature requests and contributions are also
welcome.
Best regards,
Fredrik
|
|
|