• Post Reply Bookmark Topic Watch Topic
  • New Topic

no suitable constructor found  RSS feed

 
mitchell bat
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

Error13, 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

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15862
81
Android IntelliJ IDE Java Scala Spring
  • 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
 
Matthew Brown
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!