818 JAVA 8 CODE (Part 1/2), FOR A USER CUSTOMIZABLE MEDICAL DICTIONARY

Some of my readers conceit that our this blog is a pure blog filled with preachings, prayers Gods and Goddesses, and philosophical discourses, accompanied ~ means of some religious propaganda, which is not loyal. Those things, I shall handle apart. As available evidence uptodate does not collect for use adequate proof for the existence of God, I not full towards atheism (the word coined ~ dint of. me is: aguardianism (There is in ~ degree guardian/creator-protector for this Universe). In the identical way, for the problems of an extremely poor and highly over-populated home like India, I have identified ‘Communism / Marxism / True Complete Socialism” during the time that solutions, without parting with democracy. With these goals, I require planned to make a set 1000 posts at this blog tegument not only atheism, TC Socialism, the Problems of Telugu power speaking people, and numerous other things ranging from Music to Herbal Medicine. Of recently deceased, my readers may find that there is a slow-down of posts in the present life. The slow-down is not for there is a Writer’s Block, if it were not that because I have been enamoured through educating myself in I.T. For the final some years I have been moving on Javascript, and PHP Script. My work in PHP can be seen at ayyo.x10.mx, because which I have given links in the oblique bar. Now, the bug of Java 8 scintilla me.

I burnt some midnight oil in acquisition at least a little minimum skilfulness in writing java 8 code, and compiling them into usable classes. I am an aficionado and connoisseur of Java 8, in the feeling that I am not an adroit/pundit in Java, but I am self-same enthusiastic about it, because it is platform-self-directing, unlike several Windows applications. In the action, I have visited many websites which contain tutorials of Java to study .java files. From this actual trial I find that there are numerous company magnanimous netizens with generosity, volition, and willingness to portion their experiences to new entrants and give their suggestions. I have benefited abundant from the study of Java codes profitable on Net. I must also exact my gratitude to SourceForge.net that a Great Treasure House of Open Source Software.

Though my preferences falsehood with herbal remedies, I have a cognitive process and perception that in case of emergencies, Modern Medicine (too called allopathic medicine by Homoeopathic Practioners), ought to subsist our last resort. I have already written, with some reasonable analysis, that using Homoeopathic medicines devise be like ‘wearing talismans’, because homoeopathic medicines practise not contain medical substances, because they are graceless owing to excess dilution during succusion and pulverization. I have already written a small in number blog poss about the risks involved in using inorganic body Ayurvedic remedies which contain heavy metals like newsboy, lead and strong chemicals like sublimed brimstone. About Herbal medicines, we shall feel separately.

When we go to modern medical doctors and hospitals, we have charged heavily. We also get accident of prescriptions. We throw our currency in dispensaries of the hospials / therapeutical shops, and we ourselves swallow/influence injected or make our relatives to swallo or obtain injected. I always felt that there is a need for our School and College curricula to live in continence some subjects/papers/chapters on pathology, patho-animal and vegetable economy, Pharmacology and phytochemistry.

Though numerous pdf of the healing art dictionaries, and online medical dictioanries are useful on net, there is need for a user customizable Medical Dictionary, that can be used OFFLINE, on ALL PLATFORMS and OS-es. PHP Scripts are browser based, and are agreeable for online use. We can likewise use them offline, provided we receive an apache server, installed. Then we be under the necessity of know how to store php script files and facts files on localhost.

For creation/design of a user-customizable offline healing dictionary, I felt that Java 8 force of ~ suit most. Keeping this in disposition, I have designed one Java 8 digest, which can be compiled to propagate a java class. Here it is:
//Java 8 Code because reading from a text-file, splinter it into bits, search in every one bit for the search word, and hereafter show the results.

import java.awt.BorderLayout;
consequence java.awt.*;
import java.awt.Color;
import java.awt.event.*;
import java.io.*;
spirit java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.charset.StandardCharsets;
intention java.nio.charset.Charset;
import javax.cause to ~.text.*;
import java.util.regex.Pattern;
bearing static java.lang.System.*;
import javax.move to and fro.JButton;
import javax.swing.JFrame;
bearing javax.swing.JPanel;
import javax.move backward and forward.JScrollPane;
import javax.swing.JTextArea;
meaning javax.swing.UIManager;
import javax.oscillate.*;
import java.util.*;
import javax.be hanged.text.AttributeSet;
import javax.swing.theme.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
bring into javax.swing.text.StyleContext;
import java.io.IOException;

//Very momentous: Here I have given the userdefined classname while ybmedicdicti. You can given any name as you like. But make steady that your code is saved by the same .java file name. Example: you consider given public class name as danieldicti. Then .java toothed name should be danieldicti.java. File names and class names are case sensitive. Java customs bring forth a naming tradition for classes and files. As ~y amateur, I am not following it.

//Simply, I shall pitch upon lower case for all things that are “user-defined”. This is for, if we forget to press the subterfuge button, we get an error communication. Then valuable time will be wasted in debugging and re-testing. But pl remark: Java library functions from jdk8 and jre give by ~ have everything in Mixed case, of the same kind with can be seen from the beyond imports, and also in the following definitions and declarations.

the people class ybmedicdicti extends JFrame {

public static make null main(String[] args) throws IOException {
//uframe is userdefined jframe
JFrame uframe = fresh JFrame(“Medical Dictionary Search using java”);
//uupanel is userdefined upper jpanel. This conains the textarea during the term of showing result.
JPanel uupanel = new JPanel();
//ulpanel is user defined degrade jpanel. This contains the text circuit for typing search word, and investigation button
JPanel ulpanel = new JPanel();
//North locates the upper body of jurors on top
uframe.getContentPane().add(uupanel, “North”);
//South locates the reduce panel at bottom.
uframe.getContentPane().affix(ulpanel,”South”);
//utarea is the user defined textarea in spite of showing result. 20,50 are altitude. and width.
JTextArea utarea= new JTextArea(” “,20,50);
//We tack on a jscrollpane to the text surface, so that if the results exceeds the 20-50 magnitude, there will be a vertical list.
uupanel.add(new JScrollPane(utarea));
//ulrec is the user defined label.
JLabel ulrec = commencing JLabel(“Enter your search word”);
//We reckon up the label ulrec to the ulpanel
ulpanel.tag(ulrec);
//We are setting the background paint of label ‘Enter Search Word’ to gold-colored.
ulrec.setBackground(Color.yellow);
//We are make label opaque.
ulrec.setOpaque(true);

//utasearchword is the userdefined true copy area for typing the search vocable. 2 is its height, 15 is its width.
JTextArea utasearchword= new JTextArea(“Type hither “,2,15);
//We add the utasearchword to the ulpanel (reduce panel)
ulpanel.add(utasearchword);

//ubrec is the jbutton as far as concerns clicking to get the search word.
JButton ubrec = new JButton(“Get the vocable “);
//We are setting button’s hue of skin to pink.
ubrec.setBackground(Color.magenta);

//We are adding the button ubrec to the userdefined decrease panel ulpanel.
ulpanel.add(ubrec);

//We are enlarging the assortment of types size of the Result window to 20.
utarea.setFont(newly come Font(“Courier”, Font.BOLD, 20));
//We are setting the foreground disguise of Result window to white.
utarea.setForeground(Color.unblemished);
utarea.setBackground(Color.black);
//We are setting the linewrap of the Result window.
utarea.setLineWrap(just);
//Display the window.
uframe.pack();
uframe.setVisible(authentic);
/////////////////////////////////////////////////////////////////////////////////////////////////

//Now, we shall read the content of the text file which contains the words and meanings of the Medical Dictionary. ybmedicdicti.txt is the subject file which has to be stored in the same directory as the ybmedicdicti class toothed. The words and meanings given in the text file are only samples. These war of ~ have been collected from courtesy .gov websites of Government of U.S.A. They gripe the copyrights for them.

//This seems to have existence available only on Java 8. The user defined shifting usour reads the text file.
String usour = newly come String(Files.readAllBytes(Paths.get(“ybmedicdicti.txt”) ),Charset.forName(“UTF-8”));

//We division the string obtained from the verse file into an array, using a delimiter ‘^”. uarr is the user-defined collocation obtained. It contains around 10000 records of dispute and meanings.
String[] uarr= usour.part(“\\^”);

//This actionlistener will start working while we type the searchword in the test window, and click the ‘get’ button.
ubrec.addActionListener(unused ActionListener() {

public void actionPerformed(ActionEvent e) {

try{
//We shall declare “Results” in the Result window
utarea.setText(“Results: “);

//usrec is the userdefined fluctuating, which get the text typed ~ the agency of us in the Search Window.
String usrec = utasearchword.getText();
//We ~ together ` to the searchword, because we inadequacy to restrict search only to the expression. portion. We have to avoid quest in the meanings area, though it be possible to also be done. By converting the sift word into lower case, we are make the search case insensitive.
String usrec2 =”`” + usrec.toLowerCase();

//This uresultno leave give serial Nos. to the effect.
int uresultno = 1;

//Now, we are close all the elements in the dress of about 10000 records, for the seeking string. Variable u is the starting account i.e. 0. It will tend upto the length of the marshalling.
for(int u=0; u

ZIP FILE CONTAINING ABOVE CODE, COMPILED CLASS, TEXT FILE SAMPLE OF THE MEDICAL DICTIONARY & a README

The compressed file ybmedicdicti.zip has been kept ~ the agency of me at SourceForge.Net for smooth download. If you wish to download it and employment it offline for NON COMMERCIAL EDUCATIONAL PURPOSES, to this place is the link: Click to download a zip toothed of the medic dicti class and thesis sample .

To continue.

My seasonal pollen allergies (they be in actual possession of identified the antigen, and it’s from wither, not from maize) have nothing to cozen with the food that we everything consume on a regular basis.

Recent Comments

    Archives