| Problem understanding a java statement! |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- 2D drawing library / painting programHi,
Does anyone know a good 2D painting program in Java with source? I
have to make a "conferance room" in Java where users can draw on a
shared whiteboard that they all can see. They have to be able to write
on it, draw rects, circles, freehand, fill with color, choose drawing
color etc. like the basic things you can do in any simple painting
programs like MS Paint. Im developing in JDK 1.4 so Java 2D is
available.
//Kasper, Denmark
- 2
- Get external (public) IP from my Linksys routerI've been searching for a way to programtically get my public IP from my
router. After much research th eonly thing I came up with was going to a
site like privacy.net and returning the value it reads. What I'd like to do
is compile this into my .chm I give my remote users. So ideally they would
have a button to press that goes to the web site reads the site and returns
the ip to a text box.
I'd like to do it without the user actually seeing IE open the web site. Any
leads?
- 3
- A scheduled java application?Hi,
I have a Linux box running Red Hat 9. There is a java application on
this box that is scheduled to run twice daily, once a night and once
in the morning.
My problem is that I do not know what java program is running or how
this java application is scheduled to run.
Initially I thought it must be a cron job running the java application
but I cannot find any listing for a java app in crontab.
If anyone has any ideas on how to find which java application is
running and where to find how it is being scheduled to run I would
really appreciate it.
Thanks
- 4
- JSTL c:loop works but c:out doesn'tI have what I think is a weird config problem.
The following JSP
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<body>
<c:forEach var="i" begin="1" end="5" step="1">
<c:out value="${i}" />
<br />
</c:forEach>
</body>
</html>
produces:
${i}
${i}
${i}
${i}
${i}
instead of the expected
1
2
3
4
5
I'm on Tomcat 5.0
using JSTL 1.1.2
Placing jstl.lib and standards.lib in the app
tld files in app WEB-INF
which is defined in my web.xml
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
What could be wrong?
-Paul
- 4
- Apple Flops: iPhone will flop like Mac Mini, Cube, Newton, etc, etcOn Jun 29, 10:31 pm, Kurt <email***@***.com> wrote:
> In article <email***@***.com>,
>
> email***@***.com wrote:
> > This guy nailed it, although I think the iphone will just become like
> > any other smartphone as opposed to an outright flop, albeit a lot more
> > CRIPPLED because you actually can't do anything with it.
>
> LOL I'd love to repost this 6 months from now.
> We'll see how good your spinning skills are.
>
Perhaps you'd like to post valid arguments instead of vacuous taunts
to the writer of the article.
Since the iPhone has absolutely no application capability, no IM, no
email integration capabilities, and not even the ability to edit
documents or spreadsheets or powerpoint presentations, it
automatically won't affect the business smartphone market (thus, the
fact that Rim Blackberry shares went up by $34 today).
Since it does not play any of the thousands of consumer Java games and
apps (IM, messaging, picture sharing, social networking, etc) already
in the market today, it is also a crippled CONSUMER phones.
In other words, it's a pretty GUI with nothing underneath.
- 5
- SPRY Collapsible Panels via Dreamweaver CS3I have a website with several Spry Collapsible Panels on each page. I
am trying to devise a way to have all the panels open before printing.
I believe I will need to use some kind of JavaScript to open all the
panels with a delay and then trigger a print function. Does anyone
have a good resource for doing this? Please help
- 5
- Digitally signing a J2ME application so that it runs in Operator domainWe are supplying a J2ME (Java) application to a mobile network
operator. We need it to be digitally signed so that it runs in the
Operator domain (as opposed to the Trusted Third Party, Manufacturer
or Untrusted domains). Can someone tell me the process for doing
this?
If there is a seperate process for each phone manufacturer, has anyone
gone through this process with Motorola, SonyEricsson or Nokia? What
are the details?
If the mobile operator needs to perform the process, that is fine, but
I still need to understand what they need to do.
Thanks.
- 8
- JTable - DefaultTableModelHello,
I have a JTable with a DefaultTableModel. I have a search Methode which
searches in the database and displays the results in the JTable. Now I
want to extract the search from the class and put it in an extra class.
I have for both the JTable and the DefaultTableModel defined getters
and setters and now I want to write the following code in the
outsourced method:
Search.getTable().setVisible(true);
search.getModel().addRow(new Object[]{name,text});
Search is the class where the JTable and the DefaultTableModel is
defined. Both lines are in a loop of a Vector size and the data of the
vector are in the name and text parameters of the addRow Method. The
problem is that this does not work and the rows are not displayed when
I start my Java Application. When I put this code (without the Search
prefix and the get-Method) it works without problems.
Is it not possible to address the table and the model in that way from
another class?
lg
- 9
- GUI designed with NetBeans 4.1 has repaint issuesI used netbeans to make a few forms, and all the components seem to
vanish anytime an event happens. For instance, if I select an item in
a comboBox all of the components disappear until I select each one
(via tab/shift-tab).
Any ideas?
Thanks in advance,
Zach
- 9
- PKCS#10 support in Java.Hello
I am looking for some opensource Java library supporting PKCS#10 standard,
creating certificate signing request and processing answer from CA. I've
found Bouncycastle library, but it would be good to have support only for
PKCS#10, without other aspects of PKI. Do you know anything about such library?
Kubek
- 10
- Does it usually take a day for post to appear??I have posted a thread yesterday and although the message told me that
my post will appear "momentarily" it didn't appear until today. I have
posted a reply to the psot and I have now waited for at least 4-5hours
and it hasn't appeared yet. I have posted in other forums before and
it took usually 15 minutes or less for the psot to appear. Is it
normal for this forum that it takes a day or two?
I just want to know which VM to install for Swing for IE. I am using
Borland JBuilder 2006. If anyone happens to look at this before I get
any replies for the other posts.
Thanks for any help.
- 11
- Simple GUI application attempted.Some assistance in the development of a simple GUI application would
be appreciated.
Not long ago I completed a computer science degree, and right now I
want to get a bit more experience and confidence by trying to write
applications that are just a bit beyond what I had to write at
university. However, in the early stages of designing the application
that I have in mind, I have hit a brick wall. I can't write it the way
that I thought at first would work, because of the ColorModel classes
having no 'set' methods, so I'd like to know what _will_ work.
Please imagine the following scenario (this is not a description of
the application, but it is a simpler illustration of the same
problem). Suppose you are writing a graphical application that
simulates a digit on a traditional LCD display, as for example on
a handheld calculator. This should be achievable using a Raster that
encodes something akin to the following:
011110
200003
200003
044440
500006
500006
077770
and a changeable ColorModel, in which 0 always represents the
BACKGROUND colour and the other indexes 1 to 7 represent colours that
we will call ON and OFF. For example, if the digit to be displayed is
"4", then indexes 2, 3, 4 and 6 will be set to represent colour ON
whilst indexes 1, 5 and 7 will be set to represent colour OFF.
Similarly, if the digit to be displayed is "3", then indexes 1, 3, 4,
5 and 7 will represent ON and indexes 2 and 6 will represent OFF.
It would be nice if the ColorModel classes had 'set' methods, because
then you could make the relevant class (let's call it
DigitDisplayImage) a subclass of Image, and the rest would be elegant
and easy. But it doesn't, although I feel there _should_ be a similar
solution. Then you could write setIndex(int, Color) methods in the
DigitDisplayImage class, after which the following code example would
work to display the digit "4".
digitDisplay.setIndex(1, OFF);
digitDisplay.setIndex(2, ON);
digitDisplay.setIndex(3, ON);
digitDisplay.setIndex(4, ON);
digitDisplay.setIndex(5, OFF);
digitDisplay.setIndex(6, ON);
digitDisplay.setIndex(7, OFF);
This would be lovely.
In the absence of ColorModel classes with 'set' methods, how, in
practise, should I go about achieving a similar functionality? (In the
real application, the corresponding object needs a lot more than eight
index values and will be called upon to display far more than just
digits between 0 and 9, but I think it is better to discuss the
problem with reference to this simplified example.)
Thanks,
Adrian.
- 11
- Using Java To Implement RSA AlgorithmHi I'm looking for SOME advice on how to simulate the following:
http://i71.photobucket.com/albums/i140/carpinate/RSA.jpg
http://i71.photobucket.com/albums/i140/carpinate/RSA2.jpg
Ive done this so far:
package RSAalgorithm;
public class SecurityAlgorithm {
public static char[] StartSymbolic =
{'A','B','C','D','E','F','G','H','I','J',
'K','L','M','N','O','P','Q','R','S','T',
'U','V','W','X','Y','Z'};
public static int[] numeric =
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
16,17,18,19,20,21,22,23,24,25,26};
public static void main(String[] args) {
long P3 = 0;
long P3mod33=0;
long C7=0;
long C7mod33=0;
for(int counter = 0; counter < numeric.length; counter++){
for(int i = 0; i < StartSymbolic.length; i++) {
int temp = numeric[counter];
P3 = (long) (temp*temp*temp);
P3mod33 = P3%33;
C7 = (long)
(P3mod33*P3mod33*P3mod33*P3mod33*P3mod33*P3mod33*P3mod33);
int tp = numeric[counter];
C7mod33 = C7%33;
}
System.out.println("*******************************************");
//System.out.println(StartSymbolic[i]);
System.out.println("Numeric: " +
numeric[counter]);
System.out.println("P3: " +P3);
System.out.println("P3mod33: " + P3mod33);
System.out.println("C7: " +C7);
System.out.println("C7mod33:" + C7mod33);
// System.out.println(StartSymbolic[i]);
System.out.println("*******************************************");
}
}
}
Output:
*******************************************
Numeric: 1
P3: 1
P3mod33: 1
C7: 1
C7mod33:1
*******************************************
*******************************************
Numeric: 2
P3: 8
P3mod33: 8
C7: 2097152
C7mod33:2
*******************************************
*******************************************
Numeric: 3
P3: 27
P3mod33: 27
C7: 10460353203
C7mod33:3
*******************************************
*******************************************
Numeric: 4
P3: 64
P3mod33: 31
C7: 27512614111
C7mod33:4
*******************************************
*******************************************
Numeric: 5
P3: 125
P3mod33: 26
C7: 8031810176
C7mod33:5
*******************************************
*******************************************
Numeric: 6
P3: 216
P3mod33: 18
C7: 612220032
C7mod33:6
*******************************************
*******************************************
Numeric: 7
P3: 343
P3mod33: 13
C7: 62748517
C7mod33:7
*******************************************
*******************************************
Numeric: 8
P3: 512
P3mod33: 17
C7: 410338673
C7mod33:8
*******************************************
*******************************************
Numeric: 9
P3: 729
P3mod33: 3
C7: 2187
C7mod33:9
*******************************************
*******************************************
Numeric: 10
P3: 1000
P3mod33: 10
C7: 10000000
C7mod33:10
*******************************************
*******************************************
Numeric: 11
P3: 1331
P3mod33: 11
C7: 19487171
C7mod33:11
*******************************************
*******************************************
Numeric: 12
P3: 1728
P3mod33: 12
C7: 35831808
C7mod33:12
*******************************************
*******************************************
Numeric: 13
P3: 2197
P3mod33: 19
C7: 893871739
C7mod33:13
*******************************************
*******************************************
Numeric: 14
P3: 2744
P3mod33: 5
C7: 78125
C7mod33:14
*******************************************
*******************************************
Numeric: 15
P3: 3375
P3mod33: 9
C7: 4782969
C7mod33:15
*******************************************
*******************************************
Numeric: 16
P3: 4096
P3mod33: 4
C7: 16384
C7mod33:16
*******************************************
*******************************************
Numeric: 17
P3: 4913
P3mod33: 29
C7: 17249876309
C7mod33:17
*******************************************
*******************************************
Numeric: 18
P3: 5832
P3mod33: 24
C7: 4586471424
C7mod33:18
*******************************************
*******************************************
Numeric: 19
P3: 6859
P3mod33: 28
C7: 13492928512
C7mod33:19
*******************************************
*******************************************
Numeric: 20
P3: 8000
P3mod33: 14
C7: 105413504
C7mod33:20
*******************************************
*******************************************
Numeric: 21
P3: 9261
P3mod33: 21
C7: 1801088541
C7mod33:21
*******************************************
*******************************************
Numeric: 22
P3: 10648
P3mod33: 22
C7: 2494357888
C7mod33:22
*******************************************
*******************************************
Numeric: 23
P3: 12167
P3mod33: 23
C7: 3404825447
C7mod33:23
*******************************************
*******************************************
Numeric: 24
P3: 13824
P3mod33: 30
C7: 21870000000
C7mod33:24
*******************************************
*******************************************
Numeric: 25
P3: 15625
P3mod33: 16
C7: 268435456
C7mod33:25
*******************************************
*******************************************
Numeric: 26
P3: 17576
P3mod33: 20
C7: 1280000000
C7mod33:26
*******************************************
I was looking to achieve what is shown in the 1st image.
I can get the numeric, P3, P3mod33, C7, C7mod33 to print out but not
the symbolic information for some reason?
I want to be able to allow the user to enter in a string then the
plaintext and ciphertext can be displayed.
Like this:
String input: SUZANNE
Output:
Plaintext: S U Z A N N E
Ciphertext: 28 21 20 1 5 5 26
Thanks.
- 14
- Need help getting ant to runI'm running Windows ME. I downloaded the binary distribution of ant from
http://ant.apache.org/bindownload.cgi
I installed as directed. My path and ant_home variables seem to be set
correctly. When I try to run it by entering "ant -v", I get the following
message:
Apache Ant version 1.6.2 compiled on July 16 2004
Buildfile: build.xml does not exist!
Build failed
I searched for the file build.xml and it indeed does not exist. I'm sure
I'm just missing something really dumb and obvious, but please help me
anyway!
Thanks,
Maxine
--
mgusenet at pcg dot net
- 14
- Compiler trickJoona I Palaste wrote:
> If we have two
> threads, one of which does A and B, the other does C and D, then the
> actual physical sequence may be A-B-C-D, A-C-B-D, A-C-D-B, C-A-B-D,
> C-A-D-B or C-D-A-B. It is always guaranteed that all four operations
> are done, A is done before B, and C is done before D. Nothing else
> about the ordering is guaranteed. (This is assuming a strictly
> sequential intra-thread execution with no control structures.)
I may be missing your point here, but I think that without synchronisation,
there is no such guarantee. As it happens I've just written a passage in
another post which fits just as well here. Apologies to anyone who sees it
twice ;-)
This is discussed in the Java Memory Model JSR, see:
http://www.cs.umd.edu/~pugh/java/memoryModel/PublicReview.pdf
Two threads, two shared variables A and B, two passages of code that access
them without synchronisation:
Initially A == B == 0
Thread 1:
r2 = A;
B = 1;
Thread 2:
r1 = B;
A = 2;
A legal result of this is that r2 == 2 and r1 == 1. The JSR describes this as
"surprising behavoir". Which is a classic bit of understatement...
-- chris
|
| Author |
Message |
Moham12345

|
Posted: 2007-3-7 7:19:00 |
Top |
java-programmer, Problem understanding a java statement!
Please could somebody help me understand what this statement is doing,
k = (k1 > s0) ? k1 : s0;
what is this statement doing?
what will k be equal to if
k1 = 3 and s0 = 2 ?
|
| |
|
| |
 |
Tom Hawtin

|
Posted: 2007-3-7 7:34:00 |
Top |
java-programmer >> Problem understanding a java statement!
Moham12345 wrote:
>
> k = (k1 > s0) ? k1 : s0;
>
> what is this statement doing?
if (k1 > s0) {
k = k1;
} else {
k = s0;
}
Or, assuming suitable types:
k = Math.max(k1, s0);
Tom Hawtin
|
| |
|
| |
 |
Adam Maass

|
Posted: 2007-3-7 10:02:00 |
Top |
java-programmer >> Problem understanding a java statement!
"Moham12345" <email***@***.com> wrote:
> Please could somebody help me understand what this statement is doing,
>
> k = (k1 > s0) ? k1 : s0;
>
> what is this statement doing?
>
> what will k be equal to if
> k1 = 3 and s0 = 2 ?
>
The trick is in understanding the ternary operator,
? :
This takes three operands,
<op1> ? <op2> : <op3>
op1 must have a boolean type; op2 and op3 must have compatible types.
The value of the expression is op2 if op1 is true, op3 otherwise.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Bind to a specific interface
Hello:
One of my peers just asked if there is a way to
bind a socket to a specific interface on a dual
homed machine in a Java Application. I believe there
is but I cannot find this documented. Could someone
forward me a pointer to where this is described?
Thanks,Steve
- 2
- String ManipulationAlternatively, if you have the ability to change the XML, put them as
two separate fields in the XML. After all, the use of a comma is a
means of overloading the field.
On Jul 13, 8:57 am, "email***@***.com" <email***@***.com> wrote:
> Hey everyone, I have a string that is returned from an xml file as two
> coordinates for example 23.424242,42.13131 exactly like that with no
> spaces, what is a way to break it into two seperate integers?
- 3
- looking for a Java decompilerHello!
Is there a good byte-code de-compiler in the ports? It does not
need to be fancy/GUI -- just a straghtforward .class->.java utility.
Thanks for any pointers. Thanks!
-mi
- 4
- Detect XP themeDear NG,
One simple question: How can I detect
whether a windows user uses xp theme
or windows classic?
TIA,
Jens
- 5
- Initialization order brain-damageHi y'all,
So after spending a particularly frustrating afternoon debugging
through constructors and browsing the Java Language Specification 3.0
in some detail, I have come to the conclusion that I actually know
nothing and need to ask a question:
What is the standard order of evaluation of expressions during object
construction w/rt constructors, super-constructors, and instance
variable initializers? Specifically with the code:
class A
{
AType a1 = new AType();
A() { aDoesSomething(); }
}
class B extends A
{
AnotherType b1 = new AnotherType();
B() { bDoesSomethingElse(); }
}
B bongo = new B();
when do all of the various bits get executed? If there's a section of
the language spec that tells me this, I would really appreciate the
pointer, as well...
david rush
- 6
- [Quantian-general] Weka Machine Learning Environment
Bob,
[ BTW I had to manually approve your post as you're not (yet ?) subscribed
here -- please consider subscribing to that you can post directly. ]
On 5 November 2005 at 12:09, email***@***.com wrote:
| I would be very interested in seeing the Weka machine learning environment
| added to a live-DVD, such as Quantian. Weka is a powerful, open-source
| data mining package with many artificial intelligence algrorithms, created
| at the University of Waikato in New Zealand. It is written in Java, and so
Sure, I'm aware of Weka and their book, but have never installed it as I find
Java so tedious to work with.
I also have limited time and bandwidth for figuring out suggested packages.
If you could help with Weka, for example by installing Knoppix 4.0.2
(possibly the cdrom version) to disk and then documenting what you to do to
install Weka, and make it work well, I'd be helped quite a bit. Ideally, of
course, would be a Debian package encapsulating all this. It may be
worthwhile mentioning this to the good folks over at debian-java -- cc'ed. [
Debian-java'ers, please CC us back directly on follow-ups. ]
| is platform independent. There is also a version that can be set up in a
| cluster configuration, called Cluster Weka.
I didn't know that. What messaging toolkit do they use? Something like PVM or
LAM, or something homegrown?
| If you are interested, the website is:
|
| http://www.cs.waikato.ac.nz/ml/weka/
|
| Your work on the Quantian project is marvelous, and I applaud your efforts,
| and your contribution to the open-source community.
Thanks for your interest in Quantian, and the kind words.
Cheers, Dirk
| Bob McPherson
|
|
| _______________________________________________
| Quantian-general mailing list
| email***@***.com
| http://lists.alioth.debian.org/mailman/listinfo/quantian-general
--
Statistics: The (futile) attempt to offer certainty about uncertainty.
-- Roger Koenker, 'Dictionary of Received Ideas of Statistics'
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 7
- 1.5 ignoring networkaddress.cache property?I've noticed that 1.5 seems to be ignoring the value set for
networkaddress.cache.negative.ttl in
$JAVA_HOME/jre/lib/security/java.policy when a DNS request times out.
In one of my forms I validate user-provided URLs by trying to fetch them
and ensuring I get a reasonable response (e.g., not 404, 403, 500, etc).
If the DNS request for the hostname in the URL times out once, the JRE
never tries a lookup again. I've verified that it isn't asking by
snooping DNS traffic on my loopback with tcpdump.
Positive lookups do cache properly. Negative lookups that *don't* time
out (ie, they get an NXDOMAIN response) also seem to obey the
networkaddress.cache.negative.ttl property.
So the behaviour seems to be that a DNS timeout is cached forever, whereas
postive or negative responses are cached according to
networkaddress.cache.*.
Nick
--
"Courage isn't just a matter of not being frightened, you know. It's being
afraid and doing what you have to do anyway."
Doctor Who - Planet of the Daleks
This message has been brought to you by Nick Johnson 2.3b1 and the number 6.
http://healerNick.com/ http://morons.org/ http://spatula.net/
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 8
- java based cell phone capabilitysPlease bear with me, am old and somewhat out of touch with
technology....
Is there a cell phone that can access an web page with an mp3 playing
applet and play mp3's downloaded from the web site.
Robert
- 9
- Spring and hibernate: all these jars?All,
just downloaded the latest spring RC. I've set up a super simple test, and
had to work through a lot of classpath issues, starting with just the
spring, logging, and hibernate jars and then adding jars to the classpath
until the errors went away. here's what i finally ended up with. Does this
look correct?
I'm not so much concerned about it if it's really what's needed, but I don't
want to run into conflicts and such down the road. So mostly i'm worried i
might have screwed something up. Here's what I have (from eclipse):
<classpathentry kind="lib" path="lib/activation.jar"/>
<classpathentry kind="lib" path="lib/antlr-2.7.6.jar"/>
<classpathentry kind="lib" path="lib/c3p0-0.9.1-pre6.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-2.1.1.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.1.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="lib/ehcache-1.2.jar"/>
<classpathentry kind="lib" path="lib/hibernate3.jar"/>
<classpathentry kind="lib" path="lib/cglib-nodep-2.1_3.jar"/>
<classpathentry kind="lib" path="lib/jta.jar"/>
<classpathentry kind="lib" path="lib/jtds-1.2.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.13.jar"/>
<classpathentry kind="lib" path="lib/spring.jar"/>
- 10
- EncryptionSimple question... sorry..
I'm trying to encrypt a string with a private key (retrieved from
KeyStore - that I created using keytool). So that I can send the
public key to the client to decrypt the string.
The problem I'm having is (partially from the Java's Developer's
Almanac).
java.security.InvalidKeyException
at com.sun.crypto.provider.DESCipher.engineGetKeySize(DashoA6275)
at javax.crypto.Cipher.init(DashoA6275)
at DesEncrypter.<init>(DesEncrypter.java:24)
DesEncrypter(Key key)
throws InvalidAlgorithmParameterException, NoSuchPaddingException,
NoSuchAlgorithmException, InvalidKeyException
{
// Create an 8-byte initialization vector
// byte[] iv = new byte[]{
// (byte)0x8E, 0x12, 0x39, (byte)0x9C,
// 0x07, 0x72, 0x6F, 0x5A
// };
// AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);
ecipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
dcipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
// CBC requires an initialization vector
24: ecipher.init(Cipher.ENCRYPT_MODE, key); //, paramSpec);
The "key" problem I'm having is that the code actually uses the
"SecretKey" to the class, but I'm retrieving a "Key" private key from
the store.
I know I'm missing something..
Ian
- 11
- modificare un modello della libreria jgraphAvete mai usato la libreria jgraph per i vostri progetti?
Devo graficare lo schema di un datawarehouse che ho in XML, e modificarlo
attraverso l'interazione dell'utente (per la modifica e la visualizzazione
sto cercando di usare jgraph).
Una volta modificato il grafico, devo salvare i dati nel file XML.
Il mio problema ?che riesco a visualizzare i dati XML nel grafico Jgraph, e
modificare quest'ultimo, ma a causa delle classi utilizzate
(DefaultGraphCell) non riesco a salvare queste trasformazioni in termini di
nodi del file XML.
Dalla documentazione in rete ho capito che devo estendere e modificare la
classe GraphModel e la classe DEfaultGraphCell, ma senza un esempio o
documentazione precisa non riesco a capire quali metodi devo sovrascrivere
e cosa devo modificare per ottenere il risultato voluto.
Per questo motivo sono bloccato da giorni nella mia tesi, e ci sto perdendo
un
po' la testa, vi prego di darmi una mano (anche dirmi dove devo leggere).
Grazie in anticipo!
- 12
- JTable model's issueHi:
I have got a JTable and its cells are JPanel's (to make Java2D inside)
displaying numbers.
The problem is that I want the cells to be editable, so when you click on
the cell, you could write some number, and the new one be redisplayed.
I wrote a method called setValue() on the AbstractTableModel class which
updates the selected JPanel numerical value, but there is a little problem:
when you click a cell, you get a line full of info about the JPanel, so if
you want to enter a number, you have to clear the cell to avoid getting an
error.
so the question is, is there a way to avoid the info to get displayed? note
that my AbstractTableModel getValue() method needs to return a JPanel..
Thanks !!
--
PGR
- 13
- variable "retriever" might not have been initialized - confused[CODE]
String message = "", send = "", quit = "", errorMsg = "", cookie =
"";
boolean hasSubmittedMessage;
HTMLRetriever retriever;
// SEND MESSAGE TO SERVLET
if (hasSubmittedMessage && send.length() > 0) {
try { // USING NEW VERSION OF URLEncoder.encode() THAT REQUIRES
try{} BLOCK DUE TO NEW 2ND PARAMETER OF ENC-TYPE
retriever = new HTMLRetriever(ChatGlobals.SERVLET_SELF +
"/ppowell.ChatServlet?message=" +
URLEncoder.encode(message, "UTF-8") +
"&nickname=" +
URLEncoder.encode(cookie, "UTF-8")
); // SEND MESSAGE
} catch (UnsupportedEncodingException uee) {
errorMsg = "Error involving message submittal: " + uee.toString();
} catch (Exception e) {
errorMsg += "Unknown error: " + e.toString();
}
} else if (hasSubmittedMessage && quit.length() > 0) {
try { // USING NEW VERSION OF URLEncoder.encode() THAT REQUIRES
try{} BLOCK DUE TO NEW 2ND PARAMETER OF ENC-TYPE
retriever = new HTMLRetriever(ChatGlobals.SERVLET_SELF +
"/ppowell.ChatServlet?message=" +
URLEncoder.encode("/q", "UTF-8") +
"&nickname=" +
URLEncoder.encode(cookie, "UTF-8")
); // SEND "QUIT" COMMAND
} catch (UnsupportedEncodingException uee) {
errorMsg += "Error involving message submittal: " + uee.toString();
} catch (Exception e) {
errorMsg += "Unknown error: " + e.toString();
}
}
try {
if (retriever.getHTML() != null && quit.length() > 0)
out.println("<script type=\"text/javascript\">\n<!--
self.parent.close();\n//-->\n</script>\n");
} catch (Exception e) {} // DO NOTHING
// STUFF
[/CODE]
Produces this error:
[ERROR]
/~ppowell/includes/chat_submit_message.jsp:63: variable retriever might
not have been initialized
if (retriever.getHTML() != null && quit.length() > 0)
[/ERROR]
I can't figure out why since I'm capturing all errors because
"retriever" might not be initialized, which is the case if
hasSubmittedMessage = false. You see, if the user hasn't yet submitted
a message, nothing can be sent to the servlet, thus, the HTMLRetriever
variable "retriever" will not be initialized into a class object
because it can't unless it receives a value, which it can only do so
upon the right conditions, otherwise, no value can be passed into
"retriever".
Anyone know what I can do about this? I'm sorry but once again in PHP
this is not a problem, and I'm sorry but I have no choice but to
"translate" PHP scripts into JSP due to client dropping PHP support.
Thanx
Phil
- 14
- help needed @ Taskbar dimensions (screen size- taskbar size)Hi All,
I'm bulding a stand-alone-java GUI application.
This application is expected to run both on Windows & Linux
The content of GUI window is self configration at run time with csv
file.
Now my problem is " how to set size of GUI application window"
java.awt.Toolkit.getDefaultToolkit() can get me user's full screen-size
but u never know about user's taskbar dimensions. it can be
vertical/horizontal/auto-hide.
How could I get the actual working area for my applciation
i.e. DIMENSIONS_OF_SCREEN_SIZE - DIMENSIONS_OF_TASKBAR
- 15
- How to separate interface from implementation when using JARs?Hi,
In an engineering world where I used to be working with C++ I am now
shiftnig to Java. In C++ I would publishe my interfaces in header
files. In Java I can use the interface concept.
However this is not sufficient for me. I want to be able to full
separate the implementation from the interface of e.g. a class method.
Example:
public interface MyMath {
|
|
|