2023 COSC1047 Game displaying three cards Display a frame that contains three labels Each label displays a | Assignment Collections
Computer Science 2023 Ex 12 Cards
2023 COSC1047 Game displaying three cards Display a frame that contains three labels Each label displays a | Assignment Collections
COSC1047 (Game: displaying three cards) Display a frame that contains three labels. Each label displays a card, as shown in Figure 12.16(b). The card image files are named
1.png, 2.png, 54.png and stored in the image/card directory. All three cards are distinct and selected randomly.
12.1 (Use the FlowLayout manager) Write a program that meets the following
requirements (see Figure 12.26):
■ Create a frame and set its layout to FlowLayout.
■ Create two panels and add them to the frame.
■ Each panel contains three buttons. The panel uses FlowLayout.
FIGURE 12.26 Exercise 12.1 places the first three buttons in one panel and the other three
buttons in another panel.
(a) (b) (c)
FIGURE 12.27 (a) Exercise 12.5 displays four labels. (b) Exercise 12.6 displays four icons.
(c) Exercise 12.7 displays a tic-tac-toe board with image icons in labels.
download image files
12.2 (Use the BorderLayout manager) Rewrite the preceding program to create
the same user interface, but instead of using FlowLayout for the frame, use
BorderLayout. Place one panel in the south of the frame and the other in the
center.
12.3 (Use the GridLayout manager) Rewrite Programming Exercise 12.1 to add six
buttons into a frame. Use a GridLayout of two rows and three columns for the
frame.
12.4 (Use JPanel to group buttons) Rewrite Programming Exercise 12.1 to create the
same user interface. Instead of creating buttons and panels separately, define a
class that extends the JPanel class. Place three buttons in your panel class, and
create two panels from the user-defined panel class.
12.5 (Display labels) Write a program that displays four lines of text in four labels, as
shown in Figure 12.27a. Add a line border around each label.
We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.