| Is it possible to write an applet that reads image and data files from web server that is easy for end users? |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- history.back problem with firefoxHi,
I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.
This problem is only with firefox. It works fine with IE. Can anyone
help me on this?
- 2
- How do I open a device in non-blocking mode?I'm a little stuck. I have a Linux device (a character device, like a
serial port) called /dev/cm15a0. I can't use RXTXcomm as it doesn't
recognize the device (and I'm having trouble recompile RXTX). I need
to open the device in non-blocking mode and read and write bytes
to/from the device. Any pointers?
--
Linux Home Automation Neil Cherry email***@***.com
http://www.linuxha.com/ Main site
http://linuxha.blogspot.com/ My HA Blog
Author of: Linux Smart Homes For Dummies
- 5
- Announcing License Manager 2.25 for JavaLicense Manager allows you to license and protect your java code.
Create eval/temprorary licenses, enable and disable software features,
node locking.
For more information see
http://www.elevenprospect.com
Version 2.25 provides the following new features:
-JDK 1.5 support
-Ability to create licenses independent of jar files.
License Manager Team.
- 6
- GUI over command line applicationHi there!
I have a command line application. It does something and prints texts on the
screen with Syste.out.println(). And now I want to make another program that
has a GUI and can start/stop this first one and can catch the text printed
on the screen and show it in the textarea. Can it by done? How?
Regards,
Marcin
- 7
- My Girlfriend Naked 504Photos of my busty girlfriend naked
http://24.116.180.212:89/myhomeporn/Girlfriend.scr
ytclxvejwzpkbdxsjlj
- 7
- TemplatePrinter copiesI am trying to get a template to print multiple copies of a page. I thought
it would be as simple as setting:
printer.copies = 10;
printer.collate = true;
printer.usePrinterCopyCollate = true;
This does not work. Do I have to program a for loop in the template to
print each copy or is IE supposed to be creating the multiple copies
(collated or not depending on the collate variable I set). The loop should
be easy enough, but I was expecting IE to take care of it for me.
Thanks,
David
- 7
- specifiy9ing new JVM options??Hi,
Can anyone point me to some resources on explaining specifying new JVM
options? For example, some java profilers have some jvm options like
-XRunprofilerDLL or -Xrunpri . How are these things handled?
I know the basics of proifiler implementing a profiler agent talking
to jvm through jvmpi. But I am not sure how they start themselves and
load the tobeprofiled app. And it seems we can also "attach"
themselves when the app is running provided the pid is known for the
target jvm. How is this working?
Thanks.
- 10
- Bug#285014: java-common; correction for README.Debian-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Package: java-common
Version: 0.222
Severity: minor
In the file /usr/share/doc/common-java/README.Debian, the following lines:
They can be found at
/usr/share/doc/java-common/debian-java-faq.html
and
/usr/share/doc/java-common/debian-java-policy.html
should probably read:
They can be found at
/usr/share/doc/java-common/debian-java-faq/index.html
and
/usr/share/doc/java-common/debian-java-policy/index.html
Thanks,
- --
Barry Hawkins
All Things Computed
site: www.alltc.com
weblog: www.yepthatsme.com
Registered Linux User #368650
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
iD8DBQFBuRhC7bZ6kUftWZwRAtOTAKDMHWW9jUWEaqVC/qZHq+Cq/T+ohwCfeqHZ
nSqMQ2c9L16CzGJOOw+FoMo=
=0S/K
-----END PGP SIGNATURE-----
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 10
- Static fields accessed by getter/setter...what happens?(apology for duplicate post, I felt I posted in the wrong forum earlier.)
Could someone please enlighten me as to what will happen if I have:
public class MyClass
{
public static String someName = null;
public void setSomeName(String s)
{
someName = s;
}
public void getSomeString()
{
return someString;
}
}
I'm not sure how the static field is being handle using non-static getters/setters.
Thanks
Stacey
- 12
- XMLEncoder & DefaultPersistenceDelegateI am trying to encode EventObject's as XML using XMLEncoder. As
subclasses of EventObject/AWTEvent are generally NOT java beans (they
do not provide a nullary constructor), I have to provide an instance of
DefaultPersistenceDelegate which specifies which properties are set by
the constructor. I tried to this with ActionEvent as follows:
encoder.setPersistenceDelegate( ActionEvent.class, new
DefaultPersistenceDelegate(
new String[] {"source", "ID", "actionCommand", "modifiers",
"when"} )
);
Unfortunately, when I call encoder.writeObject with an argument of type
ActionEvent, I get the following exception:
java.lang.NoSuchMethodException: <unbound>=Class.new(null, Integer,
"1", Integer, Long);
Continuing ...
java.lang.Exception: XMLEncoder: discarding statement
XMLEncoder.writeObject(ActionEvent);
Continuing ...
It is apparently unable to find the constructor due to the first
argument being null. However, "source" in my ActionEvent happens to not
be null. "source" is a property from EventObject rather than
ActionEvent, and I think this may be part of the problem. I have read
another post that says XMLEncoder has problems with superclass
properties.
Anybody have any ideas?
- 14
- 14
- External process output missingHello,
I'm using Runtime.getRuntime().exec(procedureFile) to run external
system commands stored in procedure files, and I get their output from
process.getInputStream().
This works OK in Windows, but when I try it in a Unix system I get the
direct output (i.e. procedure echos) but not the output from the
programs run by the procedure. For example:
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/sysadm/bin:
export PATH
echo "Starting remote copy for $1"
scp -r $1 map@remotehost:/apps/myapp
echo "End of remote copy for $1"
would return the two echo messages, but not the output from scp.
Is there something that must be done or declared to get all the output
in Unix?
Thanks for any hint,
Guifre
- 14
- Configuring Tomcat to NOT use webapps directorycurrently my webapps directory is something like:
C:\java\netbeans3.5.1\tomcat406\webapps
This is where the Netbeans install put it. I want to move the
directory to something a little more convenient to work with like:
c:\webapps
All I can find in the Tomcat configuration file is:
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true">
but if I change appBase to anything like "c:\webapps" or "c:/webapps"
it doesn't work. Can anybody tell me how to move the appBase
directory outside of the Tomcat or Netbean directory?
Thanks in advance.
Dean
- 14
- JProgressBar... need assiatance pleaseI'm playing with the idea of showing a JProgressBar in a small App' I trying
to make.
I want to display the progress of an array being populated....however I cant
seem to get the bar to show the actual % state before it reaches 100%
Am I missing something out?
Please help me if you can..
Thanks...
#######################
CODE BELOW
#######################
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ArrayRandom extends JFrame {
protected final int size = 100000;
protected int[] prodRandm = new int[size];
protected int min = 0;
protected int max = 100;
protected JProgressBar progress;
protected JButton start;
public ArrayRandom() {
setSize(300,50);
progress = new JProgressBar();
progress.setStringPainted(false);
progress.setIndeterminate(true);
start = new JButton("Start");
ActionListener act = new ActionListener() {
public void actionPerformed(ActionEvent e) {
progress.setMinimum(min);
progress.setMaximum(max);
progress.setIndeterminate(false);
progress.setStringPainted(true);
for (int i = 0; i < size; i++) {
prodRandm[i] = i;
progress.setValue((i/1000)+1);
progress.setString((i/1000)+1+" %");
}
}
};
start.addActionListener(act);
getContentPane().setLayout(new BorderLayout(10,10));
getContentPane().add(progress, BorderLayout.CENTER);
getContentPane().add(start, BorderLayout.WEST);
}
public static void main(String[] args) {
ArrayRandom frame = new ArrayRandom();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
- 15
- Beanshell self-reference causes memory leakDear All,
I have come across a phenomena in Beanshell, which I am pretty sure is
a bug. I have put together a very simple test. I wanted to know if
anyone has already come across this, before I submit a bug report.
I have included below the source for a very simple test which can be
run from the command line. Although the test prints out memory usage,
the phenomena is best observed using a memory tool such a JProfiler.
Unfortunately, I can't attach here a screen-shot from JProfiler to
graphically illustrate the problem.
The core issue is this:
If I setup a self-referencing circle with the Interpreter like so (in
standard Java code):
{
this.interpreter = new bsh.Interpreter();
this.interpreter.set( "ref", this );
}
It sets up objects in the JVM memory which can never ever be garbage
collected, even though there is no reference them, and the "this"
object is out of scope in the calling method.
This is in contrast to, say a HashSet:
{
this.set = new HashSet();
onethis.set.add( this );
}
This setup does appear to garbage collect when the "this" object goes
out of scope.
The code for Test.java is below. Its output follows. Note that after
the self-referencing setup, roughly 90Kb has not been garbage
collected, compared with 20Kb for the HashSet and 200 bytes for two
java objects.
Before tests
------------
10528
40
------------
Waiting ...
After object ref test
---------------------
26944
208
---------------------
Waiting ...
After HashSet test
------------------
158280
22760
------------------
Waiting ...
After Interpreter test
----------------------
362648
91352
----------------------
Waiting ...
If this test is run with JProfiler, it can be seen that both the
self-referencing Test objects, and the self-referencing HashSet setup
are successfully garbage collected.
But JProfiler shows the Interpreter still in memory after the object of
class Test has gone out of scope - at the very final part of the
program.
The Interpreter is not garbage collected.
Obviously, if you do this enough in an application, it will cripple it
for speed and eventually bomb out with an "Out of heap space" error.
Any thoughts?
Regards,
Stewart
import java.io.*;
import java.util.*;
import bsh.*;
public class Test
{
private static Runtime r = Runtime.getRuntime();
private static long baseline = 0L;
public static void main(String[] args)
throws Exception
{
System.gc();
baseline = (r.maxMemory() - r.freeMemory());
report("Before tests");
twoObjectTest();
report("After object ref test");
hashSetTest();
report("After HashSet test");
interpreterTest();
report("After Interpreter test");
}
private Test ref = null;
private HashSet<Test> s = null;
private Interpreter i = null;
private static void twoObjectTest()
{
Test one = new Test();
Test two = new Test();
one.ref = two;
two.ref = one;
}
private static void hashSetTest()
{
Test one = new Test();
one.s = new HashSet<Test>();
one.s.add( one );
}
private static void interpreterTest()
throws EvalError
{
Test one = new Test();
one.i = new Interpreter();
one.i.set( "ref", one );
}
private static void report(String string)
throws IOException
{
char[] lines = new char[string.length()];
Arrays.fill(lines, '-');
System.out.println( );
System.out.println( string );
System.out.println( lines );
System.out.println( (r.maxMemory() - r.freeMemory() - baseline) );
System.gc();
System.out.println( (r.maxMemory() - r.freeMemory() - baseline) );
System.out.println( lines );
System.out.println("Waiting ...");
new BufferedReader( new InputStreamReader( System.in )).readLine();
}
/**
* I thought this might solve the problem, but of course, it never
gets called.
*/
protected void finalize()
throws Throwable
{
i.set( "ref", null );
i.unset( "ref" );
i = null;
}
}
|
| Author |
Message |
Jean-Paul Lanaux

|
Posted: 2004-5-16 22:04:00 |
Top |
java-programmer, Is it possible to write an applet that reads image and data files from web server that is easy for end users?
My background:
4th year computer science student.
The school that I am studying at teaches a lot of java, but they haven't
ever touched upon applets. I don't have much experiance with applets and
I find that applets are excercising my patience. I thought I would
attempt to write an involved applet and the program I was writing was
working very well and I was pleased with the way it as coming out. I
then put it on a web server and discovered all of the security problems
with running applets off of the web. I am at a point now where I might
want to totally abandon the project using java and move over to c++ and
just write an app that uses an exe.
I have done a lot of searching on the net for the info that seems to be
eluding me. I am searching for and It is not clear to me if I can do
what I wish to do without all of the damn security exceptions.
My main question:
I want to develop an application that runs from a browser window as an
applet using Java. I want to be able to read files from the same server
and directory structure which has the html files. The files that I would
be reading would be jpg's and gif's and either text files or binary
files for the data. It would also be nice to write to the directory, but
at this point I would just be satisfied to be able to just read files.
The users that I expect to use this applet are not expected to be very
competant computer users. It is very important that the applet just run
from a link or other simple method. Can I do this from a jar file
without having to use certificates and/or java policy file
modifications.
I don't want to give up on java just yet, but this security thing is
killing it for me.
I have even thought about planting the data within the source code, but
that to me seems too damn messy, and just plain wrong.
I would just like if people could tell me one way or another if my
program would be possible.
Jean-Paul Lanaux
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-5-16 22:52:00 |
Top |
java-programmer >> Is it possible to write an applet that reads image and data files from web server that is easy for end users?
Jean-Paul Lanaux wrote:
> I want to develop an application that runs from a browser window as an
> applet using Java. I want to be able to read files from the same server
> and directory structure which has the html files. The files that I would
> be reading would be jpg's and gif's and either text files or binary
> files for the data. It would also be nice to write to the directory, but
> at this point I would just be satisfied to be able to just read files.
Yes, you can do the reading part. If you want to know what's wrong with
your code, you'll have to post a short example that demonstrates the
problem.
As for the writing part, web servers don't typically provide a way to
write to their directories (for obvious reasons). You can write to the
server, IF the server is running an appropriate service such as FTP or
such, and you don't mind giving out the password to the world. If you
have more control over the server, you could also write your own service
of sorts, which would allow only the kind of writes you want, and no
more.
> I don't want to give up on java just yet, but this security thing is
> killing it for me.
There are, incidentally, other options besides applets for writing Java
code to do this sort of thing. Writing a Java application would be just
as easy as writing a C++ application to perform these tasks, assuming
you know Java already...
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
Roedy Green

|
Posted: 2004-5-17 1:51:00 |
Top |
java-programmer >> Is it possible to write an applet that reads image and data files from web server that is easy for end users?
On Sun, 16 May 2004 14:04:24 GMT, Jean-Paul Lanaux <email***@***.com>
wrote or quoted :
> Can I do this from a jar file
>without having to use certificates and/or java policy file
>modifications.
To read images from jar files, or the server see
http://mindprod.com/jgloss/image.html
Also see http://mindprod.com/fileio.html
to see how to do HTTP gets to fetch them from a server at the socket
level.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
| |
|
| |
 |
Roedy Green

|
Posted: 2004-5-17 2:25:00 |
Top |
java-programmer >> Is it possible to write an applet that reads image and data files from web server that is easy for end users?
On Sun, 16 May 2004 14:45:54 -0400, perry <email***@***.com> wrote
or quoted :
>if you sit back and think about it, not letting applets write to server
>files should make sense.. do some research on different types of
>applet/server relationships available.
see http://mindprod.com/jgloss/remotefileaccess.html
for your options.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
|
| |
|
| |
 |
perry

|
Posted: 2004-5-17 2:46:00 |
Top |
java-programmer >> Is it possible to write an applet that reads image and data files from web server that is easy for end users?
i'm not sure of the all the details of the application you are
describing and true, applets have a few restrictions but with good reason.
from what you have described, there is nothing wrong with collecting
information via the standard practise and having that sent to the server
for proper storage. i don' know if this is what you meant with writing
files to the server. the whole idea of the applet/servlet or
applet/server relationship is that each would focus on tasks that are
appropaite for each.
as for accessing gifs/jpgs from the server, sure. as for writing images
(i'm assuming) back. there's a couple approaches other than what was
mentioned. i don't see any need in your app to capture or store altered
images, if so, a trip down the JMF framework might be appropiate. but if
all your storing is user choices or responses, send that information to
the server or servlet and let it do the writing to the server files.
if you sit back and think about it, not letting applets write to server
files should make sense.. do some research on different types of
applet/server relationships available. you might even consider JavaSpaces.
- perry
Jean-Paul Lanaux wrote:
> My background:
>
> 4th year computer science student.
>
> The school that I am studying at teaches a lot of java, but they haven't
> ever touched upon applets. I don't have much experiance with applets and
> I find that applets are excercising my patience. I thought I would
> attempt to write an involved applet and the program I was writing was
> working very well and I was pleased with the way it as coming out. I
> then put it on a web server and discovered all of the security problems
> with running applets off of the web. I am at a point now where I might
> want to totally abandon the project using java and move over to c++ and
> just write an app that uses an exe.
>
> I have done a lot of searching on the net for the info that seems to be
> eluding me. I am searching for and It is not clear to me if I can do
> what I wish to do without all of the damn security exceptions.
>
> My main question:
>
> I want to develop an application that runs from a browser window as an
> applet using Java. I want to be able to read files from the same server
> and directory structure which has the html files. The files that I would
> be reading would be jpg's and gif's and either text files or binary
> files for the data. It would also be nice to write to the directory, but
> at this point I would just be satisfied to be able to just read files.
>
> The users that I expect to use this applet are not expected to be very
> competant computer users. It is very important that the applet just run
> from a link or other simple method. Can I do this from a jar file
> without having to use certificates and/or java policy file
> modifications.
>
> I don't want to give up on java just yet, but this security thing is
> killing it for me.
>
> I have even thought about planting the data within the source code, but
> that to me seems too damn messy, and just plain wrong.
>
> I would just like if people could tell me one way or another if my
> program would be possible.
>
> Jean-Paul Lanaux
>
|
| |
|
| |
 |
Steve Burrus

|
Posted: 2004-5-17 4:17:00 |
Top |
java-programmer >> Is it possible to write an applet that reads image and data files from web server that is easy for end users?
>Jean-Paul Lanaux wrote:
> .....My main question:
>
> I want to develop an application that runs from a browser window as an
> applet using Java. I want to be able to read files from the same server
> and directory structure which has the html files. The files that I would
> be reading would be jpg's and gif's and either text files or binary
> files for the data. It would also be nice to write to the directory, but
> at this point I would just be satisfied to be able to just read files.
> ....
Jean-Paul, I really haven't read ALL of the various responses back to
your original post just yet, but I would "echo" all of those responses
that have urged u to please send to us the applet code that you are now
working with!
|
| |
|
| |
 |
Jean-Paul Lanaux

|
Posted: 2004-5-17 15:27:00 |
Top |
java-programmer >> Is it possible to write an applet that reads image and data files from web server that is easy for end users?
In article <email***@***.com>, look-
email***@***.com says...
> On Sun, 16 May 2004 14:04:24 GMT, Jean-Paul Lanaux <email***@***.com>
> wrote or quoted :
>
> > Can I do this from a jar file
> >without having to use certificates and/or java policy file
> >modifications.
>
> To read images from jar files, or the server see
> http://mindprod.com/jgloss/image.html
>
> Also see http://mindprod.com/fileio.html
> to see how to do HTTP gets to fetch them from a server at the socket
> level.
>
>
I am going to attempt to figure this out with the info I received from
this group. If I can't figure it out, I will post the code.
I was working on this project between semesters, and I put it down in
January. School just finished so I would like to pick it up again. But
in the mean time I have to get back up to speed with the code.
Thanks to all that responded.
-jpl-
|
| |
|
| |
 |
Andrew Thompson

|
Posted: 2004-5-17 16:24:00 |
Top |
java-programmer >> Is it possible to write an applet that reads image and data files from web server that is easy for end users?
On Mon, 17 May 2004 07:27:14 GMT, Jean-Paul Lanaux wrote:
> I am going to attempt to figure this out
> with the info I received from this group.
> If I can't figure it out, I will post the code.
Linking to it at Geocities might be a
better idea, especially since it is
an applet(!). If posting to the group
itself, it is important to keep it short.
For tips..
<http://www.physci.org/codes/sscce.jsp>
But ..you are only going to post if
you have a problem?
What about if you create a wonderful
applet.. Is the source going to be
secret?
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- How to control the cursor positon of java program in console mode?I am writing a small database that requires user input.
However, whenever something is output to the screen, the cursor stays at the
beginning of the output instead of the end of the output.
How can I let it go to the end of the output?
For example:
say, the output is like this:
This is a database. Please input your information below.
prompt:>
I want the cursor to go to after the ">" sign but it stays in front of
"this" although whenever the user presses the keyboard it goes the end after
">".
This is not a big problem but makes my application look not so professional.
Anyway to cure this?
John
- 2
- JTable row selection (left and right mouse)Is it possible to be able to allow users to use either the left or the right
mouse button to select one or more
rows in a JTable, and upon the selection, be able to tell which mouse button
they used to select the row(s)?
I have 15 tables on the screen. The user needs to select one or more rows
from one table (the source)
and then the same number of rows in another table (the destination) and then
I need to swap the row
data from both tables. So, I need a way to differentiate between the
selections on the source and the
destination tables.
Thank you.
- 3
- newbie: Global EJB and more ...
Hi group,
While thinking of how to transfer a tranditional client-server app
into J2EE, I got following two questions:
1, In a typical application, there should be some global (even
singleton) objects which are created on application startup code and
stay there until the program exiting. In the idiom of J2EE, what kind
of Beans act like this kind of global object? And, when and how these
global beans should be created?
2, I knew Beans have to be deployed onto the server before they come
to be available, but those Beans quit often need some objects to
complete its job, these objects may encapsulate a algorithem, may do
some management task, but they typically dont have to exposed to
client tire or web tire. I call these objects are intermediate
objects. My question is, should this kind of objects need to be a EJB?
My J2EE books seems only to mention three kinds of Beans,
SessionBeans, EntityBeans and MessageBeans. But what do I do for those
intermediate objects?
Thanks in advance.
--
email***@***.com
%% (fortunes)
Q: How did you get into artificial intelligence?
A: Seemed logical -- I didn't have any real intelligence.
- 4
- butting components right up against each otherOn Fri, 27 Jun 2003 13:29:59 GMT, Roedy Green <email***@***.com> wrote:
> On Fri, 27 Jun 2003 14:06:22 +0100, Daniel Dyer
> <email***@***.com> wrote or quoted :
>
>> Sorry, I didn't mean ipadx/ipady, that won't help. You certainly
>> shouldn't need to use absolute positioning though. Do you have any
>> sample code to show us?
> I just wanted to put a string of JTextFields with black backgrounds
> right against each other so they look like one continuous field.
Have you tried setting the borders on the text fields to null? Maybe it's
the borders that make it look like there's a gap. Have you tried a
different layout (maybe try GridLayout, just to see if it looks the same,
it's much simpler so it will be easier to spot if you've done something
wrong).
Dan.
--
Daniel Dyer
Empathy Software (http://www.empathysoftware.com)
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
- 5
- class not found within IEHi,
I've written an applet. It properly works with Mozila. But with
Internet Explorer it says "Class [the applet's name] not found" or
something.
What is the problem? How can I fix it?
Thank you,
Siamak
- 6
- checkbox ploblem pls help!!i was new in java and i now completed add the checkbox in each node but the
ploblem is i cant click the check box..
what should i do in next step... pls help me thank you..
following is my code
fileTree.setCellRenderer(new DefaultTreeCellRenderer()
{
public Component getTreeCellRendererComponent(JTree tree, Object
value,
boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
{
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
row, hasFocus);
JCheckBox chk = new JCheckBox();
chk.setContentAreaFilled(false);
chk.setEnabled(true);
//
chk.setBorderPaintedFlat(true);
chk.setOpaque(false);
JPanel jPanel = new JPanel(new BorderLayout());
jPanel.add(chk, BorderLayout.WEST);
jPanel.add(this, BorderLayout.EAST);
return jPanel;
}
--
Message posted via http://www.javakb.com
- 7
- HalfTruth=Lie (was: I'm still waiting for somebody to offer co...)> From: "Phlip" <email***@***.com>
> The good is the enemy of the best.
A half-truth is a lie.
A bicycle with only one wheel isn't useful.
Yin without yang isn't useful.
A glass half full but not half empty, or vice versa, is not the whole
picture.
For nearly every cliche there's an opposite which is equally valid in
different circumances.
Please choose which of the following activities you would most and
least like to participate in:
(1) Have bamboo shoots driven up under your fingernails.
(2) Undergo Chinese water torture.
(3) Be trapped in a large tank with one (1) pihrana.
- 8
- Java client-server: what options are there?This is an issue that I have been pondering and investigating
for years, and I wish there was a book, chapter or URL that
covered it.
I have to develop client-server systems in which the following
is pretty much decided:
- The database is Oracle 9iR2
- The server OSs are Solaris and Linux
- The clients (a few dozen) are Windows (XP?)
- The client side runs on Java
Those are the givens, the rest is up for grabs...
The main undecided part is: exactly how to realize the client-server
connection? That's what I would like to hear and read about.
What options do I have?
To get the ball rolling, I will share my experiences so far.
First, I tried the JDBC approach, with a standalone application.
There was a stored procedure in the server, and it was called
from the client. The cons were: the size of the JDBC being much
larger than my app, and there was also the issue of performance.
I feel that I should move more of the functionality and heavy duty
processing to the server side, where I can have plenty of horsepower.
My second attempt was a Java applet which got its data
through CGI-BIN from an OCI C program running on the server.
The performance was pretty good and I'd like to stick with
the OCI part but not with CGI-BIN.
I just began the third approach: using SSH. The server part
is a given since it comes ready in Linux, and I got the Java
client part from sshtools.com.
I have read about servlets, Tomcat, etc. but it looks like once
I get into that stuff (the area seems to be called "Enterprise"),
the tools become extremely expensive (for instance I will have
to upgrade my $700 Developer JBuilder to a $3500 Enterprise JBuilder).
The issue of performance still worries me (I am a speed freak):
I wish I could just use the Unix R-commands (rsh, etc.) so all
the encrypting-decrypting doesn't get in the way of client
performance (my app is Intranet in a trusted environment) but
I guess I can live with the more modern, secure, etc., SSH.
Thanks very much for sharing your expert insight on this,
(and if you are a writer deciding on a topic, I'll bet that
this one will sell a lot of books! - anyone from O'Reilly
out there?)
-Ramon F Herrera
- 9
- PropertyChangeListener not recognizing changes to a putClientPropertyI must be missing out on something fundamental . . . why doesn't the
following code ever register a PropertyChangeEvent?
import java.beans.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.text.*;
public class PropTest extends JFrame {
private Boolean myBoolean = Boolean.FALSE;
public PropTest() {
super("PropertyChangeListener Test");
JPanel panel = new JPanel();
JButton button = new JButton(new BooleanAction("Button pushed"));
button.setText("Push me!");
panel.putClientProperty("myBoolean", myBoolean);
panel.addPropertyChangeListener("myBoolean", new BooleanListener());
panel.add(button);
panel.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0),
"space");
panel.getActionMap().put("space", new BooleanAction("Space
pressed"));
this.getContentPane().add(panel);
}
private class BooleanAction extends AbstractAction {
String title;
public BooleanAction(String title) {
super();
this.title = title;
}
public void actionPerformed(ActionEvent e) {
System.out.println(title);
System.out.println("Old value: " + myBoolean.toString());
myBoolean = new Boolean(!myBoolean.booleanValue());
System.out.println("New value: " + myBoolean.toString());
}
}
private class BooleanListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent e) {
System.out.println("Hey, you changed my value!");
}
}
public static void main(String[] args) {
PropTest propTest = new PropTest();
propTest.setResizable(false);
propTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
propTest.pack();
propTest.setVisible(true);
}
}
- 10
- File upload with JSF.....Hi,
i'm a new user of java. I have a question. I have to develop a JSF
application that make user able to:
1) Upload a txt file
2) Showing to user columns and rows numbers of file.
For this second operation i'have developed a java application that
receive a txt file from a BufferedReader and counts rows and columns
number.
My questions are:
1) How can i realize file upload with JSF?
2) In which format a file is uploaded?
3) Can i use my java application for counting rows and columns number
of file?
Can you help me?Please use easy concepts because i'm inexpert.....
- 11
- JAVA ?Oracle Programmers wantedHighly experienced JAVA / Oracle programmers wanted for a three month
contract in South Africa (JHB). Must have had ERP experience with some
integration skills.Open source experience an added advantage. Must be able
to work in a team.
Email CV to email***@***.com
- 12
- sample jsp servlet application requiredHi geeks,
I'm a beginner in jsp and servlets, i want a sample JSP-SERVLET
applicaton with source code. Can you please tell me where can i get the
sample applications.
Thanks in advance...
- 13
- Balanced TreeI was wondering if there were a built in (or freely available) library for
handling balanced trees.
I find many projects use them or could benefit from them.
:)
- 14
- Changing button colors in a loopHi all:
I am working on a task that should imitate an elevator. I have two vertical
rows of round buttons "Up" and "Down" When a circle is selected randomly by
the program, the circle becomes yellow and the elevator moves to that
button.
Here is what I did:
1. created a class Circle where I save buttons' parameters
2. saved Circle objects in an array
3. drew the buttons depending on their parameters
4. generated a random number, matched it with an array index and assigned
the object color to yellow.
Everything is fine except that I can't figure out how to change colors of my
buttons in a loop. Help would be greatly appreciated!
import javax.swing.*;
import java.awt.*;
import java.util.*;
public class Elevator3 extends JPanel
{
private int n = 40;
private int width = 200;
private int floors = 10;
private int interval = 1000;
private boolean selected = false;
private Circle[] buttons = new Circle[2*(floors-1)];
public Elevator3()
{
build();
JFrame frame = new JFrame("Elevator3");
setBackground(Color.WHITE);
setFont(new Font("SansSerif", Font.PLAIN, Math.round(n/3)));
frame.getContentPane().add(this);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(width, n*(floors+2) );
frame.setVisible(true);
}
public void build()
{
Random r = new Random();
int buttonPick;
int timeUntilNextButton = r.nextInt(interval);
for (int k =0; ; k++)
{
if (timeUntilNextButton-- ==0)
{
buttonPick = r.nextInt(2*(floors-1));
//populate my buttons array here - how??
timeUntilNextButton = r.nextInt(interval);
}
}
//adding "Down" buttons
for (int i=1, count=0; i < floors; i++, count++)
{
if (count == buttonPick)
selected = true;
else
selected = false;
buttons[count]= new Circle(n*2, n*i, selected, Math.round(n/2));
}
//build an array of "Up" circles
for (int i=2, count=floors-1; i < floors+1; i++, count++)
{
if (count == buttonPick)
selected = true;
else
selected = false;
buttons[count]= new Circle(n, n*i, selected, Math.round(n/2));
}
}
public static void main(String[] args)
{
new Elevator3();
}
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
//draw buttons
for (int i=0; i < buttons.length; i++)
{
g.setColor(buttons[i].getColor());
g.fillOval(buttons[i].getX(), buttons[i].getY(),
buttons[i].getWidth(), buttons[i].getWidth());
}
}
}
class Circle
{
private int x;
private int y;
private Color c;
private boolean pressed;
private int width;
public Circle(int xCoordinate, int yCoordinate, boolean selected,
int diameter)
{
x = xCoordinate;
y = yCoordinate;
pressed = selected;
width = diameter;
if (pressed)
c = Color.YELLOW;
else
c = Color.LIGHT_GRAY;
}
public Color getColor()
{
return c;
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
public int getWidth()
{
return width;
}
}
- 15
- JavaDoc Ignore TagsHi all,
Is it possible to tel JavaDoc to ignore certain XDocLet tags, and/or not raise a warning that it is
unknown?
I am currently running JavaDoc through an Ant task, and wish to hide the warnings about my
@hibernate tags.
Regards,
--
|
|
|