writhe the program to create some push buttons using JButton class and draw different border around the buttons. - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
writhe the program to create some push buttons using JButton class and draw different border around the buttons.

writhe the program to create some push buttons using JButton class and draw different border around the buttons.

import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;
class BorderDemo extends JFrame{
// var
JButton b1,b2,b3,b4,b5,b6,b7,b8;
BorderDemo()
{
Container c=getContentPane();
c.setLayout(new FlowLayout());
b1=new JButton("Resied Bevel Border");
b2=new JButton("Lowered Bevel Border");
b3=new JButton("Raised Etched Border");
b4=new JButton("Lowered Ethched Border");
b5=new JButton("Line Border");
b6=new JButton("Matte Border");
b7=new JButton("Computer Border");
b8=new JButton("Empty Border");
Border bd=BorderFactory.createBevelBorder(BevelBorder.RAISED,Color.red,Color.green);
b1.setBorder(bd);

bd=BorderFactory.createBevelBorder(BevelBorder.LOWERED);
b2.setBorder(bd);

bd=BorderFactory.createEtchedBorder(EtchedBorder.RAISED,Color.red,Color.green);
b3.setBorder(bd);

bd=BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
b4.setBorder(bd);

bd=BorderFactory.createLineBorder(Color.red,5);
b5.setBorder(bd);

bd=BorderFactory.createMatteBorder(5,10,15,20,Color.red);
b6.setBorder(bd);

bd=BorderFactory.createCompoundBorder();
b7.setBorder(bd);

bd=BorderFactory.createEmptyBorder();
b8.setBorder(bd);
c.add(b1);
   c.add(b2);
   c.add(b3);
   c.add(b4);
   c.add(b5);
   c.add(b6);
   c.add(b7);
   c.add(b8);
   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[]args)
{
  BorderDemo obj=new BorderDemo();
  obj.setTitle("Borders");;
  obj.setSize(500,400);
  obj.setVisible(true);
}
}

About EasyToCode

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.