Trouble with Unicode Chars
Hi all,
I am having trouble displaying Unicode chars both in an Applet and in the command prompt window. I am using awt. The characters I want to display are: \u2228, \u2283, \u2261. These characters display correctly from AppletViewer when I add them to ChoiceBoxes, they display correctly in some browsers (isn't Unicode fairly universal by now? Do most browsers support it?), but not correctly when I try to put them into a TextField, using this simple code:
public void keyTyped(KeyEvent e) {
if(e.getKeyChar() == '/') {
e.setKeyChar('\u2228');
if(e.getKeyChar() == '.') {
e.setKeyChar('\u2283');
System.out.println(e.getKeyChar());
if(e.getKeyChar() == ',') {
e.setKeyChar('\u2261');
System.out.println(e.getKeyChar());
Any help is greatly appreciated, thanks!
Er, forgot to mention, the chars display as either a
black bar, sort of a square, This happens when there is no suitable font for the codepoint, and the system doesn't know how to convert a codepoint to another codepoint for which there is a suitable font. The latter mechanism allow to use non-unicode fonts with unicode chars.
a question mark, That's possibly another issue. '?' usually appears while
converting chara�ter into bytes, specifically if an encoding doesn't have an appropriate rule for a particular character.
For example, the "Cp1251" encoding knows nothing of Greek characters, and so converts them into ?'s.
Such conversion may occur when a java string is passed
into a native window system, because such systems often are non-unicode.
and an equal signCompletely illegal behaviour, usually occurs in very old JVM's.
Note that Swing is always correct with unicode.
A relevant documentation is here:
http://java.sun.com/j2se/1.3/docs/guide/intl/addingfonts.html
and
http://java.sun.com/j2se/1.3/docs/guide/intl/fontprop.html
Similar Messages
-
Getting PDF filename with unicode chars
Hello,
I'm trying to write a plugin that gets the file path of the current active document. The code looks like this:
AVDoc avDoc = AVAppGetActiveDoc();
PDDoc pdDoc = AVDocGetPDDoc(avDoc);
ASFile file = PDDocGetFile (pdDoc);
ASPathName filePath = ASFileAcquirePathName (file);
This works fine for most documents, but for documents with unicode characters in the name each unicode character is replaced with '.' in filePath. For example, if the document is "测试中文关键词搜索!@#$%^&().pdf", then filePath becomes ".........!@#$%^&().pdf". Am I missing something required to get unicode filenames?
Thanks.You were right, the plugin was getting a char* from ASFileSysDisplayStringFromPath. I removed that and added this which seems to have fixed my problem:
ASText pathText = ASTextNew();
ASFileSysDisplayASTextFromPath(ASGetDefaultFileSys(), filePath, pathText);
wchar_t *pathString = (wchar_t*)ASTextGetUnicode(pathText);
Thank you! -
Filenames with unicode characters
Hello, I have a question regarding filenames with unicode characters on an arabic windows xp.
I have a string, which the user entered and want to create a file with this string as filename. So my question:
Which unicode characters are allowed in a filename? I know, that on a german windows " / \ * ? < > : * are not allowed from the ASCII set, but which unicode chars are allowed? Is this language dependend on windows? Maybe there exists a method, which checks a string for this allowed characters.
Thanks for your helpAFAIK the illegal characters are always the same (you listed them already) and as long as the filesystem supports it (read: you use NTFS and not FAT) you may use any other unicode character.
You might have troubles displaying those characters 'though if you don't happen to have the correct fonts installed, but that would only be a cosmetic issue. -
Problem with unicode in MIME text/html
Hi;
I have a java program that sends email by sending it to our exchange server using SMTP. The email has both a To and a Bcc in the single email sent.
The bcc addressee receives the email fine.
The to address however has a problem with chars that are > 0x7f in the html. The html uses utf-8. But the displayed characters look as though the utf-8 part was ignored.
Also weird, if I go to view, options in Outlook for the bcc email (which is good) it shows:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_0_32437168.1135634913407"
Return-Path: [email protected]
X-OriginalArrivalTime: 26 Dec 2005 22:08:33.0366 (UTC) FILETIME=[E94D1F60:01C60A68]
------=_Part_0_32437168.1135634913407
Content-Type: text/plain; charset=Cp1252
Content-Transfer-Encoding: quoted-printable
------=_Part_0_32437168.1135634913407
Content-Type: text/html; charset=Cp1252
Content-Transfer-Encoding: quoted-printable
------=_Part_0_32437168.1135634913407--
But for the to email (which has the problem), it only shows:
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_0_32437168.1135634913407"
Return-Path: [email protected]
X-OriginalArrivalTime: 26 Dec 2005 22:08:33.0366 (UTC) FILETIME=[E94D1F60:01C60A68]
Does javamail do anything weird when it gets an email with a to and a bcc and split it up wrong? I just download and installed the latest mail.jar and activation.jar.
thanks - daveOK...this didnt quite cure it for me...but having done this AND then this...
MimeBodyPart htmlText = new MimeBodyPart();
final String htmlStuff = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
+ "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">"
+ "<head>"
+ "<title>Stuff.</title>"
+ "<meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml; charset=utf-8\"/>"
+ "</head><body>"
+ "<p>Currency Symbols: \u00A3\u00A2\u20A3\u20AC$<p>"
+ "</body></html>";
DataSource htmlSource = new DataSource()
private String stuff = htmlStuff;
private Charset cset = Charset.forName("utf-8");
public String getContentType() { return "text/html"; };
public java.io.InputStream getInputStream() throws IOException
return new ByteArrayInputStream(cset.encode(stuff).array());
public String getName()
return null;
public OutputStream getOutputStream() throws IOException
throw new IOException();
htmlText.setDataHandler(new DataHandler(htmlSource));
htmlText.addHeader("Content-Transfer-Encoding","base64");
This works for me as shown by the Unicode chars in the html.
If you intend to take this to production create a decent external DataHandler class and avoid the use of the anonymous class - which then avoids the need for the final String and the string can come from anywhere then.
Hope this helps,
Barry -
Corrputed loaded text from an Export Datasource with Unicode
Hi Experts
I am new with BW and this forum helped me a lot in the past year.
I am loading texts to an InfoObject using a Master Data (texts) Export DataSource from another InfoObject. The system is NetWeaver 2004s (BW 3.5) with Unicode.
The InfoObject's Text MD is Language Dependent but users enter the system only with EN language.
For some reason the loaded texts are corrupted.
For example: The original InfoObject has Hebrew texts (that were loaded perfectly from the source system which is also Unicode), but the text in the PSA table and in the text table of the target InfoObject will be: ###########
Can anyone help?Hi Niraj
Thanks for your answers
Let me explain:
Currently, we load texts with Hebrew chars from the SAP ECC6 system and everything is good (we see Hebrew chars in SAPGUI/BEx/WAD etc.)
The problem occurs when we load these texts from one InfoObject to another, via Export DataSource.
To do that, We generated an Export DataSource for the original InfoObject and assigned it to the target InfoSource of the other InfoObject. After running an InfoPackage for this DataSource, the texts that were loaded to the PSA (and hence, to the target InfoObject texts table) were corrupted - which means that they appeared: ##########
Thanks,
Yaniv -
Display Unicode Chars in text box
This seems like it should be simple enough, but apparently, I am dense...
I want to display a Unicode char in a text box based on its hex code input. For instance, given x2190, I want to display a Left Arrow in a text box (x2190 is the code for left arrow). I tried Flatten To String function then wiring the string to a text box with Force Unicode set, but that doesnt work.
Or is there a simpler way to get non-ascii chars like arrows and such to display? Next stop is little bmps in a picture ring...ack
TIA
Bill Fdid you get a chance to see the document in the below link
http://decibel.ni.com/content/docs/DOC-10153
Anil Punnam
CLD
LV 2012, TestStand 4.2.......... -
OC4J: Troubles with characters in Reports 9i and JSP
We are having troubles with especial characters in OC4J. Those problems appear in JSP's and Reports.
Some information about it:
- the especial characters in spanish are replaced by strange characters (2 chars for every especial char).
- this happens with strings from ApplicationResources.properties (we use Struts framework) and NOT with those chars read from database via JDBC.
- the problem doesn't happen in JDeveloper. It happens when we deploy the application to iAS 9i R2. With reports, it happens both from RWBuilder and local OC4J + RWServlet
- When we used iAS R1 core version this didn't happen. When we changed to iAS R2 full installation (to be able to use Reports Server) it began to happen.
Any help about it ?
ThanksHi Pozo,
Have you got the solution for the problem specified. Even I'm facing the same problem with Arabic characters.
Pl. let me know if you've got the solution.
Thanks,
Vinod. -
How to include unicode chars in text boxes?
Hi,
We need the unicode chars (for example: Chinese, Korean, etc...) to appear in the generated .pdf and .pcl files from the Adobe Output designer's IFD file.
These chars are static and will not change, so we shall not be fetching them from FNF file (.dat).
While trying to copy-paste directly into text box field, we are getting an error prompting for converting them to some other character set.
We couldn't paste them exactly with the text how they should appear in the text boxes.
Please tell us if there is a way to achieve this.
Thanks and regards,
Gurunath
[email protected]Double check that all of the selected presentation targets and the font being used for the particular text box supports the characters you are trying to paste into it. For example, the PDF target only has 11 fonts available unless you use the other tabs to "create new soft font cartidges". If you have the appropriate fonts installed on you PC you should be able to use this capability to make the font available for each of your presentation targets. (At least that is my impression - I've never needed to try it.)
-
SQL Server 2012 Express LocalDB parm for keeping unicode char
in developer's windows 8.1 pc, the SQL Server 2012 Express LocalDB does not seem to keep Unicode like \U2221. it get translated to the plain - instead of keeping as
−.
what parameter od I need to setup to make sure it keep such character as isHi fs - ab,
You know that this forum is to discuss the VS IDE, to make this issue clearly, could you share us a screen shot for this issue? Where did you change your localDB with Unicode?
I did some research about it.
LocalDB supports two kinds of instances: Automatic instances and named instances.
•Automatic instances of LocalDB are public. They are created and managed automatically for the user and can be used by any application. One automatic instance of LocalDB exists for every version of LocalDB installed
on the user’s computer. Automatic instances of LocalDB provide seamless instance management. There is no need to create the instance; it just works. This allows for easy application installation and migration to a different computer. If the target machine
has the specified version of LocalDB installed, the automatic instance of LocalDB for that version is available on the target machine as well. Automatic instances of LocalDB have a special pattern for the instance name that belongs to a reserved namespace.
This prevents name conflicts with named instances of LocalDB. The name for the automatic instance is a single v character followed by the LocalDB release version number in the format xx.x. For example, v11.0 represents SQL Server 2012.
•Named instances of LocalDB are private. They are owned by a single application that is responsible for creating and managing the instance. Named instances provide isolation from other instances and can improve performance
by reducing resource contention with other database users. Named instances must be created explicitly by the user through the LocalDB management API or implicitly via the app.config file for a managed application (although managed application may also use
the API, if desired). Each named instance of LocalDB has an associated LocalDB version that points to the respective set of LocalDB binaries. The instance name of a LocalDB is sysname data type and can have up to 128 characters. (This differs from regular
named instances of SQL Server, which limits names to regular NetBIOS names of 16 ASCII chars.) The name of an instance of LocalDB can contain any Unicode characters that are legal within a filename.
A named instance that uses an automatic instance name becomes an automatic instance.
Reference:
http://technet.microsoft.com/en-us/library/hh510202(v=sql.110).aspx
It seems that it is related to the SQL Server, am I right? If so, maybe the SQL Server forum would be better for this issue.
If I have misunderstood this issue, please feel free to let me know.
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Running SQL Developer on Windows XP.
Tool looks good, just one thing, we have Japanese/Korean text (not much at the moment) in our Oracle 9i/Oracle 10g (AL32UTF8)
When I run the query in the sql editor, the chars appear as small rectangles.
Exporting this as XML and loading into an XML viewer (like IE), all the chars appear fine.
When I copy the text from the data results grid and paste into the sql editor window (after tweaking the prefs), the chars appear fine.
so I am wondering ... how can I get the text in the data grid to show the Japanese text ?
Is there a setting I have missed ? or would this be an enhancement ?
We will be storing more and more international chars and having a tool capable of viewing it would be something we have not found in other tools we have trialed.In the Prefs -> Environment, ... set encoding to UTF-8
In the Prefs -> Code Editor -> Fonts ... set to "Arial Unicode MS"
Method 1 :
Open a SQL Worksheet
Tap in the sql, when executing the sql with the <F9> key, japanese text is displayed as small rectangles.
When I cut-and-paste the text into the window where the SQL Statement is typed in, I can see the Japanese chars.
Method 2 :
On the connections panel, goto "Other Users", navigate to the table that contains the unicode chars.
Double click on tablename in the left panel, this brings up a "toad like" display, the second tab is the "Data" tab,
and the unicode data is displayed as miniature rectangles.
I am unable to find a setting (in the Prefs) to set the font for the grid the data is displayed in -
Forms 6i Against 9i UTF8 database with NLS_LENGTH_SEMANTICS = CHAR
Hi all,
I have a 9.2.0.4 database which was created with a character set of UTF8.
I want to start storing multibyte characters in this database so I changed the init.ora parameter NLS_LENGTH_SEMANTICS to CHAR and restarted.
I then installed my application into the database and all the definitions have correctly been created using CHAR length semantics.
The client to this application is Forms 6i but I am having serious problems compiling it against the application schema.
When I open a pll library and try to compile I get Error 201 for every %type variable declaration and also for server based packages.
I am definitely connected and to the correct schema where the objects all exist.
I have another application schema - identical except that it was created before I made the change to NLS_LENGTH_SEMANTICS so it uses BYTE. When I compile the same library connected to this schema there are no problems.
Also, if I try to connect to the CHAR schema using Forms (i.e. 8.0.6) SQL*Plus it crashes with a Windows Application Error. If I connect with a 9.2.0.1 SQL*Plus its fine.
My question is should it be possible to compile a 6i Form against a UTF8 database with CHAR NLS length semantics at all? Have I done something wrong or am I barking up the wrong tree? Has anyone else tried this?
Many thanks in advance,
Kevin.Hi,
Thanks for the responses but I don't think you're quite right. Forms 6i should indeed work with Unicode as a database character set as long as it is UTF8 rather than AL32UTF8. This can be seen in various Metalink documents and also in the Release 6i Guidelines for Building Applications here (section 4.1.5):
http://download-west.oracle.com/otn_hosted_doc/forms/forms/A73073_01.pdf
The problems started when I changed NLS_LENGTH_SEMANTICS to CHAR. Its understandable if Forms 6i does not recognise this setting as it pre-dates it but I wanted to confirm this.
We want to migrate our existing application to work with multibyte characters. Unfortunately there are table columns, PL/SQL variables etc. that are too small when defined as a length in bytes.
I am looking for the least impact method to rectify this. On the server I can use NLS_LENGTH_SEMANTICS but if I can't get Forms to work with it then I may need to rethink.
I realise that using Forms 9i or 10g would support the parameter but it is not possible to upgrade at the moment.
Has anyone any other suggestions or methods for migrating an application to using multibyte characters?
Thanks again,
Kevin. -
Regular Expressions with Unicode Strings - length restriction?
Hi,
I can't quite figure this one out. I am checking a String for the presence of a URL.. more specifically, a jpg or gif URL.
Anyway, the following reg exp will work fine for me. However, when testing with unicode data (chinese text) the expression will only work up to a certain string length. Here's an example:
boolean isURL = text.matches(".*http\\S*(jpg|gif).*");
My thought is that since Unicode data takes up more space, there a limitation to dealing with Strings. Does anyone know what that number is? Or, is there another reason the reg exp fails??
thanks,
joe
Example::
This works for any length String I throw at it using standard ASCII text.. But a unicode string of a certain length won't recognize the URL (I doubt I can simply paste my example here and have it turn out correctly..)
DOESN'T WORK: (length is reported via text.length() as 344
"FWD: test_tancy: FWD: tancy: FWD: supporter:
浅淡色彩造清凉
要让居所看起来清爽凉快,可采用以白色为主调的布置。白色不但能增加空间感,还能营造明快宁静的气氛,让人情绪稳定。另外,有意识地增添一点冷色,也能令人在视觉上觉得畅快。不过,一间房内若全部使用冷色,或全部采用暖色,会使人感到不安。最好是确定主色后,小面积使用些呈鲜明对比的色彩。入夏购置一些色调清凉的饰物摆设,是最省钱有效的一招,如为台灯换个白色灯罩、在洗手间放一套冰蓝色的沐浴用具等。(UU为您提供生活咨讯并祝您生活愉快!如不希望打扰请回复?NO?)http://www.blah.com/servlet/mailbox?item=fc-10Tq9aljw0w9.jpg"
WORKS: (length is reported via text.length() as 296
"FWD: Joe: 要让居所看起来清爽凉快,可采用以白色为主调的布置。白色不但能增加空间感,还能营造明快宁静的气氛,让人情绪稳定。另外,有意识地增添一点冷色,也能令人在视觉上觉得畅快。不过,一间房内若全部使用冷色,或全部采用暖色,会使人感到不安。最好是确定主色后,小面积使用些呈鲜明对比的色彩。入夏购置一些色调清凉的饰物摆设,是最省钱有效的一招,如为台灯换个白色灯罩、在洗手间放一套冰蓝色的沐浴用具等。(UU为您提供生活咨讯并祝您生活愉快!如不希望打扰请回复?NO?)http://www.blah.com/servlet/mailbox?item=fc-10Tq9aljw0w9.jpg"Perhaps you should check the version of Java you are using. I am using 1.4.2_04
public class A {
public static void main(String[] args) throws UnsupportedEncodingException {
String text = "FWD: test_tancy: FWD: tancy: FWD: supporter: " +
new String(new char[]{(char) 35201, (char) 35753, (char) 23621, (char) 25152, (char) 30475, (char) 36215,
(char) 26469, (char) 28165, (char) 29245, (char) 20937, (char) 24555, (char) 65292,
(char) 21487, (char) 37319, (char) 29992, (char) 20197, (char) 30333, (char) 33394,
(char) 20026, (char) 20027, (char) 35843, (char) 30340, (char) 24067, (char) 32622,
(char) 12290, (char) 30333, (char) 33394, (char) 19981, (char) 20294, (char) 33021,
(char) 22686, (char) 21152, (char) 31354, (char) 38388, (char) 24863, (char) 65292,
(char) 36824, (char) 33021, (char) 33829, (char) 36896, (char) 26126, (char) 24555,
(char) 23425, (char) 38745, (char) 30340, (char) 27668, (char) 27675, (char) 65292,
(char) 35753, (char) 20154, (char) 24773, (char) 32490, (char) 31283, (char) 23450,
(char) 12290, (char) 21478, (char) 22806, (char) 65292, (char) 26377, (char) 24847,
(char) 35782, (char) 22320, (char) 22686, (char) 28155, (char) 19968, (char) 28857,
(char) 20919, (char) 33394, (char) 65292, (char) 20063, (char) 33021, (char) 20196,
(char) 20154, (char) 22312, (char) 35270, (char) 35273, (char) 19978, (char) 35273,
(char) 24471, (char) 30021, (char) 24555, (char) 12290, (char) 19981, (char) 36807,
(char) 65292, (char) 19968, (char) 38388, (char) 25151, (char) 20869, (char) 33509,
(char) 20840, (char) 37096, (char) 20351, (char) 29992, (char) 20919, (char) 33394,
(char) 65292, (char) 25110, (char) 20840, (char) 37096, (char) 37319, (char) 29992,
(char) 26262, (char) 33394, (char) 65292, (char) 20250, (char) 20351, (char) 20154,
(char) 24863, (char) 21040, (char) 19981, (char) 23433, (char) 12290, (char) 26368,
(char) 22909, (char) 26159, (char) 30830, (char) 23450, (char) 20027, (char) 33394,
(char) 21518, (char) 65292, (char) 23567, (char) 38754, (char) 31215, (char) 20351,
(char) 29992, (char) 20123, (char) 21576, (char) 40092, (char) 26126, (char) 23545,
(char) 27604, (char) 30340, (char) 33394, (char) 24425, (char) 12290, (char) 20837,
(char) 22799, (char) 36141, (char) 32622, (char) 19968, (char) 20123, (char) 33394,
(char) 35843, (char) 28165, (char) 20937, (char) 30340, (char) 39280, (char) 29289,
(char) 25670, (char) 35774, (char) 65292, (char) 26159, (char) 26368, (char) 30465,
(char) 38065, (char) 26377, (char) 25928, (char) 30340, (char) 19968, (char) 25307,
(char) 65292, (char) 22914, (char) 20026, (char) 21488, (char) 28783, (char) 25442,
(char) 20010, (char) 30333, (char) 33394, (char) 28783, (char) 32617, (char) 12289,
(char) 22312, (char) 27927, (char) 25163, (char) 38388, (char) 25918, (char) 19968,
(char) 22871, (char) 20912, (char) 34013, (char) 33394, (char) 30340, (char) 27792,
(char) 28020, (char) 29992, (char) 20855, (char) 31561, (char) 12290, (char) 20026,
(char) 24744, (char) 25552, (char) 20379, (char) 29983, (char) 27963, (char) 21672,
(char) 35759, (char) 24182, (char) 31069, (char) 24744, (char) 29983, (char) 27963,
(char) 24841, (char) 24555, (char) 65281, (char) 22914, (char) 19981, (char) 24076,
(char) 26395, (char) 25171, (char) 25200, (char) 35831, (char) 22238, (char) 22797}) +
"?NO?)http://www.blah.com/servlet/mailbox?item=fc-10Tq9aljw0w9.jpg";
boolean isURL = text.matches(".*http\\S*(jpg|gif).*");
System.out.println("isURL="+isURL+", length="+text.length());
}Prints
isURL=true, length=344 -
Does photoshop cs5 sdk support file names with unicode characters?
Hi,
For the export module, does the windows sdk have support for filenames with unicode characters?
The ExportRecord struct in PIExport.h has an attribute filename declared as char array.
So I have a doubt whether filenames with unicode characters will be supported for export module.
Thanks in advance,
Senthil.SPPlatformFileSpecificationW is not available in ReadImageDocumentDesc.
It has SPPlatformFileSpecification_t which is coming as null for export module.
I am using phostoshop cs5 sdk for windows.
Thanks,
Senthil. -
Having trouble with throws...
Hey there.
I'm fairly new to java so bear with me here.
I'm having trouble with a program that, in short, reads from a file.
Let me shorten a show the code to you...
//main opens up and in a bit we get to...
if (loginVerify())
//and the if continues.
fileIn.close();
//main ends
public boolean loginVerify() throws IOException
openIn(); //Checks for validity - It's a long story why I //didn't just put the code in loginVerify(). I //don't think it should matter.
String str = verifyLog(); //Does the actual reading
str = str.substring(1);
if (str == placeHold) //Don't worry about not making placeHold,
//I made it global for testing reasons.
return true;
else
return false;
private String verifyLog() throws IOException
String str;
while (true)
str = fileIn.readLine();
if (str == null)
break;
else if (str.charAt(0) == 1)
return str;
//ADDITION OF OTHER NUMBERS
else
return str = "invalid";
private void readIn() throws IOException
BufferedReader console =
new BufferedReader(new InputStreamReader(System.in));
openInputFile(fileName);
if (fileIn == null)
System.out.println("*** Can't open " + fileName + " ***");
return;
private static void openInputFile(String fileName)
try
fileIn = new BufferedReader(new FileReader(fileName));
catch (FileNotFoundException e)
So it's fairly simple. It checks for validity and then reads lines until it finds one with the first char as '1' when it finds it, it reads the rest of the line off.
The error I'm getting is as follows: Exception java.io.IOException must be caught, or it must be declared in the throws clause of this method.
I've added throws IOException to them in attempts to fix the error but to no avail. I've tryed putting the catch in different spots... again, doesn't work.
I'm using codewarrior IDE version 5. I'm fairly sure it's the newest. I installed Java SDK 1.3 with codewarrior originally but I installed 1.4.1 recently.
If you need to see anything else about it, please tell me. I'd be more than happy to post a little more if it'll help.
ThanksOk. I worked through a bunch of throws and now I've found one I can't seem to conquer.
private String verifyLog()
String str = "";
while (true)
try {
str = fileIn.readLine();
catch (FileNotFoundException g) {
if (str == null)
break;
else if (str.charAt(0) == 1)
return str;
//ADDITION OF OTHER PEOPLE
else
return str = "invalid";
return str = "invalid";
}This time the error is at the reference to readLine() and it tells me the same error as before. I have a catch set up there, don't I?
readLine() is something I didn't create so I don't know how I'd tell it to throw an exception if I had to...
Thanks -
I have had trouble with scrollbars using netbeans 5.5.1
I have had trouble getting a vertical and horizontal scrollbar working in my GUI. I am new to programming but I have books but I find them difficult to follow because they follow the old netbeans GUI models that requires all of the code to be written for example the scrollbar has to be created and then the parameters have to be set. However with the 5.5.1 the scrollbar has already been created and the parameters of the maximum the minimum and the event have already been set.
Therefore when you follow the books they explain the whole process rather than the last part which is all that is needed. I have selected the scrollbar and then pressed the right mouse button to get the menu up where I selected Events and then Adjustments, which then displayed the following script,
" private void jScrollBar1AdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {
// TODO add your handling code here:"
I know that I have to delete the //TODO add your handling code here and then insert the event handling code. I have tried to put in a lot of different event handler codes to try to get it to work but I have had no luck. Can anybody help. I have asked a few people but they have had trouble with it too.Please can somebody provide me with a scirpt example.
I would really appreciate it.This was not made in Netbeans but it shows you how to use scrollpanes with a viewportview and listeners.
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.WindowConstants;
public class SwingExample {
public static void main(String[] args) {
JFrame frame = new JFrame("Test");
//Create scrollpane
JScrollPane scrollpane = new JScrollPane();
//Create textpane to embed in Scrollpane
JTextPane textPane = new JTextPane();
//Add listener to textpane to listen for a KeyEvent
textPane.addKeyListener(new KeyListener() {
//unimplemented methods, not reuqired for example
public void keyPressed(KeyEvent arg0) {}
public void keyReleased(KeyEvent arg0) {}
//Implemented method - prints current key typed.
public void keyTyped(KeyEvent arg0) {
char myChar = arg0.getKeyChar();
System.out.println("You Typed: "+myChar);
//Add textpane to scrollpane
scrollpane.setViewportView(textPane);
//add scrollpane to frame
frame.add(scrollpane);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setSize(new Dimension(400,400));
}
Maybe you are looking for
-
I have a game center account that has 2 accounts in the same apple id. the problem is i can only access one account. when i try to type in for the second account it says already taken. How do i change to the 2nd account with the same apple id? Please
-
Spell check not working on my 2 Win 7 64 bit computers; option set
I have Firefox 4.01 on my two Windows 7 64bit computers. One has the professional version. I have Spell Check selected in the options menu Advanced, General tab. Pierce
-
How do I change the default e-mail address in Thunderbird.
I've set up my new e-mail and want to send from it by default rather than the old one.
-
CS4-menu items greyed out ????
Why are my menu items greyed out until I hit a tool icon? Example .....open Photoshop, click "FILE" = everything greyed out except "recent" whose submenu (list of recent files) greyed out. If I hit any tool icon, menu items appear. ALSO .....eyes on
-
Why is it that I cannot update my apps, keep saying invalid passwords but yet I can download?