simon peter
simon peter

Reputation: 403

Using JOptionPane Dialog in XPages Project

I am new to using java for XPages development, I want to know if its posible to use JOptionPane Dialog in XPages Project? if yes how? or can i display a dialog component with Java. i tried the below code but notting happened

import javax.swing.*;

public class JOptionPaneMultiInput {
   public static void main(String[] args) {
     JTextField username = new JTextField();
     JTextField password = new JPasswordField();
     Object[] message = {
       "Username test:", username,
       "Password:", password
     };

    int option = JOptionPane.showConfirmDialog(null, message, "Login",      JOptionPane.OK_CANCEL_OPTION);

   }

}

I would like to use Java to display a dialog and save retured value in a variable

Upvotes: 0

Views: 136

Answers (1)

Steve Zavocki
Steve Zavocki

Reputation: 1840

Swing is not compatible with XPages. XPages is built on JSF and I don't believe any JSF framework supports Swing. Swing is not used for web clients, it is only used for thick clients like Windows or Mac. Xpages is made for presenting to a web browser.

Note: JOptionPane is a part of the Swing framework. You can see this in your import which likely looks like this: javax.swing.*;


UPDATE: You can definitely accomplish what you are asking. XPages is very feature packed and a great way to develop web applications. It does have a fairly steep learning curve, but thankfully there are already many great free resources out there. I would start with these two:

Upvotes: 1

Related Questions