June 2017
Beginner
1296 pages
69h 23m
English
... "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]); ...Read now
Unlock full access