ERLEDIGT
NEIN
NEIN
ANTWORTEN
1
1
ZUGRIFFE
330
330
EMPFEHLEN
-
Hallo zusammen,
ich möchte gerne einen Text zentriert in einem Kreis darstellen - kann mir jemand diesbezüglich auf die Sprünge helfen:
Code :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 27 28 29 30 31 32 33 34
import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class KreisTest extends JPanel { private static final long serialVersionUID = 1L; public void paint(Graphics g) { String text = "Nr. 1"; int x = 80, y = 80; int radius = 30; g.drawOval(x - radius, y - radius, 2 * radius, 2 * radius); g.drawString(text, x, y); } public static void main(String[] args) { JFrame frame = new JFrame(); frame.getContentPane().add(new KreisTest()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200); frame.setVisible(true); } }
Danke und Gruß
RL
-
05.07.11 13:41 #2SE Tutorials.de Gastzugang
Metrics des Textes erfassen und dann rechnen.
Ähnliche Themen
-
kreis-Text
Von iAZ im Forum CSSAntworten: 2Letzter Beitrag: 21.01.09, 18:35 -
Text um Kreis legen
Von starwatcher im Forum PhotoshopAntworten: 3Letzter Beitrag: 30.12.07, 12:45 -
Text im Kreis - nicht auf dem Kreis!
Von cyberium im Forum Vektor-ProgrammeAntworten: 2Letzter Beitrag: 14.11.05, 12:43 -
text im kreis/ um kreis
Von ComicBookGuy im Forum PhotoshopAntworten: 5Letzter Beitrag: 15.04.04, 18:42 -
text im kreis
Von reko im Forum Flash PlattformAntworten: 11Letzter Beitrag: 25.02.03, 11:02





Zitieren
Login





