Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1448 > unrolled thread

Re: how do i put an image

Started by"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
First post2011-04-27 15:33 +0000
Last post2011-04-27 15:33 +0000
Articles 11 — 4 participants

Back to article view | Back to comp.lang.java.gui

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: how do i put an image "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
    Re: how do i put an image "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
      Re: how do i put an image "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
        Re: how do i put an image "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
          Re: how do i put an image "Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
            Re: how do i put an image "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
      Re: how do i put an image "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
        Re: how do i put an image "Philipp" <philipp@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
          Re: how do i put an image "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
            Re: how do i put an image "Philipp" <philipp@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
              Re: how do i put an image "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000

#1448 — Re: how do i put an image

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
SubjectRe: how do i put an image
Message-ID<Bl7Uh.452335$BK1.136571@newsfe13.lga>
  To: comp.lang.java.gui
apoullakkos@googlemail.com wrote:
> Most of those talk for JPanels instead. Sorry but I'm a newbie as you
> can tell...
> 
> I tried a few but they didn't work. Anyway I'll give it another shot
> and probs post my code again later if nothing works.
> 
> Thanks anyway

The JPanel is your friend.  It is a container, very useful to help with 
component layout, it's easy to draw images or drawings on, it's easy to 
size, you can put a border on it, it's the universal component.  Take a 
look at my web site for some examples of drawing images, they use 
JPanels too.

www.knutejohnson.com

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#1451

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<70b2e9e5850e6@uwe>
In reply to#1448
  To: comp.lang.java.gui
Knute Johnson wrote:
.
>www.knutejohnson.com

Hey, cool.  When did you get the domain name?

BTW - love the sounds you put to 'Pong', they 
cracked me up.   :-)

-- 
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200704/1

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1452

From"Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<EZaUh.355$Gr1.27@newsfe12.lga>
In reply to#1451
  To: comp.lang.java.gui

Andrew Thompson wrote:
> Knute Johnson wrote:
>
www.knutejohnson.com
>
> BTW - love the sounds you put to 'Pong', they
> cracked me up.   :-)
>
Seconded:
any chance of a networked 2 player version ?-)

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1454

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<nPfUh.459868$BK1.445680@newsfe13.lga>
In reply to#1452
  To: comp.lang.java.gui
Jeff Higgins wrote:
> Andrew Thompson wrote:
>> Knute Johnson wrote:
>>
> www.knutejohnson.com
>> BTW - love the sounds you put to 'Pong', they
>> cracked me up.   :-)
>>
> Seconded:
> any chance of a networked 2 player version ?-) 
> 
> 

A two player networked game would be fun wouldn't it?  I'll have to 
think about that.  I'm not sure how to make that work.

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1458

From"Jeff Higgins" <jeff.higgins@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<iiqUh.244$gK1.143@newsfe06.lga>
In reply to#1454
  To: comp.lang.java.gui

Knute Johnson wrote:
> Jeff Higgins wrote:
>> Andrew Thompson wrote:
>>> Knute Johnson wrote:
>>>
>> www.knutejohnson.com
>>> BTW - love the sounds you put to 'Pong', they
>>> cracked me up.   :-)
>>>
>> Seconded:
>> any chance of a networked 2 player version ?-)
>
> A two player networked game would be fun wouldn't it?  I'll have to think 
> about that.  I'm not sure how to make that work.
>
http://www.cs.umu.se/education/examina/Rapporter/HaishuZhang.pdf

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1459

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<pNsUh.465490$BK1.102624@newsfe13.lga>
In reply to#1458
  To: comp.lang.java.gui
Jeff Higgins wrote:
> Knute Johnson wrote:
>> Jeff Higgins wrote:
>>> Andrew Thompson wrote:
>>>> Knute Johnson wrote:
>>>>
>>> www.knutejohnson.com
>>>> BTW - love the sounds you put to 'Pong', they
>>>> cracked me up.   :-)
>>>>
>>> Seconded:
>>> any chance of a networked 2 player version ?-)
>> A two player networked game would be fun wouldn't it?  I'll have to think 
>> about that.  I'm not sure how to make that work.
>>
> http://www.cs.umu.se/education/examina/Rapporter/HaishuZhang.pdf 
> 
> 

Thanks, I'll read through that.

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1453

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<eOfUh.459860$BK1.66062@newsfe13.lga>
In reply to#1451
  To: comp.lang.java.gui
Andrew Thompson wrote:
> Knute Johnson wrote:
> .
>> www.knutejohnson.com
> 
> Hey, cool.  When did you get the domain name?
> 
> BTW - love the sounds you put to 'Pong', they 
> cracked me up.   :-)
> 

I've had it for a while but I linked it up a couple of months ago.

I told Jeff Higgins, my wife hates the sounds and leaves the room 
whenever I play the game :-).

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1455

From"Philipp" <philipp@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<1176638058_1089@sicinfo3.epfl.ch>
In reply to#1453
  To: comp.lang.java.gui
Knute Johnson wrote:
> Andrew Thompson wrote:
>> Knute Johnson wrote:
>> .
>>> www.knutejohnson.com
>>
>> Hey, cool.  When did you get the domain name?
>>
>> BTW - love the sounds you put to 'Pong', they cracked me up.   :-)
>>
> 
> I've had it for a while but I linked it up a couple of months ago.
> 
> I told Jeff Higgins, my wife hates the sounds and leaves the room 
> whenever I play the game :-).

I got a little bug while playing. When the ball hits an upper corner 
more or less exactly (depends on speed), it stays glued to the top line. 
This is because the following Y condition

   // if ball is hitting top bounce off
   } else if (ballY <= 0) {
     veloY = -veloY;
     bink.play();
   }

Should not be "else" to the X condition.

If the ball crosses both conditions (X&Y) in the same step, the veloY 
will be added twice to ballY before the Y condition is evaluated and so 
the condition (ballY <= 0) will now be true forever (with the veloY 
changing sign at each frame).

So take out this "else".

:-)

Phil

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1460

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<AeuUh.461369$Ju2.358887@newsfe16.lga>
In reply to#1455
  To: comp.lang.java.gui
Philipp wrote:
> Knute Johnson wrote:
>> Andrew Thompson wrote:
>>> Knute Johnson wrote:
>>> .
>>>> www.knutejohnson.com
>>>
>>> Hey, cool.  When did you get the domain name?
>>>
>>> BTW - love the sounds you put to 'Pong', they cracked me up.   :-)
>>>
>>
>> I've had it for a while but I linked it up a couple of months ago.
>>
>> I told Jeff Higgins, my wife hates the sounds and leaves the room 
>> whenever I play the game :-).
> 
> I got a little bug while playing. When the ball hits an upper corner 
> more or less exactly (depends on speed), it stays glued to the top line. 
> This is because the following Y condition
> 
>   // if ball is hitting top bounce off
>   } else if (ballY <= 0) {
>     veloY = -veloY;
>     bink.play();
>   }
> 
> Should not be "else" to the X condition.
> 
> If the ball crosses both conditions (X&Y) in the same step, the veloY 
> will be added twice to ballY before the Y condition is evaluated and so 
> the condition (ballY <= 0) will now be true forever (with the veloY 
> changing sign at each frame).
> 
> So take out this "else".
> 
> :-)
> 
> Phil
> 
> 

Fixed!  It still has a few other little bugs.  Feel free to recommend fixes.

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1461

From"Philipp" <philipp@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<1176699647_1097@sicinfo3.epfl.ch>
In reply to#1460
  To: comp.lang.java.gui
Knute Johnson wrote:
> Philipp wrote:
>> Knute Johnson wrote:
>>> Andrew Thompson wrote:
>>>> Knute Johnson wrote:
>>>> .
>>>>> www.knutejohnson.com
>>>>
>>>> Hey, cool.  When did you get the domain name?
>>>>
>>>> BTW - love the sounds you put to 'Pong', they cracked me up.   :-)
>>>>
>>>
>>> I've had it for a while but I linked it up a couple of months ago.
>>>
>>> I told Jeff Higgins, my wife hates the sounds and leaves the room 
>>> whenever I play the game :-).
>>
>> I got a little bug while playing. When the ball hits an upper corner 
>> more or less exactly (depends on speed), it stays glued to the top 
>> line. This is because the following Y condition
>>
>>   // if ball is hitting top bounce off
>>   } else if (ballY <= 0) {
>>     veloY = -veloY;
>>     bink.play();
>>   }
>>
>> Should not be "else" to the X condition.
>>
>> If the ball crosses both conditions (X&Y) in the same step, the veloY 
>> will be added twice to ballY before the Y condition is evaluated and 
>> so the condition (ballY <= 0) will now be true forever (with the veloY 
>> changing sign at each frame).
>>
>> So take out this "else".
>>
>> :-)
>>
>> Phil
>>
>>
> 
> Fixed!  It still has a few other little bugs.  Feel free to recommend 
> fixes.
> 

Instead of using fillRect for the ball, you might as well use fillOval. 
It looks so much nicer :-)  (but maybe less Commodore-64 era)

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#1462

From"Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this>
Date2011-04-27 15:33 +0000
Message-ID<xgNUh.505309$Ju2.404687@newsfe16.lga>
In reply to#1461
  To: comp.lang.java.gui
Philipp wrote:
> Knute Johnson wrote:
>> Philipp wrote:
>>> Knute Johnson wrote:
>>>> Andrew Thompson wrote:
>>>>> Knute Johnson wrote:
>>>>> .
>>>>>> www.knutejohnson.com
>>>>>
>>>>> Hey, cool.  When did you get the domain name?
>>>>>
>>>>> BTW - love the sounds you put to 'Pong', they cracked me up.   :-)
>>>>>
>>>>
>>>> I've had it for a while but I linked it up a couple of months ago.
>>>>
>>>> I told Jeff Higgins, my wife hates the sounds and leaves the room 
>>>> whenever I play the game :-).
>>>
>>> I got a little bug while playing. When the ball hits an upper corner 
>>> more or less exactly (depends on speed), it stays glued to the top 
>>> line. This is because the following Y condition
>>>
>>>   // if ball is hitting top bounce off
>>>   } else if (ballY <= 0) {
>>>     veloY = -veloY;
>>>     bink.play();
>>>   }
>>>
>>> Should not be "else" to the X condition.
>>>
>>> If the ball crosses both conditions (X&Y) in the same step, the veloY 
>>> will be added twice to ballY before the Y condition is evaluated and 
>>> so the condition (ballY <= 0) will now be true forever (with the 
>>> veloY changing sign at each frame).
>>>
>>> So take out this "else".
>>>
>>> :-)
>>>
>>> Phil
>>>
>>>
>>
>> Fixed!  It still has a few other little bugs.  Feel free to recommend 
>> fixes.
>>
> 
> Instead of using fillRect for the ball, you might as well use fillOval. 
> It looks so much nicer :-)  (but maybe less Commodore-64 era)

The first Pong game I saw was in the early 70s.  It had a square ball so 
that's what I used.  Feel free to steal the code and change any part of 
it you want :-).

-- 

Knute Johnson
email s/nospam/knute/

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web