How to display .swf files in java using eclips platform ???
Here my java code plz some one help me...
import javax.swing.*;
import java.io.*;
import java.net.MalformedURLException;
import java.awt.*;
import java.awt.event.*;
public class DisplaySWF extends JFrame
public JPanel window_panel;//address_panel,
public JLabel address_label;
public JTextField address_tf;
public JEditorPane window_pane,tree_pane,attr_pane;
public JScrollPane window_scroll,tree_scroll,attr_scroll;
TextArea t1,t2;
JPanel pane;
public JButton address_b, browse;
public JLabel l,m;
private Go go = new Go();
JFrame f ;
public DisplaySWF() throws IOException
// Define address bar
//tree_pane=new JEditorPane();
//tree_pane.setBounds(650,50,300,250);
//address_panel = new JPanel();
//address_panel.setLayout(null);
f= new JFrame("Web browser");
f.setSize(1000,700);
pane=new JPanel();
pane.setVisible(true);
pane.setLayout(null);
f.setContentPane(pane);
address_label = new JLabel(" address: ", SwingConstants.CENTER);
address_label.setBounds(10, 10, 70, 30);
pane.add(address_label);
address_tf = new JTextField("",25);
address_tf.setBounds(80,10,250,30);
pane.add(address_tf);
browse = new JButton("Browse");
browse.setBounds(340, 10, 140, 30);
browse.addActionListener(go);
pane.add(browse);
window_pane=new JEditorPane();
window_pane.setBounds(10, 50, 600, 600);
pane.add(window_pane);
l=new JLabel("DOM Structure");
l.setBounds(650,30,100,10);
pane.add(l);
t1=new TextArea();
t1.setBounds(650,50,300,250);
pane.add(t1);
m=new JLabel("Attribute");
m.setBounds(650,350,100,10);
pane.add(m);
t2=new TextArea();
t2.setBounds(650,380,300,280);
pane.add(t2);
f.setVisible(true);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window_pane = new JEditorPane("http://www.yahoo.com")
public boolean getScrollableTracksViewportWidth()
return true;
public class Go implements ActionListener
public void actionPerformed(ActionEvent ae)
JFileChooser fc = new JFileChooser();
int result = fc.showOpenDialog(null);
if (result == JFileChooser.APPROVE_OPTION)
File file = fc.getSelectedFile();
String sname = file.getAbsolutePath();
address_tf.setText(sname);
String ext=getFileExtension(sname);
try
if(ext.equals("swf"))
window_pane.setPage(address_tf.getText());
System.out.println("hi");
catch (MalformedURLException e)
{ // new URL() failed
window_pane.setText("MalformedURLException: " + e);
catch (IOException e)
{ // openConnection() failed
window_pane.setText("IOException: " + e);
public String getFileExtension(String filename)
if (filename == null)
return null;
int lastUnixPos = filename.lastIndexOf('/');
int lastWindowsPos = filename.lastIndexOf('\\');
int indexOfLastSeparator = Math.max(lastUnixPos, lastWindowsPos);
int extensionPos = filename.lastIndexOf('.');
int lastSeparator = indexOfLastSeparator;
int indexOfExtension = lastSeparator > extensionPos ? -1 : extensionPos;
int index = indexOfExtension;
if (index == -1)
return "";
else
return filename.substring(index + 1);
public static void main(String args[]) throws IOException
DisplaySWF wb = new DisplaySWF();
Thanks for reply...
but i search in the google about this topic...there is no results will appear..
the problem is "i have to run program in the MacOS like extract all the
.sit(StuffIt) extension files. These sit files same as zip files in the windows... we have one tool called StuffIt Expander but it is 3rd party tool. but here requirement is i have to write my own program to extract all the files same as zip file program...
please do the needful..i am waiting for ur reply,,,
Similar Messages
-
How to display swf Files and have a datagrid with paging for javaFX
is there any example of javaFX which can display swf files or have a datagrid with paging.
sorry for my bad english and by the way i am new to javaFX
any help wil be appreciatePlease, refrain from posting identical messages in several forums. Thanks.
And I doubt JavaFX can display SWF files (it is a concurrent technology, after all! :-)), unless using some JNI/JNA technology (via JDIC? a long way...).
Datagrid: it is expected in next version (hopefully), there are some implementations around (look for CRUDfx, for example). -
How to display pdf file with java code?
Hi All,
i have a jsp pagein that page if i click one icon then my backing bean method will call and that method will create pdf document and write some the content in that file and now i want to display that generated pdf document.
it should look like you have pressed one icon and it displayed pdf file to you to view.
java code below:
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ec = fc.getExternalContext();
HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
resp.setHeader("Content-Disposition", "filename=\"" + temppdfFile);
resp.encodeRedirectURL(temppdfFile.getAbsolutePath());
resp.setContentType("application/pdf");
ServletOutputStream out = resp.getOutputStream();
ServletUtils.returnFile(temppdfFile, out);
out.flush();
and above temppdfFile is my generated pdf file.
when i am executing this code, it was opening dialog box for save and cancel for the file, but the name of the file it was showing me the "jsp file name" with no file extention (in wich jsp file i am calling my backing bean method) and type is "Unknown File type" and from is "local host"
it was not showing me open option so i am saving that file then that file saved as a pdffile with tha name of my jsp file and there is nothing in that file(i.e. empty file).
what is the solution for this. there is any wrong in my code.
Please suggest me.
Thanks in advance
Indirapublic Object buildBarCodes() throws Exception
File bulkBarcodes = null;
String tempPDFFile = this.makeTempDir();
File tempDir = new File("BulkPDF_Files_Print");
if(!tempDir.exists())
tempDir.mkdir();
bulkBarcodes = File.createTempFile
(tempPDFFile, ".pdf", tempDir);
//bulkBarcodes = new File(tempDir, tempPDFFile+"BulkBarcode"+"."+"pdf");
if(!bulkBarcodes.exists())
bulkBarcodes.createNewFile();
Document document = new Document();
FileOutputStream combinedOutput = new FileOutputStream(bulkBarcodes);
PdfWriter.getInstance(document, combinedOutput);
document.open();
document.add(new Paragraph("\n"));
document.add(new Paragraph("\n"));
Image image = Image.getInstance(bc.generateBarcodeBytes(bc.getBarcode()));
document.add(image);
combinedOutput.flush();
document.close();
combinedOutput.close();
FacesContext facesc = FacesContext.getCurrentInstance();
ExternalContext ec = facesc.getExternalContext();
HttpServletResponse resp = (HttpServletResponse) ec.getResponse();
resp.setHeader("Content-Disposition", "inline: BulkBarcodes.pdf");
resp.encodeRedirectURL(bulkBarcodes.getAbsolutePath());
resp.setContentType("application/pdf");
resp.setBufferSize(10000000);
ServletOutputStream out = resp.getOutputStream();
ServletUtils.returnFile(bulkBarcodes, out);
out.flush();
return "success";
This is my action method which will call when ever i press a button in my jsp page.
This method will create the barcode for the given barcode number and write that barcode image in pdf file
(i saw that pdf file which i have created through my above method, This PDF file opening when i was opening manually and the data init that is also correct means successfully it writes the mage of that barcode)
This method taking the jsp file to open because as earlier i said it was trying to open unknown file type document and i saved that file and opended with editplus and that was the jsp file in which file i am calling my action method I mean to say it was not taking the pdf file which i have created above it was taking the jsp file -
How to display XML file in java swing
hi all
now i do my M.Sc., project on data maining.this time i have one problem,thats i can't display XML file in swing frame.so any one know this plz give me that idea or code.
Thanks to all.
RSKOne way of doing that is to use JDOM...
u create an xml tree, and then output using XMLOutputter class...it will be displayed in text...im not sure if thats what u want...however, if u do want to represent it visually then u may need to draw a tree...u may use the Graphics2D for that...there are alot of ways to do such thing, and the 2 possibilities arent the best...depends on what u want...elaborate more pls. -
How to display RTF File in Browser Using Servlets/JSPs
Hi All,
I have some RTF Files, which contains some data.
The data needs to be displayed in the frame of jsp page .
How i can display the RTF File Content using either servlets/jsps
Can any body have idea on this.
Help me out on this.
With Regards
HariIf you only need to display it, consider your HttpServletRequest just as byte stream. :) Just read from ServletInputStream and write it back into ServletOutputStream of HttpServletResponse.
If you want to process incoming XML, please give some details first, what exactly you want to do. :) -
How to display XML file in browser using Servlets?
Hi My XML file is like this:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:purchase_order_MT xmlns:ns0="http://filetohttp.com">
<ORDER_HEADER_IN>
<purchase_date/>
<purchase_group/>
<purchase_org/>
</ORDER_HEADER_IN>
<vendor/>
<ORDER_ITEMS_IN>
<item>
<storage_location/>
<plant/>
<quantity/>
<material/>
</item>
</ORDER_ITEMS_IN>
<ORDER_SCHEDULES_IN>
<item>
<delivery_date/>
</item>
</ORDER_SCHEDULES_IN>
</ns0:purchase_order_MT>
My Servlet receives this XML file and it should display the above XML as it is, How to do that?
Please help me I have posted same question in many forums but i got no proper reply.
Thanks a lotIf you only need to display it, consider your HttpServletRequest just as byte stream. :) Just read from ServletInputStream and write it back into ServletOutputStream of HttpServletResponse.
If you want to process incoming XML, please give some details first, what exactly you want to do. :) -
How To Read RTF file in JAVA? Using iText?
How To Read RTF file in JAVA? Using iText?.....
import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.rtf.*;
public class RTF3 {
public static void main(String[] args) {
// System.out.println("This example generate a RTF file name Sample.rtf");
// Create Document object
Document myDoc = new Document();
try {
// Create writer to listen document object
// and directs RTF Stream to the file Sample.rtf
RtfWriter2.getInstance(myDoc, new FileOutputStream("Sample.rtf"));
// open the document object
myDoc.open();
// Create a paragraph
Paragraph p = new Paragraph();
p.add("Helloworld in Rtf file..amazing isn't");
// Add the paragraph to document object
myDoc.add(p);
catch(Exception e) {
System.out.println(e);
//close the document
myDoc.close();
Exception in thread "main" java.lang.NoSuchMethodError: com.lowagie.text.Rectangle.width()F
at com.lowagie.text.rtf.document.RtfPageSetting.rectEquals(RtfPageSetting.java:433)
at com.lowagie.text.rtf.document.RtfPageSetting.guessFormat(RtfPageSetting.java:362)
at com.lowagie.text.rtf.document.RtfPageSetting.setPageSize(RtfPageSetting.java:341)
at com.lowagie.text.rtf.RtfWriter2.setPageSize(RtfWriter2.java:248)
at com.lowagie.text.Document.open(Unknown Source)
at view.RTF3.main(RTF3.java:23)
CAN you HELP me?import com.lowagie.text.Document;
import com.lowagie.text.rtf.parser.RtfParser;
import java.io.FileInputStream;
String inputFile = "sample.rtf";
Document document = new Document();
document.open();
RtfParser parser = new RtfParser(null);
parser.convertRtfDocument(new FileInputStream(inputFile), document); -
How to extract .sit files(in MAC) using java program
Hi,
please help me , i want to simple program for
" how to extract .sit files(in MAC) using java program"
that sit files same as zip files in windows..[Thanks for reply...
but i search in the google about this topic...there is no results will appear..
the problem is "i have to run program in the MacOS like extract all the
.sit(StuffIt) extension files. These sit files same as zip files in the windows... we have one tool called StuffIt Expander but it is 3rd party tool. but here requirement is i have to write my own program to extract all the files same as zip file program...
please do the needful..i am waiting for ur reply,,, -
How to view pdf file in java/jsp?
Hello Everybody,
Any one help me how to view pdf file in jsp using java application.
I have pdf file c:\app.pdf.
How can i display the pdf file.
Please help me.................
ThanksHello,
You can use the below code, but i am not sure how far is this a startard way of doing it.
# <%
# ServletOutputStream servletOutputStream = response.getOutputStream();
# File reportFile = new File("C:\\Tomcat 5.0\\webapps\\TestApp\\myfile.pdf");
# FileInputStream fis = new FileInputStream(reportFile);
# byte[] bytes= new byte[128000];
# int count=fis.read(bytes);
# try
# response.setContentType("application/pdf");
# response.setContentLength(bytes.length);
# servletOutputStream.write(bytes, 0, bytes.length);
# servletOutputStream.flush();
# servletOutputStream.close();
# }catch(Exception e){} -
How to display Pdf file in iPad site
Hi
How to display Pdf file in web page which can able to view in iPad safari?
Thanks,
ArunYou can't really.
You need to use DHTML in the swf-wrapper HTML file, usually a
division wrapped iFrame, and load the PDF into the iFrame as an
overlay to the Flash. -
How to display Doc file format in the JEditPane?
At this time , JEditPane supports RTF and HTML file format ,but
Could anyone tell me how to display DOC file format using JEditPane
or other JTextComponents?
Thx a lot!
CatonHi,
there is no support for doc files (M$ Word?) in Java. You would have to create your own classes for that eventually subclassing JEditorPane, EditorKit, Document etc. As well you'd need your own reader for the doc format.
The problem I see with that however is that there is nothing such as thedoc file format. Microsoft just saves anything produced by MS Word into files ending with .doc. But, if there is anything such as a .doc file format, it changes more often than the weather in April.
Ulrich -
How to display flash file in adf pages
how to display flash file in adf pages need help
Thanks all,
It is resolved.
the code i am using to display a flash is below.
<f:verbatim>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version
=10,0,0,0" width="300" height="300" id="11gR1_aniH_grey" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="false" />
<param name="wmode" value="transparent" />
<param name="movie" value="mx2004demo.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#4d5c64" />
<embed src="../Images/mx2004demo.swf" quality="high" width="300" height="300" name="mx2004demo.swf" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false"
type="application/x-shockwave-flash" wmode="transparent"
pluginspage="http://www.adobe.com/go/getflashplayer" />
</object>
</f:verbatim> -
How to run ear file in java application server
i want how to run .ear file in java application server
1. i m created ear file
2. i m created jar file (bean,home,remote)
3.i m created war file(in the form of jsp)
but till now i couldnt run ear file
how to run
please hel meYou must create :
1.Jar file
2.War file
And then put them into an ear file
Exemple : myapp.ear contains
myappEJB.jar
myappWEB.war
META-INF/application.xml
and application.xml looks like this :
<application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
<display-name>myapp</display-name>
<description>Demo application</description>
<module>
<ejb>myappEJB.jar</ejb>
</module>
<module>
<web>
<web-uri>myappWAR.war</web-uri>
<context-root>/myapp</context-root>
</web>
</module>
</application>Good luck -
Can we integrate .swf file in java script ?
Hello Friends,
We implemented one concept in Flex and now would like to integrate with JavaScript. Earlier we integrated an Applet code but now, we developed the concept in Flex, however, I am unable to integrate the concept in java script.
Can anyone help me out with the procedure to integrate flex swf file in java script ?
Here is my earlier java script code :
var file=gup('query');
//document.write(file);
var prevFile=gup('prevFileName');
//document.write(prevFile);
document.write("<table align=\"center\"><tr><td><applet code=\"MyApplet.class\" archive=\"Visual.jar\" width=1000 height=500>");
document.write("</applet></td></tr></table>");
function gup( name )
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
Thanks in advance.What version of FlashPro are you using? If you want a self contained app that doesn't load external resources, publish an AIR app, which will work on Windows or OSX. I'm using OSX so I can't really help with .exe projector files, but it looks like the latest version of FlashPro no longer outputs projector files—I think everything is AIR now.
If you really want to go the projector route, I'm guessing Jeffrey Smith's suggestion of finding an older version of Flash Player would be simpler.
So for AIR, set your Publishing target to AIR for Desktop. Then under File>AIR settings:
Output as: Application with runtime embedded
Include files: Add all of your resources—the swf ID generated and it's resource folder
In the Signature tab click New to create a self-signing Certificate (if you were developing commercial software you would need a third party certificate). You can save the certificate anywhere.
When you publish you should find an AIR application file (.app) file in the directory with your .fla -
How to display XSL file to ASPX in dreamweaver
Hi,
Just wondering how to display XSL file in ASPX page?
I normally do it in ASP page by using server behaviour XSLT transformation and bind it to ASP page and this works very well.
Now I am trying to use the same method and using ASPX page this time but this time there is no option from server behaviour where I can bind it to my ASPX.
Can someone help or perhaps let me know where I can find the information how to do it?
Thanks,
Rush OYou mean you want to see the XML source?
You need to replace the characters '<' and '&' with corresponding entities '<' and '&'. You can use replaceAll, but do the ampersands first.
Then I suggest you probably want to put them in a <PRE> block.
Maybe you are looking for
-
Integration of SAP MI 7.1 and SAP PI 7.1 on the same Server
Hi dear SAP Community, Does anyone know, if it's possible to use MI 7.1 and PI 7.1 on one server to create a big Enterprise Service Bus? Thank you! Best Regards Philipp
-
Can we use GPO for FireFox 3.6.8 on windows 7 systems
Our GPO's control our firefox settings on windows xp systems but not windows 7 64 bit.
-
Ihave abouy 4-5 different user IDS and passwords that I have to juggle to get access to the Apps store. Almost every time I try to get an update, etc., I have to go through the routine of either changing both user ID and password, or just the passwor
-
Apex takes lot of time to load data
Hi, I am trying to load data from a comma seprated file to APEX using data load/unload. Every time i try to load it breaks or it takes long time to load the data.(When i loaded the same data using SQL manager to a SQL data base it took only few minut
-
PCI 6224 error code -88302 during self test
Hello, I'm having a problem with self testing my PCI 6224 board in my computer. I am able to run 2 different boards successfully on 2 different computers, but this computer is seeming to give me troubles. When I open NI MAX to run self test, it gives