Search in sources :

Example 1 with TrustBundlePublisher

use of org.nhindirect.trustbundle.ui.TrustBundlePublisher in project nhin-d by DirectProject.

the class ComponentCreation method createComponent.

/**
	 * Process the container pane to create different swing component as per the identifier given as parameter
	 * @param type This decide which component should be created
	 * @param labelData This is the value of a component/or can be used as title of the component
	 * @param flag This is used to make any check box or radio button selected
	 * @param c is a object of GridBagConstarins, and used to set any grid layout
	 * @param pane Container object to add component into this pane
	 * @param myButtonGroup used for radio or check boxes to group together
	 * @param gridx This is the x index integer value for the component inside the grid
	 * @param gridy This is the y index integer value for the component inside the grid
	 * @return void 
	 */
public void createComponent(String type, String lableData, boolean flag, GridBagConstraints c, Container pane, ButtonGroup myButtonGroup, int gridx, int gridy) {
    if (type.equalsIgnoreCase("RADIO")) {
        JRadioButton aButton = new JRadioButton(lableData, flag);
        c.gridx = gridx;
        c.gridy = gridy;
        pane.add(aButton, c);
        /*
			 * Button group to make the dynamic movement of screens
			 */
        TrustBundlePublisher ex = new TrustBundlePublisher();
        if (myButtonGroup != null) {
            myButtonGroup.add(aButton);
            if (lableData.equalsIgnoreCase("  Create Unsigned Trust Bundle")) {
                //UnSignedTrustBundle ex = new UnSignedTrustBundle();
                aButton.addActionListener(ex);
            } else if (lableData.equalsIgnoreCase("  Create Signed Trust Bundle")) {
                //SignedTrustBundle ex = new SignedTrustBundle();
                aButton.addActionListener(ex);
            } else {
                //ViewTrustBundle ex = new ViewTrustBundle();
                aButton.addActionListener(ex);
            }
        }
    } else if (type.equalsIgnoreCase("LABEL")) {
        JLabel label1 = new JLabel(lableData);
        c.gridx = gridx;
        c.gridy = gridy;
        pane.add(label1, c);
    } else if (type.equalsIgnoreCase("TEXT")) {
        JTextField field = new JTextField();
        c.gridx = gridx;
        c.gridy = gridy;
        pane.add(field, c);
    } else if (type.equalsIgnoreCase("PASSWORD")) {
        //JTextField field = new JTextField();
        JPasswordField passwordField = new JPasswordField(10);
        //passwordField.setActionCommand(OK);
        //passwordField.addActionListener(this);
        c.gridx = gridx;
        c.gridy = gridy;
        pane.add(passwordField, c);
    } else if (type.equalsIgnoreCase("BUTTON")) {
        JButton button = new JButton(lableData);
        c.gridx = gridx;
        c.gridy = gridy;
        pane.add(button, c);
        ButtonSelector create = new ButtonSelector(pane);
        button.addActionListener(create);
    } else if (type.equalsIgnoreCase("TEXTPANE")) {
        JTextPane jTextPane = new JTextPane();
        jTextPane.setEditable(false);
        jTextPane.setBackground(new Color(238, 238, 238));
        ;
        //jTextPane.setSize(55, 10);
        c.gridx = gridx;
        c.gridy = gridy;
        pane.add(jTextPane, c);
    } else if (type.equalsIgnoreCase("TEXTAREA")) {
        JTextArea jTextPane = new JTextArea(lableData);
        jTextPane.setEditable(false);
        jTextPane.setBackground(new Color(238, 238, 238));
        ;
        c.gridx = gridx;
        c.gridy = gridy;
        pane.add(jTextPane, c);
    }
}
Also used : JTextPane(javax.swing.JTextPane) JRadioButton(javax.swing.JRadioButton) JTextArea(javax.swing.JTextArea) JPasswordField(javax.swing.JPasswordField) Color(java.awt.Color) TrustBundlePublisher(org.nhindirect.trustbundle.ui.TrustBundlePublisher) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField)

Aggregations

Color (java.awt.Color)1 JButton (javax.swing.JButton)1 JLabel (javax.swing.JLabel)1 JPasswordField (javax.swing.JPasswordField)1 JRadioButton (javax.swing.JRadioButton)1 JTextArea (javax.swing.JTextArea)1 JTextField (javax.swing.JTextField)1 JTextPane (javax.swing.JTextPane)1 TrustBundlePublisher (org.nhindirect.trustbundle.ui.TrustBundlePublisher)1