Thread: Java: Graphics2D en Rectangle
-
09-01-2011, 19:11 #1Approved 9liver
- Registered
- 29/04/04
- Location
- Bilzen
- Posts
- 2,923
- iTrader
- 35 (100%)
- Mentioned
- 1 Post(s)
- Reputation
- 0/0
Java: Graphics2D en Rectangle
Beste
Momenteel heb ik altijd kaders getekend m.b.v. van dit:
Echter krijg ik altijd dezelfde dikte van kaders. Ik heb ook al de font proberen te wijzigen met graphics2D echter wil dit ook niet werken.Code:public class TekenKaders { private Rectangle k; private GraphicsAdapter ga; class GraphicsAdapter { public GraphicsAdapter(Graphics2D g) { this.graphics = g; } public void drawKader(Rectangle kader) { graphics.draw(kader); } } k = new Rectangle(); ga = new GraphicsAdapter(graphics2D); k.setRect(startpuntx, startpunty, lengtex, lengtey); ga.draw(k);
Iemand een idee hoe je de dikte van de kaders kunt wijzigen?
Bedankt.
GrtzLast edited by cooLopke; 09-01-2011 at 19:24.
Intel Core 2 Duo E6700 @ 2.66 Ghz - 2GB DDR2 PC667 - ATI HD4870 512 MB GDDR5no votes
-
-
09-01-2011, 19:25 #2Approved 9liver
- Registered
- 18/01/04
- Location
- Melle
- Posts
- 10,535
- iTrader
- 56 (100%)
- Mentioned
- 0 Post(s)
- Reputation
- 27/102
Gewoon een stroke instellen die 2px breed is (via de setStroke() method van Graphics2D). Eerste voorbeeld dat ik kon vinden: Learning Java - Chapter 6 : Java : Supplements
“In terms of how we evaluate schooling, everything is about working by yourself. If you work with someone else, it’s called cheating. Once you get out in the real world, everything you do involves working with other people.”
PSN: Cycloon - Final Fantasy XIV: A realm reborn characterno votes
-
09-01-2011, 19:26 #3Member
- Registered
- 15/11/03
- Location
- Tongeren
- Posts
- 4,829
- iTrader
- 12 (100%)
- Mentioned
- 0 Post(s)
- Reputation
- 0/24
Hoe wil je de font wijzigen? (geef eens code)
no votes
-
09-01-2011, 19:27 #4Approved 9liver
- Registered
- 29/04/04
- Location
- Bilzen
- Posts
- 2,923
- iTrader
- 35 (100%)
- Mentioned
- 1 Post(s)
- Reputation
- 0/0
Wow snelle reply. Bedankt! Ok, ik zal het eens proberen.
Intel Core 2 Duo E6700 @ 2.66 Ghz - 2GB DDR2 PC667 - ATI HD4870 512 MB GDDR5no votes
-
09-01-2011, 19:45 #5Approved 9liver
- Registered
- 29/04/04
- Location
- Bilzen
- Posts
- 2,923
- iTrader
- 35 (100%)
- Mentioned
- 1 Post(s)
- Reputation
- 0/0
Bedankt Cycloon het werkt. Het enige wat ik moest doen was:
Blijkbaar is 1 trouwens de default waarde.Code:import java.awt.BasicStroke; graphics2D.setStroke(new BasicStroke(0.5F));
Hartelijk bedankt +1 rep
.
GrtzIntel Core 2 Duo E6700 @ 2.66 Ghz - 2GB DDR2 PC667 - ATI HD4870 512 MB GDDR5no votes
