Comp 274 week 4 programming assignment
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Comp 274 week 4 programming assignment

  • 183 views
Uploaded on

Write a Java GUI application to allow you to experiment with colors and fonts. The general appearance of you GUI should be something similar to the following: ...

Write a Java GUI application to allow you to experiment with colors and fonts. The general appearance of you GUI should be something similar to the following:
Your program must meet the following requirements:
1. Do not use any of the GUI editing capabilities of Eclipse for this assignment. Do all the GUI layout work based on what you have learned in class in the last 2 weeks.
2. You can use either inheritance or composition to get a JFrame into your application.
3. All member variables must be private.
4. The GUI and event handling setup must be done in the constructor of your GUI class or in privatemethods called from the constructor. Hint: it would seem logical to have a private method to build the top, left, and bottom panels.
5. The main text field (the red one above) will be used to show the results from the selection of font size, bold and italic selection, and foreground and background color selection.
6. The display must have a label and JTextField where the user inputs a font size value and which must appear in the upper part of the frame as shown above.
7. There must also be 2 check boxes that will control whether the font has bold and/or italic characteristics and which must appear in the upper part of the frame as shown above.
8. There must be a set of 3 radio buttons which are used to set the foreground and background colors of the main text field (the one in red above). The third button is used to reset the background of the main text field to white, and the foreground of the main text field to black. The three radio buttons must appear in the bottom part of the frame.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
183
On Slideshare
183
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. SOLUTIONJUG.COMCLICK HERE TO GET THE SOLUTION !!!!!!!COMP 274 - Week 4 Programming AssignmentWrite a Java GUI application to allow you to experiment with colors and fonts. The generalappearance of you GUI should be something similar to the following:Your program must meet the following requirements:1. Do not use any of the GUI editing capabilities of Eclipse for this assignment. Do allthe GUI layout work based on what you have learned in class in the last 2 weeks.2. You can use either inheritance or composition to get a JFrame into your application.3. All member variables must be private.4. The GUI and event handling setup must be done in the constructor of your GUI class orin privatemethods called from the constructor. Hint: it would seem logical to have a private methodto build the top, left, and bottom panels.5. The main text field (the red one above) will be used to show the results from the selection offont size, bold and italic selection, and foreground and background color selection.6. The display must have a label and JTextField where the user inputs a font size value andwhich must appear in the upper part of the frame as shown above.7. There must also be 2 check boxes that will control whether the font has bold and/or italiccharacteristics and which must appear in the upper part of the frame as shown above.8. There must be a set of 3 radio buttons which are used to set the foreground and backgroundcolors of the main text field (the one in red above). The third button is used to reset the backgroundof the main text field to white, and the foreground of the main text field to black. The three radiobuttons must appear in the bottom part of the frame.9. There also needs to be a set of 3 text fields used to input the values of the red, green, andblue color components (in the left panel above). These values are used when the foreground orbackground radio buttons are selected. These text fields and their labels can appear on either theleft or right side of the main text field.10. Event handling must be setup so that your GUI responds to the following 6 events:a. Enter key in the font size text field causes your program to respond and change the main textfield to display its text string using the new font size. The current style should be maintained… so ifthe font was bold before, the new display still has bold text.b. Clicking on either the bold or italic check boxes causes your program to respond and changethe main text field to display its text string using the new bold / italic setting. The current size of thetext in the text field should be maintained. The possible combinations here are not bold and notitalic, bold and not italic, italic and not bold, both bold and italic.
  • 2. c. Clicking the reset radio button causes your program to respond and change the main textfield background color to white and the foreground color to black.d. Clicking on the foreground color causes your program to respondand convert the string values from the red, green and blue text fields to numbers that must bebetween 0 and 255. If a value is more than 255, just set the value to 255. Then the foregroundcolor of the main text field is set to this new color value. The current background color is notchanged.e. Clicking on the background color causes your program to respondand convert the string values from the red, green and blue text fields to numbers that must bebetween 0 and 255. If a value is more than 255, just set the value to 255. Then the backgroundcolor of the main text field is set to this new color value. The current foreground color is notchanged.f. Only one of the radio buttons is allowed to be selected at any time.Changing colors and fonts on a text field…JTextField tf = new JTextField(“Whatever text”);tf.setBackground(Color.WHITE);tf.setForeground(new Color(255,0,0));tf.setFont(new Font(“SanSerif”, fontstyle, fontsize));where fontsize is some integer value probably less than 100and fontstyle is an integer which is a combination of Font.PLAIN, Font.BOLD, and Font.ITALIC….these can be added together to get the correct combination of font featuresScreenshot 1Screenshot 2Screenshot 3Screenshot 4Screenshot 5Screenshot 6Screenshot 7Screenshot 8CLICK HERE TO GET THE SOLUTION !!!!!!!