Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 2D / Re: How to remove previous drawStrings? on: 2003-04-21 21:57:25
That was one of the first things I tried, and it seemed to ignore the alpha component.

I got it working by not even using glass pane though.
2  Java Game APIs & Engines / Java 2D / Re: How to remove previous drawStrings? on: 2003-04-13 14:58:35
Thanks.  I see what you are getting at now.  It was too obvious for my simple mind  :-/
3  Java Game APIs & Engines / Java 2D / Re: How to remove previous drawStrings? on: 2003-04-13 14:36:50
The background is transparent so the board shows through.  When I try to use clearRect the screen gets set to the background color (grey) and hides the board.

I've tried setting the background color to a transparent alpha but that doesn't work.

Essentially, I need to be able to make a specified rectangle clear and be transparent so I can redraw the countdown.

If there is another way, that would be great too.

1  
2  
3  
4  
5  
6  
7  
8  
9  
      void drawBigText(String text) {
            Graphics2D g = (Graphics2D) getGlassPane().getGraphics();
            AttributedString styledText = new AttributedString(text);
            styledText.addAttribute(TextAttribute.FAMILY, "serif");
            styledText.addAttribute(TextAttribute.SIZE, new Float(120));
            styledText.addAttribute(TextAttribute.FOREGROUND, Color.yellow);
            AttributedCharacterIterator i = styledText.getIterator();
            g.drawString(i, 80, 250);
      }
4  Java Game APIs & Engines / Java 2D / How to remove previous drawStrings? on: 2003-04-13 04:30:04
I know this is probably a pretty dumb question, but I'm stumped.

I am trying to use drawString to show a countdown timer.  However, the previous values never clear so I end up with all the numbers overlaying.

I tried to use clearRect but that clears to the background color.  I'm using the glasspane and want to show the countdown over what is already on screen.

How can I remove the text already showing on the glass Pane?
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (18 views)
2014-07-24 01:59:36

Riven (17 views)
2014-07-23 21:16:32

Riven (14 views)
2014-07-23 21:07:15

Riven (17 views)
2014-07-23 20:56:16

ctomni231 (45 views)
2014-07-18 06:55:21

Zero Volt (41 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (51 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!