Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9319381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:22:18+00:00 2026-06-19T03:22:18+00:00

I am making a program to wrap text, by words or by characters, depending

  • 0

I am making a program to wrap text, by words or by characters, depending on user input. I have everything working, except for my ActionEvent that’s giving me a “Cannot Find Symbol” error. I’m sure it’s something small that I’ve missed, but I can’t seem to find it:

import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;

public class JTextWrap extends JFrame
{
   JScrollPane scroll = new JScrollPane();
   JPanel panel = new JPanel();
   JTextArea jta = new JTextArea();
   TitledBorder tb;
   JRadioButton jrb = new JRadioButton();
   JRadioButton jrb2 = new JRadioButton();
   ButtonGroup btg = new ButtonGroup();
   JCheckBox jdb = new JCheckBox();

   public JTextWrap()
   {
      tb = new TitledBorder("");
      setSize(new Dimension(400, 300));
      jta.setText("jTextArea1");
      panel.setBorder(tb);
      tb.setTitle("Wrap Options");
      jrb.setText("Wrap Words");
      jrb.addActionListener(
            new ActionListener()
            {
               public void actionPerformed(ActionEvent e) {
                  JTextWrap.jrb_actionPerformed(e);
               }
            });
      jrb2.setText("Wrap Characters");
      jrb2.addActionListener(
            new ActionListener()
            {
               public void actionPerformed(ActionEvent e) {
                  JTextWrap.jrb2_actionPerformed(e);
               }
            });
      jdb.setText("Wrap");
      jdb.addActionListener(
            new ActionListener()
            {
               public void actionPerformed(ActionEvent e) {
                  JTextWrap.jdb_actionPerformed(e);
               }
            });
      add(scroll, "Center");
      scroll.getViewport().add(jta, null);
      add(panel, "South");
      panel.add(jdb, null);
      panel.add(jrb, null);
      panel.add(jrb2, null);

      btg.add(jrb);
      btg.add(jrb2);
   }

   public static void main(String[] args)
   {
      JTextWrap frame = new JTextWrap();
      frame.setTitle("JTextWrap");
      frame.setDefaultCloseOperation(3);
      frame.setSize(400, 300);
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);
   }

   void jdb_actionPerformed(ActionEvent e) {
      jta.setLineWrap(jdb.isSelected());

      if (jdb.isSelected()) {
         jrb.setEnabled(true);
         jrb2.setEnabled(true);
      }
      else {
         jrb.setEnabled(false);
         jrb2.setEnabled(false);
      }
   }

   void jrb_actionPerformed(ActionEvent e) {
      jta.setWrapStyleWord(jrb.isSelected());
      jta.revalidate();
   }

   void jrb2_actionPerformed(ActionEvent e) {
      jta.setWrapStyleWord(!jrb2.isSelected());
      jta.revalidate();
   }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T03:22:19+00:00Added an answer on June 19, 2026 at 3:22 am

    ActionEvent class is in java.awt.event package and you have not imported this package.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a program that concatenates two strings given by user. Everything is
Im making a program for class that manages a Hotel. I have a function
I'm making a program that takes names from the user seperated by commas. The
I'm making a program that makes a fractal, and the user is suppose to
Im making a program that is designed to be a backup. i have SwingWorker
I am making a program that will have the ability to run the java
While making my program i have come across this requirement that i have to
I'm making a program that fits the wizard concept ideally; the user is walked
I am making a program that automates the seperation of a csv file. We
I am currently making a program which is supposed to prompt the user to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.