comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* click OK button programmaticlly - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fff32f6dbb1ec5e3
* Deprecated methods: how important to fix? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/95a8cdae1df78d61
* Servlet or EJB design question for Online Store - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2f0ed03f40147d58
* Using GridBagLayout with JFrame - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6dab24e12aab0546
* JDOM Document adapter to InputStream - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fb30cd48de56e4a5
* log4j - Omitting stack trace with ConsoleAppender - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/198cfa27fdb76b54
* Syntax: class Point2D.Double - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cd7a88d120ae7a94
* Struts Question - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/26ab90944b294dc
* What a mess: Date, milliseconds, GregorianCalendar - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/559d9f1964889f34
* some java questions... - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/56437a2ff8422ba5
* how to print a byte to the console - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/31831d0221271212
* Beginner. How to install JSP in Windows environment? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f945dcac3b133d6b
* PRINTING DIAMOND SHAPE WITH LOOPS! - 4 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/56cb33b6025f97a2
* Nokia 6100 problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1a61c6b113ad3c29
* j2me reading data files - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8aa2a43a99acc3
* How to do bitmap icon in front of menu-items in Java? what is the class for 
menu-item in Java? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ac74a360cb38fcd
* jgrasp startup error - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90e7404357b39172
* Graphic2D.setBackground - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4af59f17536c70a8
* Migrating from WAS 4.x to WAS 5.x - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70bad38429735902
  
==========================================================================
TOPIC: click OK button programmaticlly
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fff32f6dbb1ec5e3
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 1:04 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Grant Wagner wrote:

>> MAB wrote:

/ ...

> By the way, other products take this similar approach, and I don't see
> anything wrong with it. Unregistered WinZip installations present a dialog
> with the "I Agree" button randomly placed among three buttons (in an
> attempt to subvert automation programs which could click the I Agree
> button for you I believe) but allows you to continue using the product
> indefinitely (despite being a violation of the license beyond the
> specified trial time period). This guarantees you are not left with ZIPed
> files and a non-working ZIP extraction utility, while at the same time
> allowing the vendor to provide motivation for the end-user to purchase a
> license.

I agree with your overall point, but IMHO this is a bad example. WinZIP is
just a container for a public-domain compression algorithm, one that is
freely available from many other sources. It is a classic case of
exploiting the ignorance of Windows users.

In this case, WinZIP is the problem, not the user trying to avoid paying for
it. In this case it is a toss-up as to who is cheating whom.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: Deprecated methods: how important to fix?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/95a8cdae1df78d61
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 24 2004 1:07 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Tue, 24 Aug 2004 14:17:35 -0500, kaeli wrote:

> stop() in java.lang.Thread has been deprecated 

  /* old - stop the thread */
  Thread.stop()

  /* new */
  run() {
    while(stillAlive) {
      ...
    }
  }

  ...
  // stop the thread
  stillAlive = false;

> action(java.awt.Event,java.lang.Object) in java.awt.Component has been 
> deprecated 

Implement ActionListener on the applet and  
  Component.addActionListener(this);

> handleEvent(java.awt.Event) in java.awt.Component has been deprecated 

Should not be required if you implement 
ActionListener, you simply detect the 
event in actionPerformed() and do with
it as you wish.

> How hard are these to re-do, 

Not very, unless there are lots of components 
to change,  in which case it amounts to some 
drudgery.

>..and should I bother? I'm only supposed to be 
> fixing a bug totally unrelated to these (at least as far as I know they're 
> unrelated...).

I would tend to fix the bug first, I think, 
unless you become convinced it *is* the problem.

> If YOU inherited the code, would you fix it or leave it?

(waggles hand)  Are they paying you extra to fix it?
Will you be working on the code again in the future?
Is the Applet likely to be used for years more?

I'd be tempted to fix them simply not for having to
put up with the irritation of the warning, though 
sometimes such a 'pro-active' approach goes down 
like a ton of bricks (..if anybody finds out).

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology



== 2 of 2 ==
Date:   Tues,   Aug 24 2004 1:20 pm
From: Eric Sosman <[EMAIL PROTECTED]> 

kaeli wrote:
> Hey all,
> 
> I just inherited some code for an applet. I have never made an applet. Yay 
> me.
> Anyway, it's old code that has a bug, and I need to find and fix the bug. I 
> figured as long as I was doing that, I should get the code to use java 1.4 
> (it was made with something way before this) since all our browers here tend 
> to have 1.4xx.
> So, I compiled it, and fixed most of the deprecated stuff, but I'm wondering 
> about these:
> 
> stop() in java.lang.Thread has been deprecated 
> action(java.awt.Event,java.lang.Object) in java.awt.Component has been 
> deprecated 
> handleEvent(java.awt.Event) in java.awt.Component has been deprecated 
> 
> I've never made an applet, as I said, nor used the AWT components. I've never 
> done threads.
> How hard are these to re-do, and should I bother? I'm only supposed to be 
> fixing a bug totally unrelated to these (at least as far as I know they're 
> unrelated...).
> If YOU inherited the code, would you fix it or leave it?

     There's no simple answer to this kind of question.
You need to assess how hard it would be to fix the program
and compare that to the amount of damage that a failure
would cause.  Costs and benefits, benefits and costs.

     One thing to keep in mind is that methods don't become
deprecated out of mere whim.  Face it: A deprecated method
is an admission that the original design was deficient.  If
someone draws a deep breath and confesses "I wuz wrong," you
must assume that he considers it more important to warn you
off than to save face for himself.  A concern that prompts
us famously egotistical software types into an embarrassing
admission is worth paying some heed to.

     The Javadoc for a deprecated method usually describes the
shortcomings of the original design, and what the consequences
of using the method might be.  It also usually suggests a
substitute method, and this should give you an idea of the
difficulty of the fix.  Consider the Javadoc as you decide to
fix or to let be.

-- 
[EMAIL PROTECTED]





==========================================================================
TOPIC: Servlet or EJB design question for Online Store
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2f0ed03f40147d58
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 24 2004 1:14 pm
From: Sudsy <[EMAIL PROTECTED]> 

mj wrote:
<snip>
> I am creating an online store for our company. As part of the design,
> I wanted to seperate the admin/back-office functions into a seperate
> webapp. <snip>

Most of the time you don't need a separate webapp. Investigate the use
of roles for your clients. Admin users can be presented with different
options than regular users. To be specific, check out
javax.servlet.http.HttpServletRequest#isUserInRole( String role )
You don't require a fully-fledged J2EE server to provide this
functionality: a servlet container such as Tomcat can provide all
you need.




== 2 of 2 ==
Date:   Tues,   Aug 24 2004 6:31 pm
From: "Will Hartung" <[EMAIL PROTECTED]> 


"Sudsy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> mj wrote:
> <snip>
> > I am creating an online store for our company. As part of the design,
> > I wanted to seperate the admin/back-office functions into a seperate
> > webapp. <snip>
>
> Most of the time you don't need a separate webapp. Investigate the use
> of roles for your clients. Admin users can be presented with different
> options than regular users. To be specific, check out
> javax.servlet.http.HttpServletRequest#isUserInRole( String role )
> You don't require a fully-fledged J2EE server to provide this
> functionality: a servlet container such as Tomcat can provide all
> you need.

Also, even if you decide to go with seperate WebApps, there's no reason why
the two applications can't share code and classes. Just because they're both
using the same classes doesn't mean you're duplicating code. Just have two
different build options from a single source tree.

Regards,

Will Hartung
([EMAIL PROTECTED])






==========================================================================
TOPIC: Using GridBagLayout with JFrame
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6dab24e12aab0546
==========================================================================

== 1 of 3 ==
Date:   Tues,   Aug 24 2004 1:13 pm
From: "Madhur Ahuja" <[EMAIL PROTECTED]> 

Sudsy wrote:
> KingKongBundy wrote:

>
> Also, the weightx
> and weighty should be something like 0.5 and should be the same for
> both elements.

Hello

Why!, If the weightx and weighty are same for both elements, will it make a
difference
what value it is? After all, they are just proportions.


--
Winners dont do different things, they do things differently.

Madhur Ahuja
India

Homepage : http://madhur.netfirms.com
Email    : madhur<underscore>ahuja<at>yahoo<dot>com








== 2 of 3 ==
Date:   Tues,   Aug 24 2004 2:52 pm
From: Sudsy <[EMAIL PROTECTED]> 

Madhur Ahuja wrote:
<snip>
> Why!, If the weightx and weighty are same for both elements, will it make a
> difference
> what value it is? After all, they are just proportions.

 From the javadocs:

> weightx
> 
> public double weightx
> 
>     Specifies how to distribute extra horizontal space.
> 
>     The grid bag layout manager calculates the weight of a column to be the
 > maximum weightx of all the components in a column. If the resulting 
layout
 > is smaller horizontally than the area it needs to fill, the extra 
space is
 > distributed to each column in proportion to its weight. A column that 
has a
 > weight of zero receives no extra space.
> 
> If all the weights are zero, all the extra space appears between the grids
 > of the cell and the left and right edges.

Where it comes into play is if the size of the Container is smaller than
the Components it contains. Giving priority to one of the Components by
specifying a higher weightx or weighty will alter the visual rendering.
In the situation posited by the OP it doesn't seem to make sense to
prioritize the display, any more than it makes sense to specify a gridy
of 100 when there are only two Components... :-0
Having spent a bunch of time with GridBagLayout and GridBagConstraints,
I'm merely suggesting a beneficial approach. Apparently, YMMV.




== 3 of 3 ==
Date:   Tues,   Aug 24 2004 2:56 pm
From: Cid <[EMAIL PROTECTED]> 

On Wed, 25 Aug 2004 01:43:20 +0530, "Madhur Ahuja" <[EMAIL PROTECTED]> wrote:

>Sudsy wrote:
>> KingKongBundy wrote:
>
>>
>> Also, the weightx
>> and weighty should be something like 0.5 and should be the same for
>> both elements.
>
>Hello
>
>Why!, If the weightx and weighty are same for both elements, will it make a
>difference
>what value it is? After all, they are just proportions.

If weightx is 0 (which it is by default) then the components won't
resize at all on that axis (same deal for weighty). If you do set
values for one or more components on an axis, all those values are
normalized by Swing internally (range 0..1). So you could set them
both to .5, 1, or 2534 as long as they're the same. 

If you're going to add more components later it can be conceptually
simpler to keep track of if you just start out using normalized
weights to begin with. The Swing tutorial recommends (for this reason)
that you use weights, by axis, that add up to 1.0. Just makes it
easier for a reader to visualize.





==========================================================================
TOPIC: JDOM Document adapter to InputStream
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fb30cd48de56e4a5
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 2:05 pm
From: [EMAIL PROTECTED] (GIMME) 

> Any ideas?
> 

Write your JDOM object to a String variable with XMLOutputter's
outputString method. Then create an InputStream from something
like String's NewStringReader.




==========================================================================
TOPIC: log4j - Omitting stack trace with ConsoleAppender
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/198cfa27fdb76b54
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 3:07 pm
From: Oscar kind <[EMAIL PROTECTED]> 

scott <[EMAIL PROTECTED]> wrote:
> Sure, don't use ConsoleAppender.  Use log4j's Chainsaw V2 instead:
> 
> http://logging.apache.org/log4j/docs/chainsaw.html

Thanks for pointing this out! It looks like a good tool.


-- 
Oscar Kind                                    http://home.hccnet.nl/okind/
Software Developer                    for contact information, see website

PGP Key fingerprint:    91F3 6C72 F465 5E98 C246  61D9 2C32 8E24 097B B4E2




==========================================================================
TOPIC: Syntax: class Point2D.Double
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cd7a88d120ae7a94
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 24 2004 3:12 pm
From: [EMAIL PROTECTED] (Jenny) 

Thank you!

So the line below is a description, not the Java code.

 public static class Point2D.Double extends Point2D



== 2 of 2 ==
Date:   Tues,   Aug 24 2004 4:51 pm
From: "Murray" <[EMAIL PROTECTED]> 


"Jenny" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thank you!
>
> So the line below is a description, not the Java code.
>
>  public static class Point2D.Double extends Point2D

Yes, but that is also how classes external to Point2D will reference the
class.

Point2D.Double dbl = ....

Internally though it is defined as VisionSet said.






==========================================================================
TOPIC: Struts Question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/26ab90944b294dc
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 24 2004 3:17 pm
From: Oscar kind <[EMAIL PROTECTED]> 

Bryce <[EMAIL PROTECTED]> wrote:
> What I do is format using DecimalFormat when I write the value to my
> Struts Form. All fields in my Struts form are strings. When I retrieve
> a data object, the fields are copied tot he Struts form. For all
> Integer, BigDecimal, etc, I use the appropriate Format class.

A slightly different approach would be to let the non-String properties
of your Form bean have a twin that represents the same value as a String.

The Form bean can then convert from and to the String representations
(you'll have to call the conversion methods yourself though, unless you
extend Struts).


-- 
Oscar Kind                                    http://home.hccnet.nl/okind/
Software Developer                    for contact information, see website

PGP Key fingerprint:    91F3 6C72 F465 5E98 C246  61D9 2C32 8E24 097B B4E2



== 2 of 2 ==
Date:   Tues,   Aug 24 2004 7:12 pm
From: "WJ" <[EMAIL PROTECTED]> 

Thanks.  I basically did this.  I formatted the number using a NumberFormat,
set the form in the action class, then returned to the page.

I was hoping there was a slick format in struts for this (that works).

~Cheers!






==========================================================================
TOPIC: What a mess: Date, milliseconds, GregorianCalendar
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/559d9f1964889f34
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 5:32 pm
From: "P.Hill" <[EMAIL PROTECTED]> 

Erwin Moller wrote:
> Hi group,
> 
> (Sorry for complaining)
> Is it just me or do dates, milliseconds, GregorianCalendar completely 
> confusing? 

Apparently so, judging from the arguments that can erupt over such calculations.
In the interest of trying to avoid having to explain this yet again to another 
person who thinks they know the answer and trying to point out that
( day1Milliseconds - day2Milliseconds ) / MILLISECONDS_PER_DAY is NOT the 
correct answer for many values of day1 and day2 I suggest you, the
reader interested in this problem, see:
http://www.xmission.com/~goodhill/dates/deltaDates.html

If you have any suggestions for improvements to the article or code, please let 
me know.

-Paul Hill





==========================================================================
TOPIC: some java questions...
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/56437a2ff8422ba5
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 5:50 pm
From: anon <[EMAIL PROTECTED]> 

alessandro wrote:
> Hi, in my third java program (yes, I'm new to this lang.) I have some
> troubles:
> -I often get StackOverFlow exceptions. What are the common problems that
> lead to this error? I come from C/C++ programming, and perhaps have some
> habits that are wrong used with Java...
> -My program connects with two other instances of itself trought sockets.
> Managing the connections requires the creation of 5 threads: one for the
> connection (but I close the thread just after) and four for the 2 I/O
> channels. I asked around and many people said this is the only available way
> for non-blocking I/O (without using NIO). But my program is toooo slow now.
> It requires 5 seconds for the connection (with all three program running on
> the same machine) and several seconds even for reading -writing less than 10
> bytes. Is a thread issue? Or am I making some stupid error?
> 
> 
Some others have already given tips on your stack overflow problems, so 
I'll just add that you may want to look into using the 
java.io.PipedInputStream, java.io.PipedOutputStream, 
java.io.PipedReader, and java.io.PipedWriter streams for your 
interthread communications instead of java.net.Socket.




==========================================================================
TOPIC: how to print a byte to the console
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/31831d0221271212
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 5:43 pm
From: Jim <[EMAIL PROTECTED]> 

On Tue, 24 Aug 2004 16:17:11 +0200, Roderik <[EMAIL PROTECTED]> wrote:

>Hi,
>
>I try to print a byte to the console. I like to print it in the 
>hexadeximal format. like
>FF or something
>
>How can I do this with System.out.println?

Try the following

  System.out.print(Integer.toHexString((i >= 0) ? i : 256 + i));

If you need two digit hex then

  StringBuffer s =
    new StringBuffer(Integer.toHexString((i >= 0) ? i : 256 + i));

  if(s.length() == 1) s.insert(0,'0');


Jim





==========================================================================
TOPIC: Beginner. How to install JSP in Windows environment?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f945dcac3b133d6b
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 6:49 pm
From: "Will Hartung" <[EMAIL PROTECTED]> 


"Sky Sigal" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello.
>
> a) I know nothing about Java.
> b) Been wanting to get to know Java for a long time.
> c) Ultimately, I am looking for a means to install Java at home, and at
remote
> clients -- without requiring a PhD to install the connectors, etc.
> d) So far -- the instructions at the Jakarta(sp?) site on their connector
was
> enough to scare me off -- let alone any non-programmer client.
> e) They all have IIS. No apache. And they would not switch.
>
> Any suggestions as to where to download an install package that will
install
> Java into IIS -- just like PHP does?

Tomcat is a slam dunk. Install the Sun JDK, Download Tomcat, Unzip it.

You don't need IIS to develop Java apps with Tomcat. Locally you can simply
disable IIS if it is running and run Tomcat instead on port 80, or you can
let it peacefully co-exist with IIS and work against port 8080 (or any other
port for that matter).

Tomcat can easily serve static content (HTML, GIFs, PDFs) just like IIS.

After you've written and worked with you application, you'll be much more
comfortable with Tomcat and can then delve back in to the arcane details
necessary to get Tomcat to work behind IIS, but that's only necessary if
their current site is using any of the IIS features (notably ASP) beyond a
general web server. If not, just run Tomcat straight and skip IIS.

Finally, if you're deciding on a development platform solely on its
simplicity to install, you really should reconsider your priorities.
Developing in Tomcat is trivial to set up, deploying it behind a web server
(IIS, Apache) is a bit more complicated, but that comes much later in the
process.

Or you can look at commercial solutions like JRrun for "double click"
install.

> Barring that -- how do you suggest writting software and distribute it to
> non-programmer clients who have no idea on how to install the runtime,
etc?

Go to their site and set it up for them? Write up detailed instructions and
tack a phone number on the bottom? Buy something like InstallShield and
write scripts for it, like every other Windows programmer?

Regards,

Will Hartung
([EMAIL PROTECTED])






==========================================================================
TOPIC: PRINTING DIAMOND SHAPE WITH LOOPS!
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/56cb33b6025f97a2
==========================================================================

== 1 of 4 ==
Date:   Tues,   Aug 24 2004 6:59 pm
From: [EMAIL PROTECTED] (Jay Dean) 

I need simple nested loops (either for, or while) code for a method to
print a diamond shaped stars for n stars, where n is odd.
  Example. n=9 would produce

        *
       ***
      *****
     *******
    *********
     *******
      *****
       ****
        *
 I have STRUGGLED with this for over three days in a row and my head
aches!
I tried with nested loops, and conditions but the results were not
encouraging.
I am a novice in Java and need help with simple nested loops to
construct this. Thanks in advance for your help !!

 Jay Dean



== 2 of 4 ==
Date:   Tues,   Aug 24 2004 7:06 pm
From: Cid <[EMAIL PROTECTED]> 

On 24 Aug 2004 18:59:36 -0700, [EMAIL PROTECTED] (Jay Dean) wrote:

>I need simple nested loops (either for, or while) code for a method to
>print a diamond shaped stars for n stars, where n is odd.
...
> I have STRUGGLED with this for over three days in a row and my head
>aches!
>I tried with nested loops, and conditions but the results were not
>encouraging.
>I am a novice in Java and need help with simple nested loops to
>construct this. Thanks in advance for your help !!


1. comp.lang.java.help is a more appropriate group for intro questions

2. when you repost there, include your current sample code and
explanation of exactly what part of the logic is throwing you. That
way people will see that you're actually working on it and not asking
them to do your homework for you.



== 3 of 4 ==
Date:   Tues,   Aug 24 2004 8:10 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Jay Dean wrote:

> I need simple nested loops (either for, or while) code for a method to
> print a diamond shaped stars for n stars, where n is odd.
>   Example. n=9 would produce
> 
>         *
>        ***
>       *****
>      *******
>     *********
>      *******
>       *****
>        ****
>         *
>  I have STRUGGLED with this for over three days in a row and my head
> aches!

And to think you could have stopped and read your textbook for a while. That
would have been more productive.

> I tried with nested loops, and conditions but the results were not
> encouraging.

I guess so, since you couldn't bring yourself to post the result.

> I am a novice in Java and need help with simple nested loops to
> construct this.

Okay, here's my advice. Post your code if you expect help.

-- 
Paul Lutus
http://www.arachnoid.com




== 4 of 4 ==
Date:   Tues,   Aug 24 2004 8:16 pm
From: "Hal Rosser" <[EMAIL PROTECTED]> 


"Jay Dean" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I need simple nested loops (either for, or while) code for a method to
> print a diamond shaped stars for n stars, where n is odd.
>   Example. n=9 would produce
>
>         *
>        ***
>       *****
>      *******
>     *********
>      *******
>       *****
>        ****
>         *
>  I have STRUGGLED with this for over three days in a row and my head
> aches!
> I tried with nested loops, and conditions but the results were not
> encouraging.
> I am a novice in Java and need help with simple nested loops to
> construct this. Thanks in advance for your help !!
>
>  Jay Dean

Jay,
Being a beginner at programming, it may be a good idea to plan it out first.
you typed out what you want your program to do, so you should make note of
what you did.
For instance, note that the number of spaces before the "*" starts at a
maximum value and decreases by one after each print.
Also note the number of "*"s increase from one to a maximum value - then
decreases by one to one.
You're on the right track of using nested loops - you need to increment one
value and decrement another value.
Its a good exercise in planning your app.
Use flowcharts to plan if it makes things clearer for you.
Plan first - then write the code.
Hope this helps
Hal


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004






==========================================================================
TOPIC: Nokia 6100 problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1a61c6b113ad3c29
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 7:00 pm
From: JScoobyCed <[EMAIL PROTECTED]> 

Marcin wrote:

> Hi,
> 
> I'm not sure I'm posting to the right group but I could not find any
> Nokia-J2ME related. If you know such a group please let me know.
> 
> The problem is with midlet that I'm currently developing (under
> Borland JBuilder X). It works fine on the emulator, but on the phone
> I'm getting errors like "TextEdit.SetLayout() - no such method". I
> guess JVM on my phone may be older than the one I use with the
> emulator.
> 
> So the question is - where to get information which version of JVM do
> I have in my Nokia, and, how to update it?
> 
> greetz
> Marcin

Hi,

  The Nokia 6100 as the MIDP 1.0, CLDC 1.0. (see 
http://jal.sun.com/webapps/device/device) for other models.
You can't update/upgrade it, as it comes from the manufacturer (Nokia). 
Or at least I doubt you can do it from a retail shop. Now you can try to 
find a Nokia engineer and ask him/her to write the software for you 
(which would cost you a lot of time to find that engineer, and a lot of 
money).
In other words, you are limited to the JVM you have on the phone.

-- 
JScoobyCed
What about a JScooby snack Shaggy ? ... Shaggy ?!




==========================================================================
TOPIC: j2me reading data files
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e8aa2a43a99acc3
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 7:09 pm
From: JScoobyCed <[EMAIL PROTECTED]> 

mannewalis wrote:

> Greetings, 
> 
> I am new to Java and j2me, and have a couple of questions. I want to
> write a small program to display some data that I have on a j2me
> enabled device. The data could be downloaded from a URL, and/or stored
> locally as a file. My question is how to open a local file on the
> device? And can this be done? I am wondering if the java midlet can
> only access resources within its own jar file. If it can access files
> outside the jar, then what would the path be to those files?
> 
> Thanks
> Justin

Hi,

   You can access to file from a URL (I never did it, because I would 
have to pay for the WAP/GPRS connection): use HttpConnection then open a 
stream and read from it.
  You can access data from the .JAD which comes with the MIDlet (or the 
MANIFEST.MF file if no .JAD): use MIDlet.getAppProperty(String).
  You can access database through the rms package of MIDP. Note that you 
will access only database that your MIDlet create (or other MIDlet 
created with the shared flag set to true).
You can't access any file from the phone (for ex., in Symbian OS, you 
can't open a file by URL: "file://C/System/file.ext"). Or at least 
that's what I have understood from the JVM sandbox. That gives me idea 
to try tonight :)

-- 
JScoobyCed
What about a JScooby snack Shaggy ? ... Shaggy ?!




==========================================================================
TOPIC: How to do bitmap icon in front of menu-items in Java? what is the class for 
menu-item in Java?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3ac74a360cb38fcd
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 24 2004 8:07 pm
From: "gino" <[EMAIL PROTECTED]> 

Hi all,
I have some menu-items in Java, they are "checked" menu-items... I want to
change that "check tick" in front of the menu items to other bitmap icon to
display some fancy bitmaps in front of the menu items...

HOw can I do that in Java? Which class in AWT does this menu-item belong to?





== 2 of 2 ==
Date:   Tues,   Aug 24 2004 8:17 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

gino wrote:

> Hi all,
> I have some menu-items in Java, they are "checked" menu-items... I want to
> change that "check tick" in front of the menu items to other bitmap icon
> to display some fancy bitmaps in front of the menu items...

So write your own MenuItem class or extension.

> HOw can I do that in Java? Which class in AWT does this menu-item belong
> to?

Read the documentation.

http://java.sun.com/j2se/1.3/docs/api/java/awt/MenuItem.html

java.lang.Object , java.awt.MenuComponent, java.awt.MenuItem

Don't cross-post without a reason.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: jgrasp startup error
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/90e7404357b39172
==========================================================================

== 1 of 3 ==
Date:   Tues,   Aug 24 2004 8:18 pm
From: [EMAIL PROTECTED] (Josh) 

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object


This orrcurs on both the Microsoft and Sun VM machine. Any suggestions?



== 2 of 3 ==
Date:   Tues,   Aug 24 2004 8:25 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Josh wrote:

> Error occurred during initialization of VM
> java/lang/NoClassDefFoundError: java/lang/Object
> 
> 
> This orrcurs on both the Microsoft and Sun VM machine. Any suggestions?

Yeah. Give the specifics. Post example code.

-- 
Paul Lutus
http://www.arachnoid.com




== 3 of 3 ==
Date:   Tues,   Aug 24 2004 9:30 pm
From: "Hal Rosser" <[EMAIL PROTECTED]> 

You need the Sun JDK - not just the JVM to run JGrasp
the jdk come with javac - which you need for JGrasp
Install the JDK first - then install JGrasp - then JGrasp will find the jdk
and set itself up correctly.

"Josh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Error occurred during initialization of VM
> java/lang/NoClassDefFoundError: java/lang/Object
>
>
> This orrcurs on both the Microsoft and Sun VM machine. Any suggestions?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/30/2004






==========================================================================
TOPIC: Graphic2D.setBackground
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4af59f17536c70a8
==========================================================================

== 1 of 2 ==
Date:   Tues,   Aug 24 2004 8:28 pm
From: [EMAIL PROTECTED] (Jenny) 

Hi,

Could you tell me why the code comp2D.setBackground(Color.white); does
not make the color white?  The code comp2D.fillRect(0, 0, 400, 400);
works.


Thank you very much.



import java.awt.*;
import javax.swing.*;
import java.awt.geom.*;

public class Line extends JFrame {
    public Line() {
        super("Line");
        setSize(410, 430);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        LinePanel lp = new LinePanel();
        Container content = getContentPane();
        content.add(lp);
        setContentPane(content);
        setVisible(true);
    }

    public static void main(String[] arguments) {
        Line line = new Line();
    }
}

class LinePanel extends JPanel {
    public void paintComponent(Graphics comp) {
        super.paintComponent(comp);
        Graphics2D comp2D = (Graphics2D) comp;
        comp2D.setBackground(Color.white);
       // comp2D.fillRect(0, 0, 400, 400);
        Line2D.Double l1 = new Line2D.Double(10,200,390,200);
        Line2D.Double l2 = new Line2D.Double(200,10,200,390);
        BasicStroke pen = new BasicStroke(5F);
        comp2D.setColor(Color.blue);
        comp2D.draw(l1);
        comp2D.draw(l2);
    }
}



== 2 of 2 ==
Date:   Tues,   Aug 24 2004 9:03 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Jenny wrote:

> Hi,
> 
> Could you tell me why the code comp2D.setBackground(Color.white); does
> not make the color white?  The code comp2D.fillRect(0, 0, 400, 400);
> works.

Your instruction to set the background white is simply a way to assign a
color for the next paint command. But the instruction is issued by code
*within* the paint command. The subsequent fillRect() call actually paints
with the chosen the color.

The setBackground command properly belongs in the main program, not in the
paintComponent() method.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: Migrating from WAS 4.x to WAS 5.x
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/70bad38429735902
==========================================================================

== 1 of 1 ==
Date:   Tues,   Aug 24 2004 8:37 pm
From: Nevermind <[EMAIL PROTECTED]> 

Hi All,

We are planning to upgrade our app server from WAS 4.x to WAS 5.x. We 
know that WAS 5.x supports J2EE 1.2 and J2EE 1.3 so we do not need to 
migrate the EJBs to 1.3, right? What would we lose if do not migrate the 
code to 1.3? What are the other issues that we should we take care of 
while upgrading from WAS 4.x to WAS 5.X?

Your help will be appreciated so much, thanks in advance!




=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/prefs

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to