Archive

Archive for February, 2014

Sending Message from PC through mobile using AT Commands over Bluetooth

February 22nd, 2014 No comments
AT Commands:
              AT or attention are set of commands those are used to communicate with GSM modems.I am not going much about it as you can google it.I tried using the AT commands through Bluetooth  which was successful and finally integrated it to JAVA so that I can send message through my mobile using an interface instead of hyper-terminal.Before getting it started check your mobile if it supports the commands or not by using Hyper-terminal or any serial port Software.

               In the below codes i have used RxTx serial communication library that is free to use and my communication port was ‘COM9’ please check it for you and then changing it compile the code.

Main.java //Main GUI

package com.oksbwn.Y2014.Message_Mobile;



import java.awt.Color;

import java.awt.Dimension;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;



import javax.swing.*;



public class Main {



     JFrame frame=new JFrame();

     Dimension gh=java.awt.Toolkit.getDefaultToolkit().getScreenSize();

    public static void main(String[] args) throws InterruptedException { }

    public Main(){



       

        frame.getContentPane().setLayout(null);

        frame.setUndecorated(true);

          frame.addMouseListener(mouseListener);

          frame.addMouseMotionListener(mouseListener);

        frame.setBackground(new Color(Color.white.getRed(), Color.white.getGreen(),Color.white.getBlue(),1));

        frame.getContentPane().setBackground(new Color(Color.black.getRed(), Color.black.getGreen(),Color.black.getBlue(),50));

        frame.setBounds(gh.width/2-100,gh.height/2-110,200,250);

       

        frame.setType(JFrame.Type.UTILITY);

       

        final JLabel cloesButton = new JLabel("X");

          cloesButton.setForeground(Color.white);

          cloesButton.setToolTipText("Close");

          cloesButton.addMouseListener(new MouseAdapter() {

                @Override

                public void mouseClicked(MouseEvent arg0) {

                     frame.dispose();

                     }

               @Override

               public void mouseEntered(MouseEvent arg0) {

                    cloesButton.setForeground(Color.red);

                   }

              @Override

               public void mouseExited(MouseEvent arg0) {

                    cloesButton.setForeground(Color.white);

                   }});

          cloesButton.setSize(15,15);

          cloesButton.setBounds(frame.getWidth()-15,0, 15,15);

          frame.getContentPane().add(cloesButton);

         



            final JLabel head = new JLabel("MESSENGER");

            head.setBounds(50,0,100,20);

            head.setForeground(Color.blue);

            head.setOpaque(false);

            frame.getContentPane().add(head);

           

        final JTextField no=new JTextField();

        no.setBounds(0,20,200,20);

        no.setForeground(Color.white);

        no.setOpaque(false);

        frame.getContentPane().add(no);

       

        final JEditorPane text=new JEditorPane();

        text.setBounds(0,50,200,170);

        text.setOpaque(false);

        text.setForeground(Color.white);

        frame.getContentPane().add(text);

       

        JButton send=new JButton("SEND");

        send.setBounds(0,230,200,20);

        send.addMouseListener(new MouseAdapter() {

            @Override

            public void mouseClicked(MouseEvent arg0) {

                 new sendMessage(no.getText(),text.getText());

                 }});

        frame.getContentPane().add(send);



        frame.setVisible(true);



        }

    final  MouseAdapter mouseListener = new MouseAdapter() {

        int x, y;

        @Override

        public void mousePressed(MouseEvent e) {

            if (e.getButton() == MouseEvent.BUTTON1) {

                x = e.getX();

                y = e.getY();

            }

        }



        @Override

        public void mouseDragged(MouseEvent e) {

            if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {

                frame. setLocation(e.getXOnScreen() - x, e.getYOnScreen() - y);

            }

        }

    };

}

 sendMessage.java

package com.oksbwn.Y2014.Message_Mobile;



import com.oksbwn.voiceEnable.Voice;



public class sendMessage {

public sendMessage(String phone,String message)

  {

    byte[] configureTextMode={0x41,0x54,0x2B,0x43,0x4D,0x47,0x46,0x3D,0x31,0x0D};

    byte[] SetSMSNo={0x41,0x54,0x2B,0x43,0x4D,0x47,0x53,0x3D,0x22,

            (byte) phone.charAt(0),(byte) phone.charAt(1),(byte) phone.charAt(2),(byte) phone.charAt(3),(byte) phone.charAt(4),(byte) phone.charAt(5),(byte) phone.charAt(6),(byte) phone.charAt(7),(byte) phone.charAt(8),(byte) phone.charAt(9),

            0x22,0x0d};

    //byte[] BatteryLevel={0x41,0x54,0x2B,0x43,0x42,0x43,0x0D};

    SerialComm ad= new SerialComm();

    ad.SendData(configureTextMode);

    if(ad.readSerial().trim().replaceAll(" ","").contains("OK"))

    {}

    ad.SendData(SetSMSNo);

    if(ad.readSerial().trim().replaceAll(" ","").contains(">"))

    {}

    ad.SendData(message.getBytes());

   byte[] end={'O','K','S','B','W','N',0x1A};

    ad.SendData(end);

    if(ad.readSerial().trim().replaceAll(" ","").contains("OK"))

    {

        new Voice("Sir i have Send the Message");   

    }

    ad.Close();

  }

}



SerialComm.java

package com.oksbwn.Y2014.Message_Mobile;

import gnu.io.CommPort;

import gnu.io.CommPortIdentifier;

import gnu.io.SerialPort;

import java.io.InputStream;

import java.io.OutputStream;

import java.util.Enumeration;

import java.util.HashMap;





public class SerialComm {   

    private Enumeration<?> ports = null;

    private HashMap<String, CommPortIdentifier> portMap = new HashMap<String, CommPortIdentifier>();

    private CommPortIdentifier selectedPortIdentifier = null;

    private SerialPort serialPort = null;

    private InputStream input = null;

    private OutputStream output = null;

    final static int TIMEOUT = 2000;

    final static int SPACE_ASCII = 32;

    final static int DASH_ASCII = 45;

    final static int NEW_LINE_ASCII = 10;

    CommPort commPort = null;

    public static void main(String[] args) {byte[] bt={0x00,0x25,0x26};SerialComm ad= new SerialComm();

    ad.SendData(bt);}

   

    public SerialComm()

    {

         ports = CommPortIdentifier.getPortIdentifiers();

           while (ports.hasMoreElements())

            {

                CommPortIdentifier curPort = (CommPortIdentifier)ports.nextElement();

                if (curPort.getPortType() == CommPortIdentifier.PORT_SERIAL)

                {

                    portMap.put(curPort.getName(), curPort);

                }

            }

           String selectedPort = "COM9";//Add the Port

           selectedPortIdentifier = (CommPortIdentifier)portMap.get(selectedPort);

           try {

            commPort = selectedPortIdentifier.open("serial", TIMEOUT);

              serialPort = (SerialPort)commPort;

              serialPort.setRTS(true);

              serialPort.setDTR(true);

              output = serialPort.getOutputStream();

              input = serialPort.getInputStream();

        } catch (Exception e) {

            // TODO Auto-generated catch block

            e.printStackTrace();

        }

   

       

    }

    public void    SendData(byte[] bt){

        

           try

           {

             output.write(bt);

             output.flush();

              }catch (Exception e)

           {}

        }  

    public void    Close(){

              try

               {

                 serialPort.close();

                 input.close();

                 output.close();

                  }catch (Exception e)

               {}

            }

    private byte[] readBuffer = new byte[400];

   

public  String  readSerial()

   {

        String read = null;

        try {



            //int avBytes=input.read();

            input.read(readBuffer,0,50);

            input.read(readBuffer,0,150);

            input.read(readBuffer,0,200);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            input.read(readBuffer,0,300);

            read=new String(readBuffer,0,400);

          

        } catch (Exception e) {e.printStackTrace();

        }

      

      return read;

    }

}

thanks…pls leave your comment…

Getting Facebook Access Token for JAVA applications

February 8th, 2014 No comments
    When for the first time i used facebook API in my java application using the  library restFb i faced real trouble with the access token .For that i browsed a lot to get the token at last i was able.So to make it easy here are the steps to get the access token that is valid for 2 months.

Step:1
   First of all create a facebook application and goto the application page.goto tools and click on APIExplorer   in the menu as shown below select your application…

 click on get accesstoken..

 
on clicking debug it will show you that it is valid for 1 hour only..Note the access token as use the URL below with the noted token…
   graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token
&client_id=APP__ID&client_secret=APPP__SECRET&fb_exchange_token=CURRENT_TOKEN

So in return u will return with an token that is valid for 2 months..

Thanks………..

Storing configuration data for JAVA applications

February 8th, 2014 No comments
       Many times it is required to store some configuration settings for your application so that it can use again and again from where it left.Or the application can start with some specific parameters.So the properties file can come handy in such requirements.

   First lets write something to the properties file..

Code:

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;

public class App {
  public static void main(String[] args) {

    Properties prop = new Properties();
    OutputStream output = null;

    try {

        output = new FileOutputStream("C:\Alberto\Config\debug.properties");
        prop.setProperty("stat","no");
        prop.setProperty("mail", "[email protected]");
        prop.setProperty("id", "oksbwn");
        prop.store(output, null);
       } catch (Exception io) {io.printStackTrace();} 
    }
}

Simillarly you can add more parameters using  setProperty() function.Now lets see how to read from a property file..
Code:

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class read {
  public static void main(String[] args) {

    Properties prop = new Properties();
    InputStream input = null;

    try {

        input = new FileInputStream("config.properties");
        prop.load(input);
        System.out.println(prop.getProperty("database"));
        System.out.println(prop.getProperty("dbuser"));
        System.out.println(prop.getProperty("dbpassword"));

    } catch (Exception ex) {ex.printStackTrace();}
   }
}

Thanks…

Controlling VLC media player using JAVA

February 8th, 2014 No comments
         Basically i was looking for a method to communicate with the VLC media player so that i can get the currently playing video on the player and my app can search the internet and get the details about the movie.For that i googled a lot and finally came to know that VLC has a web interface and i used that with my JAVA app to control and getting details of the movie.
           
        First open the VLC and goto tools->preferences and check the All radio button. and navigate to the Main Interface and click on lua and there you have to set HTTP password (Otherwise u cannot access the web interface). Screenshot is given below.
           

 Now lets clear some security issues on windows to allow us to control the vlc from any PC in the network.Goto Control Panel click on Allow a program through Windows Firewall.
 
      And now click allow another program and browse to VLC.exe and check on as shown below.
       Now open any browser and navigate to 127.0.0.1:8888  you will see a interface as below. Before that in VLC player set the web interface on.That’s it now you can control the Player from browser.Now comes the JAVA Part.

Code :

package com.oksbwn.Y2014.vlcInteraction;
import java.io.InputStream;
import java.net.Authenticator;
import java.net.URL;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class vlcStatus {
    String time;
    String name;
    String state;
    String length;
    public static void main(String[] args){
        vlcStatus vs=new vlcStatus();
        replace r=new replace();
         String mov=vs.getName();
        System.out.println(r.replaceIt(mov));
    }
    public  vlcStatus()
    {
     try
      {
         String urlString = "http://127.0.0.1:8080/requests/status.xml";
         Authenticator.setDefault(new authoRize());
         URL url = new URL(urlString);
         InputStream content = (InputStream) url.getContent();
     
       
       DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
       DocumentBuilder b = f.newDocumentBuilder();
       Document doc = b.parse(content);
       doc.getDocumentElement().normalize();
                // loop through each item
      NodeList items = doc.getElementsByTagName("root");
      Element e = (Element)items.item(0);
   
      time=e.getElementsByTagName("time").item(0).getChildNodes().item(0).getNodeValue();
      length=e.getElementsByTagName("length").item(0).getChildNodes().item(0).getNodeValue();
      state=e.getElementsByTagName("state").item(0).getChildNodes().item(0).getNodeValue();
     
      NodeList items1= e.getElementsByTagName("information");
      Element f1 = (Element)items1.item(0);
     
      NodeList items11= f1.getElementsByTagName("category");
      Element f111 = (Element)items11.item(0);
      try{
          name=f111.getElementsByTagName("info").item(2).getChildNodes().item(0).getNodeValue();
          }catch(Exception e1){
             
                  try{
                      name=f111.getElementsByTagName("info").item(1).getChildNodes().item(0).getNodeValue();
                      }catch(Exception e11){
                          try{
                              name=f111.getElementsByTagName("info").item(0).getChildNodes().item(0).getNodeValue();
                              }catch(Exception e2){
                                  try{
                                      name="oksbwn";
                                      }catch(Exception e111){}
                              }
                      }
          }
   
            
      } catch (Exception e)
           {//new handleExceptions(e);
      }
   
    }
    public String getName(){return this.name;}
    public String getTime(){return this.time;}
    public String getedState(){return this.state;}
    public String getLength(){return this.length;}
}

And the CODE for the authorization is.
Code:

package com.oksbwn.Y2014.vlcInteraction;
import java.net.Authenticator;
import java.net.PasswordAuthentication;

class authoRize extends Authenticator {
    private String username, password;

    public authoRize() {
      username = "";
      password = "om";
    }
    protected PasswordAuthentication getPasswordAuthentication() {
      return new PasswordAuthentication(username, password.toCharArray());
    }
  }

Thanks…

Sending Email using JAVA mail API and gmail account

February 7th, 2014 No comments
       

        Sending a mail using JAVA mail API in JAVA is really a easy part.Here i am posting the codes to simply send a mail using the API.First you have to download the JAVA mail library and add it to your build path.

Code:

package com.oksbwn.mail;
import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

import javax.mail.*;
import javax.mail.internet.*;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JTextPane;

import com.oksbwn.ErrorHandling.handleExceptions;
import com.oksbwn.popUp.popMe;

//import com.oksbwn.popUp.popMe;

public class SendMail  extends JFrame {

    final static JFrame frame = new JFrame();
    private static final long serialVersionUID = 1L;
    public void SendMailTo(){
       //public static void main(String[] args) {

        frame.addMouseListener(mouseListener);
        frame.addMouseMotionListener(mouseListener);
        frame.setUndecorated(true);
        frame.setBackground(new Color(Color.black.getRed(), Color.black.getGreen(),Color.black.getBlue(),1));
         ((JComponent)frame.getContentPane()).setBorder(   
                    BorderFactory.createMatteBorder( 2, 2, 2, 2, Color.black ) );
        frame.setType(javax.swing.JFrame.Type.UTILITY);
        frame.setBounds(100, 100, 440, 280);
        frame.getContentPane().setLayout(null);
       
        final JTextField textField = new JTextField();
        textField.setOpaque(false);
        textField.setForeground(Color.white);
        textField.setBounds(159, 11, 245, 30);
        frame.getContentPane().add(textField);
        textField.setColumns(10);
       
        final JTextField textField_1 = new JTextField();
        textField_1.setOpaque(false);
        textField_1.setForeground(Color.white);
        textField_1.setBounds(159, 52, 245, 34);
        frame.getContentPane().add(textField_1);
        textField_1.setColumns(10);
       
        final JLabel cloesButton = new JLabel("X");
        cloesButton.setForeground(Color.white);
        cloesButton.setToolTipText("Close");
        cloesButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                frame.dispose();
                }
            @Override
            public void mouseEntered(MouseEvent arg0) {
                cloesButton.setForeground(Color.red);
                }
            @Override
            public void mouseExited(MouseEvent arg0) {
                cloesButton.setForeground(Color.white);
                }
           
        });
        cloesButton.setSize(15,15);
        cloesButton.setBounds(430, 2, 15,15);
        frame.getContentPane().add(cloesButton);
       
        final JTextPane textPane = new JTextPane();
        textPane.setOpaque(false);

        textPane.setForeground(Color.white);
        textPane.setBounds(74, 97, 330, 134);
        textPane.setBorder(BorderFactory.createMatteBorder( 2, 2, 2, 2, Color.pink ) );
        frame.getContentPane().add(textPane);

        JLabel lblTo = new JLabel("To :");
        lblTo.setForeground(Color.white);
        lblTo.setBounds(70, 19, 66, 14);
        frame.getContentPane().add(lblTo);
       
        JLabel lblSub = new JLabel("Subject :");
        lblSub.setForeground(Color.white);
        lblSub.setBounds(74, 62, 66, 14);
        frame.getContentPane().add(lblSub);
       
        JLabel lblMessage = new JLabel("Message :");
        lblMessage.setOpaque(false);
        lblMessage.setForeground(Color.white);
        lblMessage.setBounds(10, 137, 70, 14);
        frame.getContentPane().add(lblMessage);
       
        JButton btnNewButton = new JButton("Send");
        btnNewButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                sendMailTo(textField.getText(),textField_1.getText(),textPane.getText());
                frame.dispose();
               
            }
        });
        btnNewButton.setBounds(330, 239, 74, 23);
        frame.getContentPane().add(btnNewButton);
        frame.setVisible(true);
    }
 public static void  sendMailTo (String to,String sub,String bod)
 {
  //Get the session object
  Properties props = new Properties();
  props.put("mail.smtp.host", "smtp.gmail.com");
  props.put("mail.smtp.socketFactory.port", "465");
  props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
  props.put("mail.smtp.auth", "true");
  props.put("mail.smtp.port", "465");

  Session session = Session.getDefaultInstance(props,
   new javax.mail.Authenticator() {
   protected PasswordAuthentication getPasswordAuthentication() {
   return new PasswordAuthentication("Username","Password");//change accordingly

   
   }
  });
  try {
   MimeMessage message = new MimeMessage(session);
   message.setFrom(new InternetAddress("E.Mail Id"));//change accordingly
   message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
   message.setSubject(sub);
   message.setText(bod);
   Transport.send(message);
   new popMe("message sent successfully","E-Mail","email",5,125);
  } catch (Exception e){new handleExceptions(e);}
  }
 final static MouseAdapter mouseListener = new MouseAdapter() {
        int x, y;
        @Override
        public void mousePressed(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON1) {
                x = e.getX();
                y = e.getY();
            }
        }

        @Override
        public void mouseDragged(MouseEvent e) {
            if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
                frame. setLocation(e.getXOnScreen() - x, e.getYOnScreen() - y);
            }
        }
    };
 }

Thanks…….

Show movie details using JAVA

February 4th, 2014 No comments

   In this post i am going to post about using the anditson.com API to search for a movie online and display the results like a gallery as shown above using JAVA.anditson.com provides a good API which actually provides all data associated with a movie  in JSON or XML format.I have used the XML format.Here are the codes…

Code to search online:

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class movieDetails {
    String Year;
    String TORRENT;
    String Plot;
    String Language;
    String Awards;
    String Poster;
    String imdbRating;
    String tomatoConsensus;
    String BoxOffice;
    String Production;
    String Runtime;
    String Actors;
    String Director;
    String Released;
    String Rated;
    String Title;
   
    public  movieDetails(String movie)
    {
     String url = "http://anditson.com/?t="+movie+"&rt=xml&tomatoes=true&imdata=true&trailer=true&torrent=true&stream=true"; 
     try
      {
       DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
       DocumentBuilder b = f.newDocumentBuilder();
       Document doc = b.parse(url);
       doc.getDocumentElement().normalize();
                // loop through each item
      NodeList items = doc.getElementsByTagName("movie_data");
      Element e = (Element)items.item(0);
   
      Title=e.getElementsByTagName("Title").item(0).getChildNodes().item(0).getNodeValue();
      Year=e.getElementsByTagName("Year").item(0).getChildNodes().item(0).getNodeValue();
      Rated=e.getElementsByTagName("Rated").item(0).getChildNodes().item(0).getNodeValue();
      Released=e.getElementsByTagName("Released").item(0).getChildNodes().item(0).getNodeValue();
      Director=e.getElementsByTagName("Director").item(0).getChildNodes().item(0).getNodeValue();
      Actors=e.getElementsByTagName("Actors").item(0).getChildNodes().item(0).getNodeValue();
      Plot=e.getElementsByTagName("Plot").item(0).getChildNodes().item(0).getNodeValue();
      Language=e.getElementsByTagName("Language").item(0).getChildNodes().item(0).getNodeValue();
      Awards=e.getElementsByTagName("Awards").item(0).getChildNodes().item(0).getNodeValue();
      Poster=e.getElementsByTagName("Poster").item(0).getChildNodes().item(0).getNodeValue();
      imdbRating=e.getElementsByTagName("imdbRating").item(0).getChildNodes().item(0).getNodeValue();
      tomatoConsensus=e.getElementsByTagName("tomatoConsensus").item(0).getChildNodes().item(0).getNodeValue();
      BoxOffice=e.getElementsByTagName("BoxOffice").item(0).getChildNodes().item(0).getNodeValue();
      Production=e.getElementsByTagName("Production").item(0).getChildNodes().item(0).getNodeValue();
      TORRENT=e.getElementsByTagName("TORRENT").item(0).getChildNodes().item(0).getNodeValue();
      Runtime=e.getElementsByTagName("Runtime").item(0).getChildNodes().item(0).getNodeValue();
         
      } catch (Exception e) {e.printStackTrace();}
   
    }
    public String getTitle(){return this.Title;}
    public String getYear(){return this.Year;}
    public String getedRat(){return this.Rated;}
    public String getReleased(){return this.Released;}
    public String getDirector(){return this.Director;}
    public String getActors(){return this.Actors;}
    public String getPlot(){return this.Plot;}
    public String getLanguage(){return this.Language;}
    public String getAwards(){return this.Awards;}
    public String getPoster(){return this.Poster;}
    public String getImdbRating(){return this.imdbRating;}
    public String getTomatoCons(){return this.tomatoConsensus;}
    public String getBox(){return this.BoxOffice;}
    public String getProduction(){return this.Production;}
    public String getTime(){return this.Runtime;}
    public String getTorrent(){return this.TORRENT;}
}


Code for the GUI:

import javafx.scene.effect.*;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.text.Text;

import javax.swing.JFrame;
import javax.swing.JLabel;
public class newMessageBox
  {
    static Dimension gh=java.awt.Toolkit.getDefaultToolkit().getScreenSize();
     JFrame jFrame = new JFrame();
    public newMessageBox(final String movie)
      {
        jFrame.setLayout(null);
         jFrame.setUndecorated(true);
        jFrame.setBackground(new Color(Color.white.getRed(), Color.white.getGreen(),Color.white.getBlue(),0));
        jFrame.setType(javax.swing.JFrame.Type.UTILITY);
      jFrame.setBounds(0,0,gh.width,gh.height);
     
      final JLabel cloesButton = new JLabel("X");
      cloesButton.setForeground(Color.white);
      cloesButton.setToolTipText("Close");
      cloesButton.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent arg0) {
                 jFrame.dispose();
                 }
           @Override
           public void mouseEntered(MouseEvent arg0) {
                cloesButton.setForeground(Color.red);
               }
          @Override
           public void mouseExited(MouseEvent arg0) {
                cloesButton.setForeground(Color.white);
               }});
      cloesButton.setSize(15,15);
      cloesButton.setBounds(jFrame.getWidth()-17, 2, 15,15);
      jFrame.getContentPane().add(cloesButton);
   
      final JFXPanel jFXPanel3 = getPanel(0,0,400,300); 
      jFrame.setVisible(true);
     
      Platform.setImplicitExit(false);
      Platform.runLater(new Runnable(){
            @Override
            public void run() {

                movieDetails md= new movieDetails(movie);
                fxPanelPath(getPanel(410,5,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Name :"+md.getTitle());
                fxPanelPath(getPanel(410,35,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Released on :"+md.getReleased());
                fxPanelPath(getPanel(410,65,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Cast :"+md.getActors());
                fxPanelPath(getPanel(410,95,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Directed by :"+md.getDirector());
                fxPanelPath(getPanel(410,125,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Awards :"+md.getAwards());
                fxPanelPath(getPanel(410,155,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Lang :"+md.getLanguage());
                fxPanelPath(getPanel(410,185,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Buesiness :"+md.getBox());
                fxPanelPath(getPanel(410,215,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Rat. :"+md.getedRat());
                fxPanelPath(getPanel(410,245,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","Length :"+md.getTime());
                fxPanelPath(getPanel(410,275,gh.width-420,25),"C:\Alberto\Interface\Twitter\ed.jpg","IMDB Rat."+md.getImdbRating());
                fxPanelPath(getPanel(10,305,gh.width-20,25),"C:\Alberto\Interface\Twitter\ed.jpg","House :"+md.getProduction());
                fxPanelPath(getPanel(10,335,gh.width-20,25),"C:\Alberto\Interface\Twitter\ed.jpg","Story"+md.getPlot());
                fxPanelPath(getPanel(10,365,gh.width-20,25),"C:\Alberto\Interface\Twitter\ed.jpg","Plot :"+md.getTomatoCons());
                fxPanelPath(getPanel(10,395,gh.width-20,25),"C:\Alberto\Interface\Twitter\ed.jpg","Torrent :"+md.getTorrent());
                fxPanelURL(jFXPanel3,md.getPoster());      
        }});
    }

   
   
   
   
   
   
   
   
   
//****************************************************************************************************************************//
    private  void fxPanelURL(JFXPanel panel,String path)
    {
      Image image = new Image(path,400,300,true,true);
      DropShadow ds1 = new DropShadow();
      ds1.setOffsetY(4.0f);
      ds1.setOffsetX(4.0f);

      Group root = new Group();
      Scene scene = new Scene(root);
        final ImageView  chart = new ImageView();
        chart.setImage(image);
        chart.setEffect(ds1);
       
        root.getChildren().add(chart);
       
        scene.setFill(null);
        panel.setScene(scene);
    }
private  void fxPanelPath(JFXPanel panel,String path,String text)
{
  File file = new File(path);
  Image image = new Image(file.toURI().toString(),gh.width,100,false,true);
  DropShadow ds1 = new DropShadow();
  ds1.setOffsetY(4.0f);
  ds1.setOffsetX(4.0f);

  Group root = new Group();
  Scene scene = new Scene(root);
    final ImageView  chart = new ImageView();
    chart.setImage(image);
    chart.setEffect(ds1);
 
    Text tv=new Text();
    tv.setText(text);
    tv.setX(chart.getX()+26);
    tv.setY(chart.getY()+14);
   
    root.getChildren().add(chart);
    root.getChildren().add(tv);
   
    scene.setFill(null);
    panel.setScene(scene);
}
private JFXPanel getPanel(int xPos,int yPos,int width,int height)

    final  JFXPanel jFXPanel = new JFXPanel();
    jFXPanel.setOpaque(false);
    jFXPanel.setBounds(xPos,yPos,width,height);
    jFXPanel .addMouseListener(setPos(jFXPanel));
    jFXPanel.addMouseMotionListener(setPos(jFXPanel));
    jFrame.getContentPane().add(jFXPanel);
    return jFXPanel;
    }
private    MouseAdapter setPos(final JFXPanel comp){
final  MouseAdapter mouseListener2 = new MouseAdapter() {
          int x, y;
          @Override
          public void mousePressed(MouseEvent e) {
              if (e.getButton() == MouseEvent.BUTTON1) {
                  x = e.getX();
                  y = e.getY();
              }
          }
          @Override
          public void mouseClicked(MouseEvent e) {
             }

          @Override
          public void mouseDragged(MouseEvent e) {
              if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
                  comp.setLocation(e.getXOnScreen() - x, e.getYOnScreen() - y);
              }
          }
        };
return mouseListener2;
}

}

Thanks….Have your feedback please….