This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a a derived JPanel inside a JFrame. In the Panel I have a circle drawn using drawOval in Graphics which takes the x- and y-coords for the upper left point in the box bounding the oval and with and height. I need to write a single character in the center of the drawn circle. Is there any methods which can assist in doing this precisely or do I have to "hack around" ?
Create an Icon that draws the circle, set the Icon and text to a JLabel with appropriate horizontal and vbertical text position and alignments. No hacking at all. Something like (uncompiled, untested, imports omitted)JLabel = new JLabel(text, new CircleIcon(diameter), JLabel.CENTER);
label.setVerticalTextPosition(JLabel.CENTER);[/code]Apologies for any and all typos.
There are no new questions, but there may be new answers.