• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

no suitable constructor found

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
I stand corrected. I'm on my phone and wasn't bothered to scroll up to double check it
 
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic