Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Why drawString method cannot be print out?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public void paint(Graphics g)
{
int currentFace = Font.FACE_SYSTEM;
int height = 0;
g.setColor(255,255,255);
g.fillRect(0, 0, getWidth(),30);

g.setFont(Font.getFont(currentFace,
Font.STYLE_PLAIN,
Font.SIZE_LARGE));
g.drawString("Regular plain", 0, height, Graphics.TOP|Graphics.LEFT);
height += g.getFont().getHeight();
}
What shld i do to print out the Regular plain?
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears that you are working with an applet. I will move this post to the applets forum for you.
 
Saloon Keeper
Posts: 22137
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I can't tell whether it's an applet or an application. Either way would work the same. I hate to do a "double-bounce", but I think this question would get better answers in the AWT/JFC/Swing forum.
BTW, we have a naming policy here at the JavaRanch in order to fool people into thinking we're a bunch of suave, sophisticated professionals. You can find out more here.
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic