Search This Blog

Tuesday, November 23, 2010

ScrollBar in Swing to increase font size

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

public class ScrollFont extends JApplet implements AdjustmentListener
/*<Applet code="ScrollFont.class" height=200 width=400>

JLabel lbl;
JScrollBar bar;
public void init()
     Container frame = getContentPane();    
        lbl = new JLabel("  Welcome to My Blog");
        frame.setLayout(new BorderLayout());
        bar=new JScrollBar(0,7,5,7,50);
        bar.setToolTipText("Scroll to increase font size");      
        frame.add(lbl, BorderLayout.CENTER);

                public void adjustmentValueChanged(AdjustmentEvent e)
                  lbl.setFont(new Font("Helvetica", Font.BOLD,bar.getValue()));



geetha said... provides JAVA SWING in hyderabad with best faculties on real time projects. We give the best online trainingamong the JAVA SWING in Hyderabad. Classroom Training in Hyderabad India

Sandeep Oracle said...

Thank you for sharing this useful story. I think you shared the information is helpful to me and useful........................Please contact us for Oracle Fusion Financials Training details in our Erptree Training Institute

Post a Comment