Java Basic Problems

Java JTextFiled Font: How to show Bangla (Bengali) in JTextField

Here I have share you a solution to show the Bengali (Bangla) font in java JTextField.

Code Example:

import java.awt.*;

import javax.swing.*;

public class BanglaFont extends JFrame

{

JTextField text2;

                        public BanglaFont()

                        {

                        Font displayFont1=new Font(“SutonnyMJ”, Font.BOLD,15);

                        setSize(300,200);

                        setTitle(“JTextField Font”);

                        setDefaultCloseOperation(EXIT_ON_CLOSE);

                        JPanel panel=new JPanel();

                        getContentPane().add(panel);

                        panel.setLayout(null);

                        text2=new JTextField(“Kw¤úDUvi”);

                        text2.setFont(displayFont1);

                        text2.setBounds(100,40,100,30);

                        panel.add(text2,BorderLayout.WEST);

                        }

                        public static void main(String args[])

                        {

                        BanglaFont x=new BanglaFont();

                        x.setVisible(true);

                                    }

                                      }
OUTPUT:

JTextField Font Bangla