Kabilan Java PRG 11 & 14
Kabilan Java PRG 11 & 14
setFont(new
import java.io.*; female; Font("Arial", Font.PLAIN, 20));
public class Prg11 private ButtonGroup
{ gengp; name.setSize(100, 20);
public static void main(String[] args) private JLabel dob;
{ private JComboBox date;
File f1=new File("D:\\java\\ private JComboBox month; name.setLocation(100,
sample.txt"); private JComboBox year; 100);
if(f1.exists()) private JLabel add; c.add(name);
{ private JTextArea tadd;
System.out.println("File exist"); private JCheckBox term; tname = new
} private JButton sub; JTextField();
else private JButton reset;
{ private JTextArea tout; tname.setFont(new
System.out.println("File does not private JLabel res; Font("Arial", Font.PLAIN, 15));
exist"); private JTextArea resadd;
}
tname.setSize(190, 20);
System.out.println("Filename: private String dates[]=
"+f1.getName()); { "1", "2", "3", "4", "5","6", "7", "8",
System.out.println("Filepath:"); "9", "10","11", "12", "13", "14", tname.setLocation(200,
"15","16", "17", "18", "19", "20","21", 100);
"22", "23", "24", "25","26", "27", "28", c.add(tname);
System.out.println(f1.getAbsolutePath
()); "29", "30","31" };
private String months[] mno = new
if(f1.isDirectory())
= { "Jan", "feb", "Mar", JLabel("Mobile");
{
System.out.println("File is a "Apr","May", "Jun", "July",
directory"); "Aug","Sup", "Oct", "Nov", "Dec" }; mno.setFont(new
} private String years[]= Font("Arial", Font.PLAIN, 20));
else { "1995", "1996", "1997",
{ "1998","1999", "2000", "2001",
"2002","2003", "2004", "2005", mno.setSize(100, 20);
System.out.println("File is not a
directory"); "2006","2007", "2008", "2009",
} "2010","2011", "2012", "2013", mno.setLocation(100, 150);
"2014","2015", "2016", "2017", c.add(mno);
"2018","2019" };
System.out.println(f1.canRead()?"can public MyFrame() tmno = new
be read":"can not be read"); { JTextField();
date.setLocation(200, 250);
c.add(date);
month = new
JComboBox(months);
month.setFont(new
Font("Arial", Font.PLAIN, 15));
month.setSize(60, 20);
month.setLocation(250,
250);
c.add(month);
year = new
JComboBox(years);
year.setFont(new
Font("Arial", Font.PLAIN, 15));