Also this will be more useful if you are planning to execute your job as a stand alone Job.
You can create a dialog just by placing the below code in the Java Custom Code component.
class AboutDialog extends JDialog implements ActionListener {
public AboutDialog(JFrame parent, String title, String message) {
super(parent, title, true);
if (parent != null) {
Dimension parentSize = parent.getSize();
Point p = parent.getLocation();
setLocation(p.x + parentSize.width / 4, p.y + parentSize.height / 4);
}
JPanel topPanel;
JList listbox;
JPanel messagePane = new JPanel();
messagePane.add(new JLabel(message));
topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );// Create some items to add to the list
String listData[] =
{
“Item 1”,
“Item 2”,
“Item 3”,
“Item 4”
};// Create a new listbox control
listbox = new JList( listData );
topPanel.add( listbox, BorderLayout.CENTER );
//getContentPane().add(messagePane);
JPanel buttonPane = new JPanel();
JButton button = new JButton(“OK”);
buttonPane.add(button);
button.addActionListener(this);
JButton button1 = new JButton(“Double OK”);
buttonPane.add(button1);
button1.addActionListener(this);
getContentPane().add(buttonPane, BorderLayout.SOUTH);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
pack();
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Dimension screenSize = toolkit.getScreenSize();
final int x = (screenSize.width – getWidth()) / 2;
final int y = (screenSize.height – getHeight()) / 2;
setLocation(x, y);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
globalMap.put(“testdata”,e.getActionCommand());
if (e.getActionCommand() == “OK” )
System.exit(0);
setVisible(false);
dispose();
}
}AboutDialog dlg = new AboutDialog(new JFrame(), “title”, “message”);
And also dont forget to add the below lines in the advanced setting pane of the tJava component.
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JList;
import java.awt.*;
The same code can be extended to create a simple dialog to get some inut from the user and in the action listener u can code it to put the values in the global map and you can get the values from any other component from the map.