Here you can find the source of buildButton(String btnName, JFrame frame, int x, int y, int w, int h)
private static JButton buildButton(String btnName, JFrame frame, int x, int y, int w, int h)
//package com.java2s; //License from project: Open Source License import java.awt.Color; import java.awt.Font; import javax.swing.JButton; import javax.swing.JFrame; public class Main { private static JButton buildButton(String btnName, JFrame frame, int x, int y, int w, int h) { //placing buttons JButton btn = new JButton(btnName); btn.setLayout(null);//from w w w .j a va2 s . c o m btn.setBorderPainted(true); frame.add(btn); btn.setLocation(x, y); btn.setSize(w, h); btn.setForeground(Color.RED); btn.setOpaque(true); btn.setBackground(Color.YELLOW); btn.setForeground(Color.black); btn.setFont(new Font("Canadra", Font.BOLD, 25)); return btn; } }