Search functionality using SWT Text - java

Im developing an SWT application which used JSCH api to download files from a server. There is an option to view the downloaded files in the application directly.
Im using a multi line text box which will display the file contents. Its all working till this point. Now i'm trying to add a search functionality which is going to have a new text box on top where user can enter the search keyword. The matching words should be highlighted in yellow background. I have used the code given in this link and its working
http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SearchStyleText.htm
But im running out of heap space very very fast. Can I implement the same kind of code on Text instead of StyledText.

Related

Trying to create a bot using Java and having the bot read something that's already on screen into the program

Is it possible in java to read something that's on the screen into the program, such as a specific line on the screen? Say I need the program to get some numbers that are on a website and depending on the numbers it'll perform a specific task, is there a way to have the program scan and get input from a specific website?
Yes, there is a way.
For example using test framework Selenium Webdriver.
It has embedded Firefox driver.
So you only need to add this framework to your project, create an instance of Firefox driver, enter URL of your site, then using xPath/ID/CSS path, get values you need and process them.
To search for xPath use Firebug , load your site in FF, right click on the element, inspect in Firebug, right click on the element -> get xPath
Java can make Screenshots. If you use OCR text recognition you can then extract texts.
However usually you access the sources directly (for example use java to receive a html page, instead of reading text from screen output of a browser).

Java Read & Display Template Document, Fill with GUI Variables than take Print Output

I am confused a bit. I want make & display simple editable and printable some Information Slip module and add to my Java desktop application. I am doing first time something like that and need any advice because of this.
I draw a sample Information Slip in Power Point just for an example. Can be seen at below;
Sender Informations info coming from some GUI Element. Also Service Name, Brand, Model, SeriNo, Sending Date and Product Problem infos.
Question 1: Should i create this Template in Java and fill it? If it yes; which classes can be helpful for this operation?
Question 2: If No; Which model should using for create Template (Excel, Word, PowerPoint) and Apache POI can be helpful for reading, displaying and editing template in JAVA Application?
I use itext library for creating PDF file because has very detailed rendering functions for PDF creation. When user click the button i write a template and fill the blank cells from DB everytime.
Than i use Icepdf library for show to user and taking output of the created pdf file.
But Icepdf has some character encoding problem i think. When PDf created and callled by Icepdf one of Turkish character looks as square. Turkish characters can be seen at this link. All characters rendered succesfully but eighth character at the link is not.
When i go to filepath of created pdf file (created by itext library) and open it manually with Adobe Acrobat Reader all characters showing correctly. But if programaticly Icepdf open the file and show to user, eighth character at the link looks as square.
I need change character encoding of Icepdf but i can't yet. Reading many articles about character and Font encoding of Icepdf but i have not yet succeeded. If i solve this character problem my application ready to deploy.
-- Character Issue Solved --
I solved the special character issue when PDF file shown on screen via IcePdf
If you are not using IcePdf Pro (which support all asian languages etc.) you need embed the third party Font file (which tested all your language's special character support font) when you create PDF file with iText. And IcePdf can use embedded Font file for render and show the document accurately now.
For how embed the Font files to the PDF with iText you should check my last question and answer about that;
Icepdf special character rendering issue

how to develop an application in Java/Java EE that allows us to search images which contains some specific words by using a search bar

I'm looking for how to develop an application in Java/Java EE that allows us to search images which contains some specific words by using a search bar. The words are inside a picture Such as a picture of a newspaper.
Look, for example we would have a database of pictures then we can search of pictures that contain some keywords, finally the result is five pictures for example, the 5 pictures contain these keywords.
You know we can search and index pdf files by using the framework Alfresco or SOLR. Can we do the same thing with pictures by using some APIS or frameworks ?
This is a fairly openended question, so I'll share what I know.
It is possible to pull text out of images using a Java port of the c library opencv. A friend of mine used to read text from rendered images of PDF documents. I'd recommend using opencv to pull any text out of these images.
In terms of the database, sql or sqllite are popular and have java libraries. Once you have your image data, use one of these solutions to link the data.

creating a link to pdf files in netbeans

I am working on a project in netbeans, and right now I want to embed links to various pdf files so that when that link is clicked, the program will call up the appropriate pdf in it or somewhere in the hard disk and open it with the pdf viewer.
I came across a 'clickable label' concept in one article, but I dont know how to do that, all the labels I insert do not link to the source tab when I double click on them.
Can someone please provide an example of how to implement a 'clickable label'?

Java Drag and drop

I'm new to the drag and drop features of java and I wanted to know if it is possible to drag and drop a short-cut from the desktop on a java jpanel and get info from it like icon .exe location and so on. I only found tutorials for text images and other java objects.
You can get the location of the file and all the data that Java is able to acquire about a File.
But I believe you cannot get icon.

Categories