... "Sample Text", SwingConstants.CENTER);
146   displayJLabel.setForeground(colorValues[0]);
147   displayJLabel.setFont(new Font("Serif", Font.PLAIN, 72));
148
149        getContentPane().setBackground(Color.CYAN); // set background
150        add(displayJLabel, BorderLayout.CENTER); // add displayJLabel
151     } // end MenuFrame constructor
152
153     // inner class to handle action events from menu items
154     private class ItemHandler implements ActionListener
155     {
156        // process color and font selections
157        @Override
158        public void actionPerformed(ActionEvent event)
159        {
160   // process color selection
161   for (int count = 0; count < colorItems.length; count++)
162   {
163      if (colorItems[count].isSelected())
164      {
165 displayJLabel.setForeground(colorValues[count]); ...

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.