Using Swing Components in JSP

Hi,
I regret that I do not have a very specific problem here. However, I am wondering if there is a way to display Swing components, such as a panel, on a web page using JSP. If so, are there any tutorials on such a practice? Or would something like this be included in a general tutorial?
Thanks,
Dan

You'll have to use a JApplet.

Similar Messages

  • I can't use swing components in my applets

    When I write an applet without any swing components, my browser never has any trouble finding the classes it needs, whether they're classes I've written or classes that came with Java. However, when I try to use swing components it cannot find them, because it is looking in the wrong place:
    On my computer I have a directory called C:\Java, into which I installed my Java Development Kit (so Sun's classes are stored in the default location within that directory, wherever that is), and I store my classes in C:\Java\Files\[path depends on package]. My browser gives an error message along the lines of "Cannot find class JFrame at C:\Java\Files\javax\swing\JFrame.class"; it shouldn't be looking for this non-existent directory, it should find the swing components where it finds, for example, the Applet class and the Graphics class.
    Is there any way I can set the classpath on my browser? Are the swing components stored separately from other classes (I'm using the J2SE v1.3)?
    Thanks in advance.

    Without having complete information, it appears that you are running your applets using the browser's VM. Further, I assume you are using either IE or Netscape Navigator pre-v6. In that case, your browser only supports Java 1.1, and Swing was implemented in Java 1.2. You need to use the Java plug-in in order to use the Swing classes (see the Plug-in forum for more information), or else download the Swing classes from Sun and include them in your CLASSPATH.
    HTH,
    Carl Rapson

  • Swing components in jsp

    Hi,
    can we use swing components on web applications? for example getting resultset from a query and displaying it with jtable??

    And don't ever try to incorporate Swing or AWT classes in serverside code, you're in for some nasty surprises.
    At one point someone in a team I was in used some AWT code which worked just fine on his PC when testing there, but refused steadfastly on the production server.
    Turned out that class under the hood checked for the existence of videohardware (well, it's AWT which is meant to be used for graphical output even if this class was just a helper for something or other...) and the server of course lacked both a videocard and a screen.

  • Can I Use Swing Components in a JSP Page

    Hi,
    Can I use Swing Componnents in a JSP Page.If so,Can anybody provide with a sample code.
    Thanks.

    hi,
    I wanted to use the JTabbedPane for tab buttons in my
    Jsp Page.Is that possible?I am afraid that you can't.
    As for GUI (graphics) in the HTML page you can use only the html form elements (but you should simulate other behaviours by dynamically reloading the page).-
    Ionel.

  • How to use Swing Components in  JavaFX

    Hi All,
    I am new to JavaFx. I am trying to use java swing components in javafx.
    I found a sample program in net and tried it. But it shows compile time error.
    Code:
    MySwingComponent .fx
    import javafx.ext.swing.SwingComponent;
    import javax.swing.JComponent;
    import javax.swing.JButton;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    * @author nandha
    class MySwingComponent extends SwingComponent{
    var button: JButton;
    public var text: String on replace {
    button.setText(text);
    public var action: function();
    override protected function createJComponent () : JComponent {
    button = new JButton();
    button.addActionListener(ActionListener {
    public override function actionPerformed(e:ActionEvent){
    action();
    return button;
    The above code shows no error.
    Test SwingButton.fx
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import swingcomponents.MySwingButton;
    * @author nandha
    Stage {
    title: "Swing Button Example"
    scene: Scene {
    width: 250
    height: 80
    content: [
    MySwingButton{  // error message: imcompatible type. found MySwingButton. Required javafx.scene.Node[]
    text: "Click Me!"
    action: function(){
    println("Hello World!");
    This code which used the MySwingButton shows error: imcompatible type. found MySwingButton. Required javafx.scene.Node[] - where i have added the MySwingButton.
    Please help me to fix the error.
    Thanks &Regards,
    Nandha K

    Hi Sasa,
    First thanks for your reply.
    I found the problem and have fixed.
    Problem:
    There is no class MySwingButton in the package swingcomponents. Its MySwingComponent that i should have used, which is a big mistake that i have done. To my surprise i don't know NetBeans didn't show any error message at that line.
    Thanks & Regards,
    Nandha K

  • Using swing elements in JSP pages

    I am developing a web application using jsp pages. In this application i want to display some information in a seperate window. For this i created a class which extends JFrame. This class makes also use of the singleton principle.
    In the jsp i use the following code (singleton class is called Statistics.class:
    <%
    /** statswindow try
    JFrame eTAFframe = Statistics.getInstance();
    eTAFframe.pack();
    eTAFframe.setLocation(485, 420);
    eTAFframe.setVisible(true);
    /*end statswindow try */
    %>
    After deployting the application on an Iplanet Application Server this code does create a window displaying the right information. The problem is that it opens this windows on the system i used to deploy the application and not on the machine requesting the jsp page.
    Question:
    How do you get this window to be displayed on the requesting machine, preferably without using an applet approach?
    Any code examples showing the use of swing elements in jsp pages are welcome.

    I understand the desire to not use an applet. Have you tried an html pop-up? This will create a separate http request through to your server on the user's same session. This allows your server to do the required processing to display the data to the user via html.
    Use the target="_blank" attribute of the anchor tag, or a window.open JavaScript method.

  • How to implement hyperlink in java using swing components

    hi.....
    pls help me to find out solution
    how to implement hyperlink in java using swing components

    I've got the same problem here.
    I want to implement a HyperlinkListener to a JLabel. (Unlike suggested above, it is only supported by JEditorPane and not JLabel)
    The goal is, that if a user clicks on a Link in a JLabel, the standard browser opens and displays that page.
    Can somebody please help?
    My ultimate goal would be to also be able to add clickable HyperLinks in ToolTip texts, but i guess that'd be even more complicated.

  • New - can't use Swing components????

    I downloaded jdk-1_1_8_009-win.exe and installed and I'm merrily learning Java - except I don't have the javax.swing.* classes in this download (when I look in \lib\classes.zip).
    I have repeatedly tried downloading the SDK 1.3.1 and Java Foundation Classes (JFC), but all I get is Page Not Found over and over.
    This is getting freaking frustrating. What am I supposed to do? All I'm trying to do is create a JFrame with a JButton, and continue from there. Why isn't the Swing stuff in their latest JDK download?
    Thanks for reading a dumb question from a beginner!

    Why isn't the Swing stuff in their latest JDK download?It is! The problem is that you downloaded an obsolete JDK version (1.1.8), and javax.swing did not appear until version 1.2.
    What am I supposed to do? Download the lastest version of the SDK.
    http://java.sun.com/j2se/1.4/download.html

  • Grid abck layout problem using swing components

    JScrollPane jsp1 = new JScrollPane(table1,k,i);
    JPanel ja = new JPanel();
    JCheckBox c1 = new JCheckBox();
    JCheckBox c2 = new JCheckBox();
    JCheckBox c3 = new JCheckBox();
    JLabel j = new JLabel("Button");
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    ja.setLayout(gbl);
    gbc.gridwidth = 10;
    gbc.gridheight = 10;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbl.setConstraints(j,gbc);
    add(j);
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbl.setConstraints(c2,gbc);
    add(c2);
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbl.setConstraints(c3,gbc);
    add(c3);
    gbc.gridx = 3;
    gbc.gridy = 3;
    gbl.setConstraints(jsp1,gbc);
    add(jsp1);
    this my code for grid bag layout but when i run this code it is showing only empty panel..no components..
    of course iam not posting entire code of tis class..because it is lenghty..
    regards,
    sam

    Well, you set JPanel ja's layout to GridBagLayout, but it appears your adding the components to the parent, eg. add(j) should be ja.add(j) if you want it on JPanel ja. This is true for all your component adds.
    By the you can combine the setConstraints( ) and add calls: ja.add(j, bgc);
    Hope that helps.
    Cheers
    DB

  • Can i use swing under JSP?

    i have a JSP, now my question is, can I display swing components under JSP?

    A JSP is just a way to write HTML back to browser.
    It is a mix of HTML and java.
    A JSP is converted to a java source file, with code like:
    out.println(".... HTML code you wrote ...");In this way a java application writes back to the client browser on a page request.
    A totally different mechanism are either a java applet (embedded in an HTML page),
    or Java WebStart, which distributes entire java applications via the net.
    If you are familiar with Swing, or have an existing Swing application, or need a
    user friendly GUI, those are the ways.

  • Jre 15.0_22/Linux - Swing components error when using GTKLookAndFeel

    Hello,
    I'm not sure if it's a JRE bug or what, but on Linux platforms our applet fails when using swing components using the GTKLookAndFeel.
    To demonstrate/test, I have the ff test applet:
    import java.applet.Applet;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;
    public class TestApplet extends Applet {
      @Override
      public void init() {
        super.init();
        test();
      public static void main(String[] args) {
        (new TestApplet()).test();
      public void test() {
        try {
          String className = UIManager.getSystemLookAndFeelClassName();
          System.out.println(className);
          javax.swing.LookAndFeel laf = (javax.swing.LookAndFeel) this.getClass().forName(className).newInstance();
          UIManager.setLookAndFeel(laf);
          System.out.println("setting classloader");
          UIManager.put("ClassLoader", this.getClass().getClassLoader());
          UIManager.getLookAndFeelDefaults().put("ClassLoader", this.getClass().getClassLoader());
        } catch (ClassNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (InstantiationException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (IllegalAccessException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (UnsupportedLookAndFeelException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        System.out.println(UIManager.getLookAndFeelDefaults().getUIClass("javax.swing.JTextField"));
        UIManager.getLookAndFeelDefaults().getUI(new javax.swing.JTextField());
    }The system look and feel here is GTKLookAndFeel. The problem is that the getUI() call in the last line is returning null and I can see in the console:
    UIDefaults.getUI() failed: no ComponentUI class for: javax.swing.JTextField
    java.lang.Error
    .. etc.
    This is happening for different swing classes, I just used JTextField here as a simple test case.
    This only happens if the applet is run from the browser (via the java plugin). If I run the above code from the command line, there is no error raised, and the actual component UI class is a Synth class.
    This is only happening for us in Java 1.5.0_22 on Linux...on 1.5.0_15 and 1.6+ it seems to be fine. I'm using the 1.5.0_22 JDK downloaded from Sun.
    Anyone have any idea how to fix this error or any workaround? As you can see in the code above, I tried specifying the classloader (I read it in some other thread on these forums), but no luck there.
    Or is this a known problem in 1.5.0_22? Can anyone else replicate it?

    Installation howto you can find on http://www.puschitz.com
    Try use "Search" function before you create new topic. This one was discussed many times.

  • Using swing in Full screen sxclusive mode

    Hi!
    I have created a game which uses swing components.... I have decieded (because it is much cool, and looks nicer) to convert the game to Full screen mode....
    Mycurrent GUI consists of two JPanel s. One of which I use the paintComponent method to draw the game board to the JPanel. The other JPanel is split into several other parts which contain the details about each player.
    Now, what I want to do is to be able to update the graphics using a BufferStrategy. My question is how would I do this? I tried to create a eperate BufferStrategy for the "Board" JPanel, but I can't as JPanel doesn't support getBufferStrategy(). Then I tried to convert the whole "Board" into Canvas. This I could implemnt but as I rendered the image it was drawn over the second JPanel which is to the right of the "Board"
    I was thinking that maybe I could create a FlipBufferStrategy but it's protected and cannot be instantiated in a JPanel.
    So what I'm basically asking is how do you use swing components in Full Screen Exclusive mode and using active rendering?
    For dukes go to http://forum.java.sun.com/thread.jsp?forum=57&thread=394856&tstart=15&trange=15

    Hi,
    in case you don't already know it, here's Suns very own tutorial on that topic:
    http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html
    JPanel does not support getBufferStrategy() but JFrame (or any other subclass of Window) does. So you could put your JPanel into a JFrame and gain access to the BufferStrategy that way.
    Keep in mind that there is still a serious bug in createBufferStrategy() that can result in a deadlock. Browse the Bug Database for a workaround, I can't find it now, but I know that it is there.
    Last but not least you could post in the Swing Forum, which would be a more suitable place for a Swing question than the Java3D Forum :)
    Regards
    Fleischer

  • Swing components not displaying correctly in JApplet

    Hello everyone,
    I have experienced some strange problems using Swing components on JApplets. Maybe I missed some documentation somewhere and someone can help me out.
    The problem is that when I add components like JButtons,
    JCheckboxes, JRadioButtons, JTextFields, JPasswordFields,
    and JComboBoxes to JApplets, when I view the applet, the
    component does not become visible until I move the mouse
    pointer over it in the case of buttons. For the JComboBox I have
    to hit the mouse key many times on the component to see the list. Has anyone experienced problems like these? Thanks.
    Keith

    check what is in ur paint(Graphic g) method. if it does nothing, remove the paint(Graphic g) method. if it has some codes, double check ur codes.

  • Characters show up as boxes when using AWT components.

    Having installed on a Windows XP english OS the asian languages packs (with fonts included, from Microsoft) and knowing that with MS Gothic, Gulim and Simsun you can display japanese, korean and chinese characters it seems that on JRE 1.5 and up this is not possible (boxes appear instead) on any applet.
    How to reproduce:
    Label l2 = new Label("Japanese chars: \u8457\u4f5c\u6a29");
    Workaround:
    Step 1. Rename ..\jre\lib\fontconfig.properties.src to &hellip;&hellip;\fontconfig.properties
    Step 2. Modify the following line:
    sequence.allfonts=alphabetic/default,dingbats,symbol
    to
    sequence.allfonts=alphabetic/default,dingbats,symbol,japanese,chinese-ms936,chinese-ms950,korean
    How is this possible? On JRE 1.4 this was working. Also another fix is to use Swing components instead but this is not realistic for a big project.
    Any help will be greatly apprecied.

    The problem is related to the JRE v. 1.5.0_11 or greater. In JRE 1.4.2_13 for each language there was a configuration file that Java was using to determine which fonts to use for different categories of objects.
    The problem is encountered only for AWT components.
    Starting with JRE 1.5 (http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html) there is only one configuration file (fontconfig.properties.src) for all the languages. Since the character subsets supported by given fonts often overlap, in the file separate search sequence properties are used to define in which order to try the fonts when rendering a character. In the default version of the file this properties do not specify also the asian languages.
    We have to do the following things:
    *1.* You must first install into Windows the support for asian languages: Control Panel - > Regional and Language Options
    � On the Advanced tab add the conversion tables for all Asian languages (this action may not be required).
    � On the Languages tab check �Install files for East Asian Languages (this action is required)
    Restart the computer.
    *2.* Assure you have the needed asian fonts : batang(fopr korean), simsun, gulim, mingliu, msgothic(for japanese) installed.
    *3.* Rename ...\jre\lib\fontconfig.properties.src to ��\jre\lib\fontconfig.properties. By doing this the fontconfig.properties file will be used by the JRE as the default configuration file.
    *4.* Modify the following line:
    sequence.allfonts=alphabetic/default,dingbats,symbol
    to
    sequence.allfonts=alphabetic/default,dingbats,symbol,japanese,chinese-ms936,chinese-ms950,korean
    *5.* Assure that in the file the logical to physic font binding, binds to existing fonts.
    Obs: If step 1 is skipped the titles of the windows will still have boxes.
    Hope it helps.
    Donoiu Cristian

  • Swing components and Mac OS/9

    Hi all,
    I 've developped an app using swing components (Simple app using a hsqlbd database) and i read that it was kind of possible to port it on a mac os/9.
    I had a look on the net, on the apple site, without any luck as how to "add" swing library on the mac os/9.
    If someone could point me to the right direction (Web site, book etc), I 've been looking for a while without finding any clear and precise info on how to tackle this kind of problem.
    Thanks in advance.

    As per my knowledge, u can use JJEdit editor on MAC OS X. By using this editor, you can run the applets. Here I am using JJEdit as a java editor on MAC OS X. just dowload the JJEdit. and run the applet on it.
    regards
    nr konjeti

Maybe you are looking for

  • How do i see responses to a question that i have posted

    i posted an issue earlier today and i am do not see it on any forums. what is the best way to find my question and any responses?

  • Connect to secure LDAP server from iWS 4.1

    I am trying to connect to a secure LDAP server that is expecting client authentication. I installed a client cert (provided by the LDAP admin) on the iWS admin server, and I can search/view user records housed on the LDAP server. However, when I try

  • How to learn Webdynpro online

    Hello, I would like to learn webdynpro online. Like is there any link through which I can learn. Like is there any possibility to download and install a component and start doing the programming. Please help me providing some relevant information. th

  • Problem in restarting the services in Hyperion 11.1.1.3

    Hi All, We are unable to restart the Hyperion Integration services in 11.1.1.3 version after the configuration. Also we are unable to find the exact log file which shows the error. Kindly guide us whether any specifis log file has to be seen or the c

  • MOV to Apple TV error

    When trying to convert a 1GB MOV file to Apple TV I get an error message "Failed: qtKitErrorCtachall (-50) The MOV file has been successfully cvonverted to other formats. Can this be fixed?