![]() |
[java] identifier expected
I am trying to change the default behavior of a JTextArea. I want to change the font, the font flags, and the font size of the text entered into the area. Here is my code in its amazing entirety:
Code:
JTextArea canvas = new JTextArea(30,70); I am thinking that perhaps I have an error elsewhere (and above) in my code and that perhaps it is cascading down to this function call.... The weird thing is if I comment out the 2nd line and replace it with: Locale l = canvas.getLocale(); it works fine. In other words, it handles other Component methods perfectly fine, which tells me it doesn't like my call to setFont. I checked the method's definition out in the java docs and according to Sun, the signature for setFont() is this: public void setFont(Font f) So I don't see what I am missing here... |
It certainly seems about right to me....don't see anything wrong with it...:confused:
maybe you could post some more of the code preceeding it? |
Maybe too obvious, but did you import java.awt.Font?
Change it to Code:
java.awt.Font f = new java.awt.Font("Arial", java.awt.Font.BOLD | java.awt.Font.ITALIC, 20); |
Yeah I imported Font from the AWT. Actually a poster on another website suggested that its a cascading error from previous code. But that makes no sense because replacing it with a call to any other Component-inherited method works perfectly fine.
It either doesn't like setFont() or the argument I am passing it....which makes no sense again because I am using the correct signature....oy vey. |
Use a canvas.setFont(null) .. what's it throw then? Same thing?
|
All times are GMT -8. The time now is 03:59 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project