Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Opening IE from Java Swing Application in Kiosk mode

Have Programming Question? Ask it here!
 
 
 


Abhijith S
Opening IE from Java Swing Application in Kiosk mode
3 Answer(s)      a year and 8 months ago
Posted in : Java Beginners


Hi All, I want to open a URL in IE from my Java Swing application running in Wiindows. I am using the below code.

public static boolean openInBrowserKioskMode(String url){
 String os = System.getProperty("os.name").toLowerCase();
 Runtime rt = Runtime.getRuntime();
 try{
    if (os.indexOf( "win" ) >= 0) {
        rt.exec( "rundll32 url.dll,FileProtocolHandler " + url);
}
 }catch (IOException e){
e.printStackTrace();
    return false;
 }
 return true;
}

As per the above code, IE window is opening. But I want to open the IE window in Kiosk mode or without address bar, foward/back buttons, etc. Please help me to resolve this problem

Thanks & Regards, Abhijith


Advertisement
View Answers

November 7, 2012 at 3:41 PM


Here is a simple example of opening IE in swing application.

class OpenBrowser 
{
    public static void main(String[] args) 
    {
          String browserPath = "C:/Program Files/Internet Explorer/IEXPLORE.EXE"; 
          String url = "www.roseindia.net";
          try {
               String[] b = {browserPath, url};
               Runtime.getRuntime().exec(b);
           }
           catch (Exception exc) {
        exc.printStackTrace();
           }
    }
}


November 7, 2012 at 3:42 PM


Here is a simple example of opening browser in swing application.

1)OpenBrowser.java

import javax.swing.*;
import java.lang.reflect.Method;

public class OpenBrowser {
public static void openURL(String url) {
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Windows"))
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
else {
String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
browser = browsers[count];
Runtime.getRuntime().exec(new String[] {browser, url});
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error in opening browser" + ":\n" + e.getLocalizedMessage());
}
}
}

2)Browser.java

import javax.swing.*;
import java.awt.event.*;

public class Browser {
public static void main(String[] args) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
final JTextField url =new JTextField(20);
JButton button = new JButton("Open Browser");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
OpenBrowser.openURL(url.getText().trim());
 }
});
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel.add(new JLabel("URL:"));
panel.add(url);
panel.add(button);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}
}


November 7, 2012 at 3:42 PM


Here is a simple example of opening browser in swing application.

1)OpenBrowser.java

import javax.swing.*;
import java.lang.reflect.Method;

public class OpenBrowser {
public static void openURL(String url) {
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Windows"))
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
else {
String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
browser = browsers[count];
Runtime.getRuntime().exec(new String[] {browser, url});
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error in opening browser" + ":\n" + e.getLocalizedMessage());
}
}
}

2)Browser.java

import javax.swing.*;
import java.awt.event.*;

public class Browser {
public static void main(String[] args) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
final JTextField url =new JTextField(20);
JButton button = new JButton("Open Browser");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
OpenBrowser.openURL(url.getText().trim());
 }
});
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel.add(new JLabel("URL:"));
panel.add(url);
panel.add(button);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
}
}


Related Tutorials/Questions & Answers:
Opening IE from Java Swing Application in Kiosk mode
Opening IE from Java Swing Application in Kiosk mode  Hi All, I want to open a URL in IE from my Java Swing application running in Wiindows. I am... window is opening. But I want to open the IE window in Kiosk mode or without address
opening internet browser in java program - Swing AWT
opening internet browser in java program  i want a code to open the internet browser in swing program using JFrame.  Hi Omkar, Use...) { JOptionPane.showMessageDialog(null, "Error in opening browser" + ":\n" + e.getLocalizedMessage
Advertisements
Opening a browser only with body from a java program
Opening a browser only with body from a java program  Hi all, I got following requirement, Opening a browser window only with body and title bar... { //attempt to use Desktop library from JDK 1.6+ Class<?> d = Class.forName
How to run java swing application from jar files .
How to run java swing application from jar files .  Hello Sir, I developed a java swing application .Now i want to execute it as .exe... the main class program will exit" from "java virtual machine". Plz help me
How to launch my web application from my desktop without opening Netbeans IDE everytime i run the application?
How to launch my web application from my desktop without opening Netbeans IDE... dont want all these steps, so i knw that java application can be launched using Java Web Start but dont knw abt web application, Is there any way to do
Java - Opening a URL from an Applet
Java - Opening a URL from an Applet       This is the example of opening a url in same... used for opening url from an applet. This program is using two functions
Threads in Java Swing MVC Application
Threads in Java Swing MVC Application  Hello, I am currently making a Java Swing application, but I am having a lot of trouble with implementing threads into my program. I use the MVC paradigm and I just can't seem to implement
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
Java - Opening a url in new window from an applet
Java - Opening a url in new window from an applet       This is the example of opening a url from an applet. This program shows that how a url is opened in a new document or browser
Retrieve data from database in swing application
Retrieve data from database in swing application  I want to retrive data(doctor name,specilization,date) from my sql database...(); ResultSet rs=st.executeQuery("select * from data where id=1"); while
Opening a URL from an Applet
Opening a URL from an Applet       Introduction This is the example of opening a url in same... used for opening url from an applet. This program is using two functions in which
catching tomcat object to swing application
catching tomcat object to swing application  Hi, I have 2 java projects, one is running on tomcat server and another is at client pc ie swing application. So I need to catch a server side object from swing application. How can I
Swing application
Swing application  Hello, I want to develop a Swing application... the application not through web browsers, instead through a Swing desktop application GUIs. Please help me to develop such an application
Swing Application
Swing Application  hello, i am making swing application in java i am unable to run prog......when my rite clikcing on my project name and clicking thn run it is not showing output .....and when i am cliking on individual java
problem in swing program for opening two windows with same login credentials
problem in swing program for opening two windows with same login credentials  I Face two problems while writing the code in swing program 1.i developed one application using swings that has username,password when i login
Mean, Median and Mode - Java Beginners
Mean, Median and Mode  Write a java program that computes three measures of central tendency of a given set of students marks: mean, median, and mode...); System.out.println("Median= "+median); int mode=Find.findMode(ranNum
Error Opening File - Java Interview Questions
Error Opening File  Dear, Please if help me to resolve this problem. I have an application in java that works correctly under Eclipse... this generated file, a message was displayed: Error opening file. But If I
opening new browser with new JSESSIONID using java
opening new browser with new JSESSIONID using java  I am facing following problem, I am trying to open a new browser using java. First i have opened one IE browser and manually. And i ran my LaunchURL.java file, it is opening new
opening new window - Java Beginners
opening new window  Hi All, I have two classes with me , lets say A and B.when I press a button in class A , the class B should open in a new window.i.e., I want to know, how a new window(B) can be opened by clicking a button
open a bufferedwriter file in append mode - Java Beginners
to opena bufferedwriter file in append mode..  Hi friend, FileWriter...) then the constructor append the specified data to the file i.e. the pre-exist data...://www.roseindia.net/java/example/java/io/java-append-to-file.shtml Thanks
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
Java - Opening a url in new window from an applet
Java - Opening a url in new window from an applet  ... how to open a new window from an applet. You can use the code given... will open new browser window and then show you the web page. Opening a new
swing application to import a object in a excel
swing application to import a object in a excel  Hi sir, I want to make a swing application where I can import a object in a cell of a excel... 'create from file' window>browse (this browse path I want to give inside the swing
Chess Application In Java Swing
.style1 { margin-right: 0px; } Chess Application In Java Swing       In this section, you will learn how to create chess game in java swing
SMS Receiving JAVA application from GSM modem
SMS Receiving JAVA application from GSM modem  Hey does any one having SMS reeving JAVA application
java swing.
java swing.  Hi How SetBounds is used in java programs.The values in the setBounds refer to what? ie for example setBounds(30,30,30,30) and in that the four 30's refer to what
swing - Java Beginners
Swing application testing  What are the conventions for testing a Java swing application
steps to create desktop application in java swing using eclipse with drag and drop options
steps to create desktop application in java swing using eclipse with drag and drop options  please help to create desktop application in java swing using eclipse with drag and drop and what are the plugins required
Mantain a Session in one application after opening another third party application - JSP-Servlet
Mantain a Session in one application after opening another third party... up a third party application in another widow., and session in the current application has be maintained until third party application is explicitly ask's
Java swing
Java swing  Write a java swing program to calculate the age from given date of birth
How to link an excel file with the application software using java swing
How to link an excel file with the application software using java swing  I have to link an excel file with a application software which I am... that are in the excel file (like extracting the questions from the excel file
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am... that are in the excel file (like extracting the questions from the excel file
How to link a excel file with a application software using java swing
How to link a excel file with a application software using java swing  I have to link an excel file with a application software which I am... that are in the excel file (like extracting the questions from the excel file
Combobox application - Swing AWT
Combobox application  hi, i am facing a problem in updation of the comboboxes i m using in an application...for the first time the selectec item does... function...please suggest...  Is it Swing ? If not using
java swing - Swing AWT
java swing   Iam developing a java web browser.Actually my code works fine ie. i can load a web page without proxy.But in my place i have only proxy... a proxy or how to make my java web browser to listen to proxy setting??? please help
Unable to open Java in full screen mode in Vista - Java Beginners
Unable to open Java in full screen mode in Vista  Hi iam facing a serious problem as my operating system is Windows-Vista.The editor always opens in minimized mode.If i try Alt+enter it shows win32 error.i googled it and found
Swing Application help
Swing Application help  Hi am developing an application. I have set up an ADD button, which if clicked should open the add information form...;Here is a swing application that will insert the form data into database
XML- read Text Mode - Java Error in Windows - reg. - Java Beginners
XML- read Text Mode - Java Error in Windows - reg.  Dear All I'm creating the code as read the XML file in BufferedReader method. Here I pasted the code below:. (*) First read the XML file using FileInputStream
iPhone landscape mode
and you will find that your iphone application is opening in landscape mode... iPhone landscape mode In this series of iPhone application development tutorial, you'll learn launching your iPhone app in landscape mode. Believe me
JAVA SCRIPT CODE FOR OPENING A WEBSITE IN A NEW WINDOW - Java Beginners
JAVA SCRIPT CODE FOR OPENING A WEBSITE IN A NEW WINDOW   PLS TELL ME? HOW CAN I DEFINE A WINDOW.OPEN FUNCTION WITHIN ANOTHER FUNCTION e.g IF THERE ARE THREE FIELDS OF A FORM, AND AFTER CKECKING THAT ALL THE FIELDS HAVING
Opening Notepad
Opening Notepad  Sir/madam I want to open notepad from java applications and save the contents on it. Can someone please help me to do...}; Runtime.getRuntime().exec(commands); }   Java Create
java swing - Swing AWT
java swing  how i can insert multiple cive me exampleolumn and row in one JList in swing?plz g  Hi Friend, Please clarify your question. Thanks
java swing
java swing  view the book details using swing
Java swing
Java swing  Does Swing contains any heavy weight component
Java swing
Java swing  what are the root classes of all classes in swing
java swing
java swing  what is java swing   Swing is a principal GUI toolkit for the Java programming language. It is a part of the JFC (Java Foundation Classes), which is an API for providing a graphical user interface for Java
 

 

 

DMCA.com