Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

an applet that increases font size in a label by clicking a button

843807Mar 14 2006
can somebody help me with this code please? This is an applet that is supposed to set the font size in a label to 4 and keep increasing the size by one with the click of a button as long as it doesn't go over 88. this is my code:

import javax.swing.*;
import java.awt.*
import java.awt.event.*

Public class FontSize extends JApplet implements ActionListener

JLabel name = new JLabel("Ryan")
JButton fontsize = new JButton("Increase font size")

Container c = getContentPane();

public void init();
{
c.setLayout(new FlowLayout());
c.add(name);
c.add(fontsize);
fontsize.add Actionlistener(this);
f = name.getFont();
name.setFont(new Font(f.getSize(8)));
}

public void display;
{
fontsize.setText(name);
}


public void ActionPerformed (ActionEvent e)
{

for(int i = 0; i < 88; i++)
{
Font = Font + 1;

}

I need the corrections as soon as possible. Can somebody tell me what i am doing wrong? thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 11 2006
Added on Mar 14 2006
0 comments
164 views