• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Select and unselect in textarea

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a keyboard in html with the edittext to enter search elements. From keyboard i can select the characters. I would even like to unselect the characters on same button click. Instead of backspace i want to unselect the character. Is it possible to do? If so please tell me how to do.
 
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us the code what you have done so far, that might give us better understanding of your requirement.
 
Marshal
Posts: 67279
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changing the expected behavior of keys, like making backspace do something different than it usually does, is rarely delightful for users.
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having both clear and backspace in my keyboard. Just I like to know is it possible to unselect the character by clicking the same button.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what you are trying to say is, the button will have a toggle button type behavior?
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your existing code?
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sure.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which button will do this job?
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Corresponding character's button should do the job.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Didn't get you very clearly.  If i press H H appears.  Now which button will select H and deselect H?
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First time selecting H will write in textarea. Selecting the same H again should delete the H.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means it will always erase the last entry?
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not like that. If i am selecting H then He at first and if i don't want H  by selecting H again H alone should get deleted not He. Hope i didn't confuse you
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean all occurrences of H will get erased?  For eg. HHE now if the presses H it will become E?
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No no.Not all occurrence of H if H and He is there and if i am selecting H again only H should get deleted leaving He.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And in HHE if HE is pressed again only H stays, right?
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this once, I haven't tested very thoroughly, and keep backup of your previous code.
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code works fine.  Few buttons have 2 letters. Is it possible to make the first letter in upper case and second in lower case. Also the above code which you gave have one small issue. If i am selecting HHe and deselecting H button twice H in He also getting deleted.  
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried the above code. Its not changing the second letter of He to lower case.HE both are in capital letters only. One  more help. Is it possible to highlight the selected buttons? Like if I am selection H and He the buttons should get highlighted with different color something like this.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code is changing it to uppercase.  You don't need that because the buttons are already having the case that you want.  Take out the upper case conversion, I hope you will be fine.
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While clicking the buttons in the text area it is entering in uppercase.

If i remove the style both the characters are entering in lower case. Also if i change From uppercase to lower case its just like Hheli like this.  Or is it possible to append a spce between each input? I want to get the input like HHeLi or H-He-Li
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Swastik Dey wrote:Your code is changing it to uppercase.  You don't need that because the buttons are already having the case that you want.  Take out the upper case conversion, I hope you will be fine.



Thanks for the advice. I just modified the line from this to

Now its printing like the way i want HHeLi.
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One  more help. Is it possible to highlight the selected buttons from the keyboard? Like if I am selection H and He the buttons should get highlighted with different color something like this.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very much possible.
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

When i run my code in eclipse the keyboard works fine. But when i try to run the webpage in firefox i couldn't select the keyboard elements. Please tell me What might be the issue?
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me it's working in all of these three browses chrome/mozilla/ie.  What version of mozilla do you have?
 
Swastik Dey
Master Rancher
Posts: 1988
15
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it show any error?  What exact problem are you facing?
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sep 06, 2019 11:00:24 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/LoginDetails] threw exception [java.lang.IllegalStateException: getOutputStream() has already been called for this response] with root cause
java.lang.IllegalStateException: getOutputStream() has already been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:583)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:211)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:118)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:111)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:184)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
at org.apache.jsp.login_jsp._jspService(login_jsp.java:156)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

  This error is what i am getting.
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code works fine separately. But the issue is, I have created a login page and when user click submit it will display the keyboard.html file. AT this place i am not able to select elements.
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it. I just added and
Now it works in browser also. Thanks for the help.
 
Gayathri Gayu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code works fine. But the problem is when i am deselecting the button the button doesn't change back to its original and also its erasing all elements present in text area.

 
It would give a normal human mental abilities to rival mine. To think it is just a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!