JTextArea and typing one char at a time!
Hi everyone!
I'm developing an small app. In certain cases, the user may want to edit a little piece of text. For this, I show a new Frame with a JTextArea with the selected text, so the user can edit it...
But I want to control this edition: the user only can type one char at a time, disable selecting text and waiting a short time (250ms) between char and char...
Some ideas? Some suggestion?
Should I use keylistener and wait for the KeyPressed event and wait inside 250 ms?
The reason for the waiting: when the user type a new char (or delete an existing one), I need to do some calculations. And it must be char by char, if the user select text and replace it, or if the user type fast... my program crash.
Thanks in advance!
Use a DocumentFilter and add the character yourself one at a time.
Or better perform the calculation there.
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#filter
Also perform the calculation in the Event Dispatch Thread so it will wait until the calculation is finished before accepting new input.
Similar Messages
-
Mail merge and print one document at a time?
Hi all. I'm an Apple revert. I'm currently using the i7 iMac. Previous Apple computer was a //e.
I print an 8 or 12 page newsletter for my work. I want my printer/copier to fold and staple each document individually. Pages seems to send all documents to the printer in one huge file. How do I mail merge and print one document at a time?
[In Windows Publisher, there's a registry hack to make Pub print one at a time. Anything similar on a Mac?]
MikeHello
As you saw wrongly my first name I'm not too surprised that you missed the beast
In fact it's not surprising that you missed it.
I prepared the archive but forgot to upload it
Download :
For_iWork:iWork '09:découpe_PDFs.zip
Yvan KOENIG (VALLAURIS, France) samedi 27 août 2011 11:29:37
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
Why has my hp deskjet 2050 printer and scanner suddenly slowed down and printing one line at a time
why has my hp deskjet 2050 printer and scanner suddenly slowed down and printing one line at a time
This is usually indicative of a defective print cartridge. Suspect the black is low in ink or defective. Please check all cartridges.
Say thanks by clicking the Kudos Thumbs Up to the right in the post.
If my post resolved your problem, please mark it as an Accepted Solution ...
I worked for HP but now I'm retired! -
Can I purchase a TV season and download one episode at a time?
So this is a noob question as I've never bought TV shows through iTunes. I want to buy all the episodes of a season in one payment, but I plan to download in 1080p so obviously it would be nice not to have to download all the episodes at once. Sure, I could buy the episodes one at a time and it would only cost me slightly more, but there are also special features that you can't get unless you buy the whole season. Can I buy the season and then download each episode as needed? (I'm buying through my desktop Mac, don't have an iPad or Apple TV.)
I have a similar problem with Bones Season 8. I've purchased the season, and the latest episode is available in the store, but it doesn't give me the option to download it without purchasing it again.
*** edit ***
nevermind, it has been fixed. -
How to paste style on whole table and not one cell at a time?
Hi,
I am copying a style and then trying to paste it on a whole table, but it will only allow me to paste the style on each cell separately, and it takes a long time.
Is there a way to paste a style on the whole table?
Thanks,
ShaniHi Peter,
I am creating shipping labels.
My table is divided like the paper labels in my printer.
I am copying each address directly from my browser (each address on one cell). After I copy all the addresses, I adjust one them to: avenir font 9.5 pt, indents 0.5 first etc, and then I paste this style on each cell separately.
Is there a way to paste the style all together in one time? (I am making shipping labels every day so it is not a one time thing).
Thanks!
Shani -
When I hole o e ketter down it will frezze at that one letter. I can't hold a character down and have it repeat.
The same with the delete button. I have to manually delete each letter, one at a time. I can't have it in "speed mode" where you hole it don and it just keeps going.Have you checked the settings for repeat rate and delay in System Preferences > Keyboard > keyboard tab?
-
I have a new iMac and iPhone 4.0. All software is up to date and I have installed the free beta version of Mountain Lion which let me use iChat on my computer. Safari intermittently stops working. Mail won't access my mailboxes if Safari is running. Now iTunes won't find my iPhone when it's locked and in a dock charging. If I restart I can do 1 thing at a time, but I can't have Safari running and use Mail. I've emptied my cache, checked my passwords. It's none of that. By process of elimination, there is some kind of conflict between using multiple applications on the Internet at the same time. Sometimes after I've gone to several Internet sites Safari will stop working properly even though all other applications have been "quit".
Oops. You installed the beta Mountain Lion on your main hard disk? Usually most people install it on a secondary or external hard drive. Your situation should actually be posted on the Developer web site for Moutnain Lion and not here. All I can suggest here is to run repair permissions and restart. Sorry.
-
How would I do this?
To partition the WD My Book, you could temporarily connect it to your MacBook Pro via USB. Then use the Disk Utility to partition it into two separate partitions of whatever size you choose for each.
Once partitioned and formatted (I would recommend HFS+), you can then disconnect the drive from the MacBook Pro and attach it to the new AirPort Extreme. The Extreme should now "see" the drive as two separate drives. You would then use the AirPort Utility to share out both drives.
For Time Machine, you would just need to select the appropriate shared drive. -
Printing upload hangs at 12% then 45%, then aborts printing with error message "Stopped - Unable to print data. Broken pipe". Can this be fixed?
This question was solved.
View Solution.Hi JGarner98,
A broken pipe error is a programming construct that is designed to 'pipe' data from point to point. From the description you have provided, it sounds like the operating system is telling yout that is has lost the ability to write date to the printer. This is generally caused by some sort of corruption in the CUPS printing system.
CUPS consists of a print spooler and scheduler, a filter system that converts the print data to a format that the printer will understand, and a backend system that sends this data to the print device. CUPS uses the Internet Printing Protocol (IPP) as the basis for managing print jobs and queues. - Source
To fix this, I suspect the best approach is to reset the printing system, repair disk permissions, re-add the printer using the right driver, and try to printing again.
Reset Printing System
Click the Apple icon ( ), and then click System Preferences.
In the Hardware section, click Print & Fax/Scan. The Print & Fax/Scan dialog box opens.
Right-click (or Ctrl +click) in the left panel, and then click Reset printing system…
Click OKto confirm the reset.
Type the correct Name and Password.
Click OK to reset the printing system. The Print & Fax dialog box shows no printer selected
Note: This will remove all printers in the print and Fax/Scan, any printer removed can be re-added later by clicking the plus (+) symbol.
Repair Disk Permissions
On the Dock, click Applications, and then click Utilities.
Double-clickDisk Utility.
Highlight your hard drive/partition on the left (by default this is "Macintosh HD").
Click the Repair Disk Permissions button at the bottom of the window.
Once the repair is complete, restart the computer and add the printer back.
When you add the printer, please ensure you are using the HP driver, not the AirPrint driver.
Select Add other Printer or Scanner
Select the printer you are adding and next to 'Use' you can the printer driver
I look forward to hearing from you. Please let me know if this resolves the issue. Thanks.
Please click the Thumbs up icon below to thank me for responding.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
Sunshyn2005 - I work on behalf of HP -
Drag and drop is working for only one photo at a time. Anyone else having this problem?
I am trying to store some photos on an external hard drive. I can drag and drop one photo at a time, but not multiple photos. It appears to be working, that is,I see the plus sign, but they do not 'drop'.
It sounds as if your Time Capsule is in "Bridge Mode", which would only allow one device to connect to the Internet at a time.
To check......
Open Macintosh HD > Applications > Utilities > AirPort Utility
Click Manual Setup
Click the Internet icon
Check the setting for Connection Sharing
If it is "Off (Bridge Mode)", change it to "Share a public IP address"
Click Update to save your changes -
Reading a string one character at a time
Hi,
I'm hoping you use SmallBasic for year 10 exam students at my school. But, I have found a problem I cannot solve.
I need to be able to read one character at a time from a string (txt file) and convert each char to its ACSII code.
How do to I read one char at a time from a string to enable processing?
Thanks for your help.
BazHere is an over the top solution that will display the Hex value of the character codes of every character in the file.
TextWindow.Write("Enter full file name: ")
filnam = TextWindow.Read()
contents = File.ReadContents(filnam) 'read the entire file
TextWindow.Clear()
TextWindow.WriteLine("File Name: " + filnam)
TextWindow.WriteLine("Offset: 0")
col = 0
row = 5
TextWindow.CursorLeft = col
TextWindow.CursorTop = row
For i= 1 To Text.GetLength(contents)
ch = Text.GetSubText(contents, i,1)
chVal = Text.GetCharacterCode(ch)
ConvertToHex()
TextWindow.CursorLeft = col
If chVal < 32 Then
TextWindow.Write(".")
Else
TextWindow.Write(ch)
EndIf
TextWindow.CursorLeft = 20 + 2 + (col * 3)
TextWindow.Write(Text.GetSubText(hexstr,1,2))
col = col + 1
If col = 8 Then
col = col + 1
EndIf
If col > 16 Then
col = 0
row = row + 1
If row > 20 then
TextWindow.CursorTop = 23
TextWindow.CursorLeft = 25
TextWindow.Write("< < < Press ENTER to Continue > > >")
TextWindow.Read()
TextWindow.Clear()
TextWindow.WriteLine("File Name: " + filnam)
TextWindow.WriteLine("Offset: " + i)
row = 5
EndIf
TextWindow.CursorTop = row
EndIf
EndFor
TextWindow.WriteLine("")
TextWindow.WriteLine("")
Sub ConvertToHex
HexValue[0] = "0"
HexValue[1] = "1"
HexValue[2] = "2"
HexValue[3] = "3"
HexValue[4] = "4"
HexValue[5] = "5"
HexValue[6] = "6"
HexValue[7] = "7"
HexValue[8] = "8"
HexValue[9] = "9"
HexValue[11] = "A"
HexValue[12] = "B"
HexValue[13] = "C"
HexValue[14] = "D"
HexValue[15] = "E"
val = chVal
hexstr = "h" 'Need to force Small basic to concatenate rather than add
While val > 0
hexPos = Math.Remainder(val, 16)
hexstr = HexValue[hexPos] + hexstr
val = Math.Floor(val / 16)
EndWhile
For hi = Text.GetLength(hexstr) To 2
hexstr = "0" + hexstr
EndFor
EndSub
Enjoy! -
IPhone installs one app at a time, why?
I have an iPhone 4S and an iPad 2. Both are running iOS 6.1.3. For the longest time, the way my iPhone and iPad install or upgrade apps has differed.
For my iPad, the install/update process for multiple installs/updates works like this:
1. Download first app
2. Start installing the app and simultaneously start downloading next app.
For my iPhone, the process works like this:
1. Download app.
2. Install app.
3. Once install is finished, download next app.
In other words, my iPad will download an app without waiting for the prior one to finish installing, while my iPhone downloads and installs one app at a time. Because of this it takes longer to update apps on my iPhone than on my iPad. This is case over both cellular and Wifi.
I'm assuming the way the iPad is working is the correct method. Why doesn't my iPhone work the same way?Whil you can run two apps at the same time, i.e. Music and Safari, you can only see one app at a time.
-
Hi,
I have a graphical program that repaints every 2000 ms. I want to call another program that queries the Oracle dbase and returns one row at a time, so that in the graphical program, I see the value of the next row every 2000 ms. Any ideas on how I'd do this?
I have the basics on resultsets and statements and using while(rs.next()), etc.. Thanks. Chris.Insert "Thread.sleep(2000);" at places where you want your program to wait for 2000 milliseconds.
-
PS CC 2014, Bridge and ACR. iMac. 100 pictures. Each picture was taken in a totally difference environment (lighting, noon and evening. inside, outside, ISO, etc). I need to process all 100 photos in ACR at the same time (don’t have time to manually analyze and edit one photo at a time) whereby each picture receives it own unique individual AUTO analysis and correction. One identical cookie cutter analysis and correction for all 100 photos will NOT work. I have the same question using LIGHTROOM. I will end up adopting whichever solution (ACR or LIGHTROOM) is the easiest and fastest. I do realize that I will have to go back and tweak each photo. Thanks. Bob
So I cannot just click once and the system will AUTO run all 100 photos through all the possible options (exposure, contrast, white balance, etc.). I sounds like I will have to run all 100 photos though each individual element (exposure, contrast, white balance, etc.). This would be very time consuming. Please clarify.
-
I need help with my back button. It goes crazy and instead of erasing one letter, it very quickly starts erasing the whole message...one letter at a time. But very quickly!
Try resetting your phone: hold the on/off and home buttons simultaneously until you see the Apple logo (ignoring the off slider that appears first), then release. If the problem persists, try restoring your phone.
Maybe you are looking for
-
What are the main transaction codes in XI?
What are the main transaction codes in XI?
-
JDBC Receiver Structure for Synchronous scenario
Hi, I have synchronous scenairo of jdbc where we are executing the stored procedure, up to response message mapping it is working fine and getting value from stored procedure but the problem is that response result not able to send to response targe
-
Wrong Period end date set in Fiscal year variant
Hi all, Can anyone please advise any solutions for my case? Thank you very much in advance. In my system, a 5-4-4 fiscal year variant has been set. However, the period end date is incorrect. For example, period 1 end date should be 5th Apr but saved
-
Benefits of working in BI upgrade project
Hi, I will be embarking on BI upgrade project soon. and would like to know what are the benefits in terms of career working in such a project as a consultant. e.g what can I learn that will be useful in the future. what knowledge will be gained etc.
-
I upgraded initial 256 RAM with 1GB memory in slot "A". It work so well, that I installed an additional 1GB memory upgrade in slot "B". PC won't boot. Give me 1 long beep and 4 short beeps. Tested new memory and it works in slot "A", so it appe