Java examples for Swing:JButton
set JButton
//package com.java2s; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import javax.swing.JButton; public class Main { public static final Color BUTTON_BACKGROUND_COLOR = Color.RED.darker(); public static final Color BUTTON_TEXT_COLOR = Color.WHITE; public static void setBtn(JButton btn, int btnWidth) { btn.setPreferredSize(new Dimension(btnWidth, 60)); btn.setFont(new Font("Arial", Font.BOLD, 15)); btn.setBackground(BUTTON_BACKGROUND_COLOR); btn.setForeground(BUTTON_TEXT_COLOR); }//from w w w . java2 s. c om }