• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

no suitable constructor found

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys, I keep getting the following error message on this piece of code but I can't seem to pinpoint where i'm going wrong

Error:(13, 32) java: no suitable constructor found for JTextArea(int)
constructor javax.swing.JTextArea.JTextArea(java.lang.String) is not applicable
(argument mismatch; int cannot be converted to java.lang.String)
constructor javax.swing.JTextArea.JTextArea(javax.swing.text.Document) is not applicable
(argument mismatch; int cannot be converted to javax.swing.text.Document)



Can someone help me out because I have no idea where i;m going wrong

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In line 13 you are creating a new JTextArea by passing it an int:

But class JTextArea doesn't have a constructor that takes an int. See the API documentation of this class.

What was your intention with this line?
 
mitchell bat
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My intention is to create a text field using a grid bag layout so someone can enter there name in the text area
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you meant to have JTextField rather than JTextArea?
 
mitchell bat
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I stand corrected. I'm on my phone and wasn't bothered to scroll up to double check it
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic