import java.awt.Color; import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class ButtonExample extends JFrame { private JButton redButton, greenButton; public ButtonExample() { setTitle("Button Example"); setSize(300, 200); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel buttonPanel = new JPanel(new GridLayout(2, 1)); redButton = new JButton("Red Button"); redButton.setForeground(Color.RED); buttonPanel.add(redButton); greenButton = new JButton("Green Button"); greenButton.setForeground(Color.GREEN); buttonPanel.add(greenButton); add(buttonPanel); } public static void main(String[] args) { ButtonExample be = new ButtonExample(); be.setVisible(true); } }In the above example, we create two buttons (`redButton` and `greenButton`) each with different foreground colors. The `setForeground()` method is called on each button instance to set the individual color. The package library for this method is `java.awt`.