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 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
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 modeOpening 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 AWTopening 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
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
Opening a browser only with body from a java programOpening 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
Retrieve data from database in swing applicationRetrieve 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
Threads in Java Swing MVC ApplicationThreads 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
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
catching tomcat object to swing applicationcatching 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 ApplicationSwing 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 Swing applicationSwing 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 Opening a URL from an Applet
Opening a URL
from an Applet
Introduction
This is the example of
opening a url in same... features have been used for
opening url
from an applet. This program is using two
swing application to import a object in a excelswing 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 Combobox application - Swing AWTCombobox 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
Swing Application helpSwing 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
opening new browser with new JSESSIONID using javaopening 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
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 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
Error Opening File - Java Interview QuestionsError
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
java swing - Swing AWTjava 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
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
opening new window - Java Beginnersopening 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
Java swingJava swing Write a
java swing program to calculate the age
from given date of birth
How To Pass data from one GUI to another in java swingHow To Pass data
from one GUI to another in
java swing I'm new to
java and part of our assignment is to build a GUI and display a result set
from data input. I'm stuck at how to get the user's input
from JTextFields and combobox
java swing - Swing AWTjava 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 swingJava swing what are the root classes of all classes in
swing Java swingJava swing Does
Swing contains any heavy weight component
java swingjava swing view the book details using
swing java swing - Swing AWTjava swing how to add image in JPanel in
Swing? Hi Friend,
Try the following code:
import java.awt.*;
import java.awt.image....:
http://www.roseindia.net/
java/example/
java/
swing/
Thanks
java swing - Swing AWTjava swing how i can insert in JFrame in
swing? Hi Friend,
Try the following code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class FormDemo extends JFrame {
JButton ADD;
JPanel
java swingjava 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 Changing Look and Feel of Swing Application and feel
for your
Swing Application. The look and
feel feature of
Java Swing provides more interactivity of the frame for user
application.
Swing allows... Changing Look and Feel of
Swing Application
java swingjava swing how to connect database with in grid view in
java swing
Hi Friend,
Please visit the following link:ADS_TO_REPLACE_1
Grid view in
java swing
Thanks
java swingjava swing add two integer variables and display the sum of them using
java swing