{"id":2739,"date":"2017-12-01T07:54:47","date_gmt":"2017-12-01T07:54:47","guid":{"rendered":"http:\/\/webartdevelopers.com\/?p=2739"},"modified":"2017-12-01T07:54:47","modified_gmt":"2017-12-01T07:54:47","slug":"how-to-work-with-fonts-in-an-applet-in-core-java","status":"publish","type":"post","link":"https:\/\/webartdevelopers.com\/blog\/how-to-work-with-fonts-in-an-applet-in-core-java\/","title":{"rendered":"How to Work with Fonts in an Applet in Core Java"},"content":{"rendered":"<p>In this tutorial how to work with fonts in an Applet in Core Java is shown.<\/p>\n<p>Code:<\/p>\n<p>FontDemo.java<\/p>\n<p>\/* &lt;applet code=&#8221;FontDemo.class&#8221; width=&#8221;1000&#8243; height=&#8221;1000&#8243;&gt; &lt;\/applet&gt;*\/<\/p>\n<p>import java.awt.*;<br \/>\nimport java.applet.*;<\/p>\n<p>public class FontDemo extends Applet<br \/>\n{<br \/>\npublic void paint(Graphics g)<br \/>\n{<br \/>\nFont currentFont = new Font(&#8220;Times Roman&#8221;,Font.ITALIC,20);<br \/>\ng.setFont(currentFont);<br \/>\ng.drawString(&#8220;Times Roman&#8221;,200,200);<br \/>\ncurrentFont = new Font(&#8220;Courier&#8221;,Font.BOLD+Font.ITALIC,72);<br \/>\ng.setFont(currentFont);<br \/>\ng.drawString(&#8220;Courier&#8221;,300,300);<br \/>\n}<br \/>\n}<\/p>\n<p><a href=\"https:\/\/youtu.be\/YWIvml7eelo\">https:\/\/youtu.be\/YWIvml7eelo<\/a><\/p>\n<p>&nbsp;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"In this tutorial how to work with fonts in an Applet in Core Java is shown. Code: FontDemo.java \/* &lt;applet code=&#8221;FontDemo.class&#8221; width=&#8221;1000&#8243; height=&#8221;1000&#8243;&gt; &lt;\/applet&gt;*\/ import java.awt.*; import java.applet.*; public class FontDemo extends Applet { public void paint(Graphics g) { Font currentFont = new Font(&#8220;Times Roman&#8221;,Font.ITALIC,20); g.setFont(currentFont); g.drawString(&#8220;Times Roman&#8221;,200,200); currentFont = new Font(&#8220;Courier&#8221;,Font.BOLD+Font.ITALIC,72); g.setFont(currentFont); g.drawString(&#8220;Courier&#8221;,300,300); } } &nbsp;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt -->","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[156],"tags":[219,157,217,218],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/posts\/2739"}],"collection":[{"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/comments?post=2739"}],"version-history":[{"count":2,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/posts\/2739\/revisions"}],"predecessor-version":[{"id":2741,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/posts\/2739\/revisions\/2741"}],"wp:attachment":[{"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/media?parent=2739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/categories?post=2739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webartdevelopers.com\/blog\/wp-json\/wp\/v2\/tags?post=2739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}