Question: GUI Components Part 1 is the only part to this lab. Create a folder named Unit08 and place all your files for this assignment in

GUI Components Part 1 is the only part to this lab. Create a folder named Unit08 and place all your files for this assignment in that folder. You will create a program called Unit08_Prog01.java. This program will display a graphical user interface (GUI) . The window has a title of "Unit08_Prog01" and three panes stacked one on top of the other. The top most pane holds five radio buttons, one for each color of: Red, Yellow, White, Orange and Green. The White radio button is set by default. Clicking on a radio button will change the background color of the text area in the second panel to the color indicated by the radio button label. The second pane contains the text "Programming is fun". Version 3.0 Page: The third pane contains two buttons. Clicking the button marked "<=" will cause the text to move to the left, clicking on the button marked "=>" will move the text to the right. I have everything done besides the arrows that move the text left and right. Here is my code so far. public class unit08_prog01 extends JFrame { JRadioButton red = new JRadioButton("red"); JRadioButton yellow = new JRadioButton("yellow"); JRadioButton white = new JRadioButton("white"); JRadioButton gray = new JRadioButton("gray"); JRadioButton green = new JRadioButton("green"); JButton left = new JButton("<="); JButton right = new JButton("=>"); Font font = new Font("Verdana", Font.BOLD, 20); public static void main(String[] args) { JFrame frame = new unit08_prog01(); frame.setTitle("unit08_prog01"); frame.setSize(500,200); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public unit08_prog01() { JPanel RadioButtons = new JPanel(); RadioButtons.setLayout(new GridLayout(1, 5)); RadioButtons.add(red); RadioButtons.add(yellow); RadioButtons.add(white); RadioButtons.add(gray); RadioButtons.add(green); RadioButtons.setBorder(new TitledBorder("Set Background Color")); add(RadioButtons, BorderLayout.NORTH); ButtonGroup group = new ButtonGroup(); group.add(red); group.add(yellow); group.add(white); group.add(gray); group.add(green); white.setSelected(true); JTextArea content = new JTextArea("Programming is fun", 5, 5); content.setLineWrap(true); content.setWrapStyleWord(true); content.setEditable(true); content.setFont(font); JScrollPane scrollPane = new JScrollPane(content); add(scrollPane, BorderLayout.CENTER); JPanel Buttons = new JPanel(); Buttons.setLayout(new GridLayout(1, 2)); Buttons.add(left); Buttons.add(right); add(Buttons, BorderLayout.SOUTH); left.setMnemonic('L'); right.setMnemonic('R'); red.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ content.setBackground(Color.red); } }); yellow.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ content.setBackground(Color.yellow); } }); white.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ content.setBackground(Color.white); } }); gray.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ content.setBackground(Color.gray); } }); green.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ content.setBackground(Color.green); } }); left.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ content.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); } }); right.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ content.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } }); } } Any help would be appreciated!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!