Search in sources :

Example 36 with JTextField

use of javax.swing.JTextField in project ACS by ACS-Community.

the class ScriptConfigGui method getLocationField.

private JTextField getLocationField() {
    if (LocationField == null) {
        LocationField = new JTextField();
        LocationField.setText("");
    }
    return LocationField;
}
Also used : JTextField(javax.swing.JTextField)

Example 37 with JTextField

use of javax.swing.JTextField in project ACS by ACS-Community.

the class QueryDlg method initGUI.

/**
	 * Build the GUI
	 *
	 */
private void initGUI() {
    // The actual time/date used to fill the time fields 
    Calendar calendar = Calendar.getInstance();
    guiSwitches = new LoadSwitchesPanel(loggingClient);
    JRootPane mainPnl = this.getRootPane();
    mainPnl.setLayout(new BorderLayout());
    // The panel with the option of the query
    JPanel optionsPnl = new JPanel();
    GridBagLayout prefsLayout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    optionsPnl.setLayout(prefsLayout);
    // Add all the labels
    JLabel maxLogs = new JLabel("Max num of logs to load:");
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(10, 5, 5, 5);
    optionsPnl.add(maxLogs, c);
    JLabel fromLbl = new JLabel("From:");
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(fromLbl, c);
    JLabel toLbl = new JLabel("To:");
    c.gridx = 0;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(toLbl, c);
    JLabel routinNameLbl = new JLabel("Routine name:");
    c.gridx = 0;
    c.gridy = 3;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(routinNameLbl, c);
    JLabel procNameLbl = new JLabel("Process name:");
    c.gridx = 0;
    c.gridy = 4;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(procNameLbl, c);
    JLabel srcNameLbl = new JLabel("Source object:");
    c.gridx = 0;
    c.gridy = 5;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(srcNameLbl, c);
    JLabel minLogType = new JLabel("From type:");
    c.gridx = 0;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(minLogType, c);
    JLabel maxLogType = new JLabel("To type:");
    c.gridx = 0;
    c.gridy = 7;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 10, 5);
    optionsPnl.add(maxLogType, c);
    // Add the input widgets
    fromYY = new JTextField(Integer.toString(calendar.get(Calendar.YEAR)), 4);
    fromYY.setName(fromLbl.getText());
    c.gridx = 1;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 0);
    fromYY.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromYY, c);
    JLabel separatorF1 = new JLabel("-");
    c.gridx = 2;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 0, 5, 0);
    optionsPnl.add(separatorF1, c);
    fromMM = new JTextField(Integer.toString(calendar.get(Calendar.MONTH) + 1), 2);
    fromMM.setName(fromLbl.getText());
    c.gridx = 3;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    fromMM.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromMM, c);
    JLabel separatorF2 = new JLabel("-");
    c.gridx = 4;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(separatorF2, c);
    fromDD = new JTextField(Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)), 2);
    fromDD.setName(fromLbl.getText());
    c.gridx = 5;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    fromDD.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromDD, c);
    JLabel tlbl = new JLabel("T");
    c.gridx = 6;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(tlbl, c);
    fromHr = new JTextField(Integer.toString(calendar.get(Calendar.HOUR_OF_DAY)), 2);
    fromHr.setName(fromLbl.getText());
    c.gridx = 7;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    fromHr.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromHr, c);
    JLabel comaF1Lbl = new JLabel(":");
    c.gridx = 8;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(comaF1Lbl, c);
    fromMin = new JTextField(Integer.toString(calendar.get(Calendar.MINUTE)), 2);
    fromMin.setName(fromLbl.getText());
    c.gridx = 9;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    fromMin.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromMin, c);
    JLabel comaF2Lbl = new JLabel(":");
    c.gridx = 10;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(comaF2Lbl, c);
    fromSec = new JTextField(Integer.toString(calendar.get(Calendar.SECOND)), 2);
    fromSec.setName(fromLbl.getText());
    c.gridx = 11;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.gridwidth = GridBagConstraints.REMAINDER;
    fromSec.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromSec, c);
    toYY = new JTextField(Integer.toString(calendar.get(Calendar.YEAR)), 4);
    toYY.setName(toLbl.getText());
    c.gridx = 1;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 0);
    toYY.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toYY, c);
    JLabel separatorTo1 = new JLabel("-");
    c.gridx = 2;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 0, 5, 0);
    optionsPnl.add(separatorTo1, c);
    toMM = new JTextField(Integer.toString(calendar.get(Calendar.MONTH) + 1), 2);
    toMM.setName(toLbl.getText());
    c.gridx = 3;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    toMM.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toMM, c);
    JLabel separatorTo2 = new JLabel("-");
    c.gridx = 4;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(separatorTo2, c);
    toDD = new JTextField(Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)), 2);
    toDD.setName(toLbl.getText());
    c.gridx = 5;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    toDD.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toDD, c);
    JLabel t2lbl = new JLabel("T");
    c.gridx = 6;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(t2lbl, c);
    toHr = new JTextField(Integer.toString(calendar.get(Calendar.HOUR_OF_DAY)), 2);
    toHr.setName(toLbl.getText());
    c.gridx = 7;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    toHr.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toHr, c);
    JLabel comaTo1Lbl = new JLabel(":");
    c.gridx = 8;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(comaTo1Lbl, c);
    toMin = new JTextField(Integer.toString(calendar.get(Calendar.MINUTE)), 2);
    toMin.setName(toLbl.getText());
    c.gridx = 9;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    toMin.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toMin, c);
    JLabel comaTo2Lbl = new JLabel(":");
    c.gridx = 10;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(comaTo2Lbl, c);
    toSec = new JTextField(Integer.toString(calendar.get(Calendar.SECOND)), 2);
    toSec.setName(toLbl.getText());
    c.gridx = 11;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.gridwidth = GridBagConstraints.REMAINDER;
    toSec.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toSec, c);
    rowLimit = new JTextField("10000", 20);
    rowLimit.setName(maxLogs.getText());
    rowLimit.setToolTipText("Valid range  is [0, " + (Integer.MAX_VALUE - 1) + "]");
    rowLimit.getDocument().addDocumentListener(new IntegerDocumentListener());
    c.gridx = 1;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(10, 5, 5, 5);
    optionsPnl.add(rowLimit, c);
    routineName = new JTextField("*", 20);
    c.gridx = 1;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(routineName, c);
    procName = new JTextField("*", 20);
    c.gridx = 1;
    c.gridy = 4;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(procName, c);
    sourceName = new JTextField("*", 20);
    c.gridx = 1;
    c.gridy = 5;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(sourceName, c);
    minLogLevelCB = setupTypeCB(minLogLevelCB);
    minLogLevelCB.setSelectedIndex(LogTypeHelper.INFO.ordinal());
    c.gridx = 1;
    c.gridy = 6;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(minLogLevelCB, c);
    maxLogLevelCB = setupTypeCB(maxLogLevelCB);
    maxLogLevelCB.setSelectedIndex(LogTypeHelper.EMERGENCY.ordinal());
    c.gridx = 1;
    c.gridy = 7;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 10, 5);
    optionsPnl.add(maxLogLevelCB, c);
    // Add the OK, CANCEL buttons
    JPanel bottomPanel = new JPanel(new BorderLayout());
    JPanel btnPnl = new JPanel();
    btnPnl.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    BoxLayout boxLayout = new BoxLayout(btnPnl, BoxLayout.LINE_AXIS);
    btnPnl.setLayout(boxLayout);
    btnPnl.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    submitBtn = new JButton("Submit");
    submitBtn.addActionListener(this);
    submitBtn.setEnabled(archive.getDBStatus() == DBState.DATABASE_OK);
    doneBtn = new JButton("Cancel");
    doneBtn.addActionListener(this);
    btnPnl.add(submitBtn, BorderLayout.WEST);
    btnPnl.add(Box.createRigidArea(new Dimension(10, 0)));
    btnPnl.add(doneBtn, BorderLayout.EAST);
    btnPnl.add(Box.createRigidArea(new Dimension(10, 0)));
    // Set the border and a smaller font for the label
    statusLbl.setBorder(BorderFactory.createLoweredBevelBorder());
    Font fnt = statusLbl.getFont();
    Font newFont = fnt.deriveFont(fnt.getSize() * 2 / 3);
    statusLbl.setFont(newFont);
    bottomPanel.add(btnPnl, BorderLayout.EAST);
    bottomPanel.add(statusLbl, BorderLayout.CENTER);
    // Add the subpanels
    mainPnl.add(guiSwitches, BorderLayout.NORTH);
    mainPnl.add(optionsPnl, BorderLayout.CENTER);
    mainPnl.add(bottomPanel, BorderLayout.SOUTH);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Calendar(java.util.Calendar) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) Font(java.awt.Font) LoadSwitchesPanel(alma.acs.logging.io.LoadSwitchesPanel) BorderLayout(java.awt.BorderLayout) JRootPane(javax.swing.JRootPane)

Example 38 with JTextField

use of javax.swing.JTextField in project ACS by ACS-Community.

the class FilterIntegerPanel method buildIntegerTextField.

/**
	 * All the integer text fields have the same properties:
	 * this method avoid code repetition.
	 *   
	 * @param initialValue The initial value in the text field
	 * @return The JTextField
	 * 
	 */
private JTextField buildIntegerTextField(int initialValue) {
    JTextField ret = new JTextField("" + initialValue);
    ret.setColumns(10);
    AbstractDocument document = (AbstractDocument) ret.getDocument();
    document.setDocumentFilter(new FormattedIntDocFilter(9));
    return ret;
}
Also used : AbstractDocument(javax.swing.text.AbstractDocument) JTextField(javax.swing.JTextField)

Example 39 with JTextField

use of javax.swing.JTextField in project nhin-d by DirectProject.

the class ButtonSelector method actionPerformed.

public void actionPerformed(ActionEvent event) {
    //System.out.println("Event"+event.getActionCommand());
    if (event.getActionCommand().equalsIgnoreCase("Create Bundle")) {
        Component[] data = pane.getComponents();
        JTextField anchorDir = (JTextField) data[4];
        JTextField metaDataFile = (JTextField) data[7];
        JTextField destDir = (JTextField) data[10];
        JTextField bundleName = (JTextField) data[13];
        CreateUnSignedPKCS7 unCert = new CreateUnSignedPKCS7();
        error = unCert.getParameters(anchorDir.getText(), metaDataFile.getText(), destDir.getText(), bundleName.getText());
        JTextPane feedback = (JTextPane) data[16];
        feedback.setText(error);
    } else if (event.getActionCommand().equalsIgnoreCase("Create Signed Bundle")) {
        Component[] data = pane.getComponents();
        JTextField anchorDir = (JTextField) data[4];
        JTextField metaDataFile = (JTextField) data[7];
        JTextField certificateDir = (JTextField) data[10];
        JPasswordField passkey = (JPasswordField) data[13];
        //String passVal=new String();
        //System.out.println("The password:"+String.copyValueOf(passkey.getPassword()));
        JTextField destDir = (JTextField) data[15];
        JTextField bundleName = (JTextField) data[18];
        CreateSignedPKCS7 unCert = new CreateSignedPKCS7();
        error = unCert.getParameters(anchorDir.getText(), metaDataFile.getText(), certificateDir.getText(), String.copyValueOf(passkey.getPassword()), destDir.getText(), bundleName.getText());
        //System.out.println("The destination file path is:"+error);
        JTextPane feedback = (JTextPane) data[21];
        feedback.setText(error);
    } else {
        Component[] data = pane.getComponents();
        JTextField trustBundle = (JTextField) data[4];
        ViewTrustBundlePKCS7 unCert = new ViewTrustBundlePKCS7();
        error = unCert.getParameters(trustBundle.getText());
        new PreviewTrustBundle(error);
        PreviewTrustBundle.createAndShowGUI();
    //JTextPane feedback = (JTextPane) data[8];
    //feedback.setText(error);
    }
}
Also used : ViewTrustBundlePKCS7(org.nhindirect.trustbundle.core.ViewTrustBundlePKCS7) JTextPane(javax.swing.JTextPane) CreateUnSignedPKCS7(org.nhindirect.trustbundle.core.CreateUnSignedPKCS7) JPasswordField(javax.swing.JPasswordField) CreateSignedPKCS7(org.nhindirect.trustbundle.core.CreateSignedPKCS7) Component(java.awt.Component) JTextField(javax.swing.JTextField) PreviewTrustBundle(org.nhindirect.trustbundle.ui.PreviewTrustBundle)

Example 40 with JTextField

use of javax.swing.JTextField in project nhin-d by DirectProject.

the class ComponentCreation method createBrowseFile.

/**
	 * Process the container pane to create file chooser or directory chooser 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 c is a object of GridBagConstarins, and used to set any grid layout
	 * @param pane Container object to add component into this pane
	 * @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 createBrowseFile(String type, String lableData, GridBagConstraints c, Container pane, int gridx, int gridy) {
    JTextField filename = new JTextField();
    filename.setText(lableData);
    ComponentCreation ex = new ComponentCreation();
    JButton open = new JButton("Browse");
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = gridx;
    c.gridy = gridy;
    pane.add(filename, c);
    if (type.equalsIgnoreCase("FILE")) {
        open.addActionListener(ex.new OpenL(filename));
    }
    if (type.equalsIgnoreCase("DIRECTORY")) {
        open.addActionListener(ex.new OpenD(filename));
    }
    c.fill = GridBagConstraints.NONE;
    c.gridx = gridx + 1;
    c.gridy = gridy;
    pane.add(open, c);
    filename.setEditable(false);
}
Also used : JButton(javax.swing.JButton) JTextField(javax.swing.JTextField)

Aggregations

JTextField (javax.swing.JTextField)450 JLabel (javax.swing.JLabel)270 JPanel (javax.swing.JPanel)236 JButton (javax.swing.JButton)135 BorderLayout (java.awt.BorderLayout)115 GridBagLayout (java.awt.GridBagLayout)94 Insets (java.awt.Insets)94 GridBagConstraints (java.awt.GridBagConstraints)93 Dimension (java.awt.Dimension)91 JCheckBox (javax.swing.JCheckBox)89 ActionEvent (java.awt.event.ActionEvent)84 ActionListener (java.awt.event.ActionListener)75 JScrollPane (javax.swing.JScrollPane)64 BoxLayout (javax.swing.BoxLayout)50 JTextArea (javax.swing.JTextArea)40 FlowLayout (java.awt.FlowLayout)39 JComboBox (javax.swing.JComboBox)39 JRadioButton (javax.swing.JRadioButton)37 ButtonGroup (javax.swing.ButtonGroup)35 JTable (javax.swing.JTable)34