import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
class TestSwingCommonFeatures extends JFrame{
//constructor 
public void TestSwingCommonFeatures(){
//create panel to group three buttons

JPanel jp1 = new JPanel(new FlowLayout(FlowLayout.LEFT, 2 ,2));
JButton jbtLeft = new JButton("Left");
JButton jbtCenter = new JButton("Center");
JButton jbtRight = new JButton("Right");
//set color and features
jbtLeft.setBackground(Color.WHITE);
jbtCenter.setForeground(Color.GREEN);
jbtRight.setToolTipText("This is the Right Button");
//add the buttons
jp1.add(jbtLeft);
jp1.add(jbtCenter);
jp1.add(jbtRight);
jp1.setBorder(new TitledBorder("Three Buttons"));

//Create a font and a line border
Font monaco = new Font("Monaco", Font.BOLD, 20);
Border lineBorder = new LineBorder(Color.PINK, 4);

//create a panel to group two labels
JPanel jp2 =new JPanel(new GridLayout(1, 2 , 5, 5));
JLabel jlbRed = new JLabel("Red");
JLabel jlbOrange = new JLabel("Orange");
jlbRed.setForeground(Color.RED);
jlbRed.setFont(monaco);
jlbRed.setBorder(lineBorder);
jlbOrange.setForeground(Color.ORANGE);
jlbOrange.setFont(monaco);
jlbOrange.setBorder(lineBorder);
//set layout
jp2.add(jlbRed);
jp2.add(jlbOrange);
jp2.setBorder(new TitledBorder("Two Labels"));


//set layout for the frame
setLayout(new GridLayout(2,1,5,5));
add(jp1);
add(jp2);
}
public static void main(String[] args){
TestSwingCommonFeatures twcf = new TestSwingCommonFeatures();
twcf.setTitle("Swing Features");
twcf.setLocationRelativeTo(null);
twcf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
twcf.setSize(400, 300);
twcf.setVisible(true);
}
}