Search in sources :

Example 6 with CButton

use of org.compiere.swing.CButton in project adempiere by adempiere.

the class POSSubPanel method createButtonAction.

//	dispose
/**
	 * 	Create Action Button
	 *	@param action action 
	 *	@return button
	 */
protected CButton createButtonAction(String action, KeyStroke accelerator) {
    String acceleratorText = "";
    if (action != null && accelerator != null) {
        if (accelerator != null) {
            int modifiers = accelerator.getModifiers();
            if (modifiers >= 0) {
                acceleratorText = "(" + KeyEvent.getKeyModifiersText(modifiers);
            //acceleratorText += "+";
            }
            acceleratorText += KeyEvent.getKeyText(accelerator.getKeyCode());
        }
        posPanel.addStatusBarInfo(action + acceleratorText + ")");
    }
    //AppsAction(action, accelerator, false);
    AppsAction act = new AppsAction(action, accelerator, acceleratorText, false);
    act.setDelegate(this);
    CButton button = (CButton) act.getButton();
    button.setPreferredSize(new Dimension(WIDTH, HEIGHT));
    button.setMinimumSize(new Dimension(WIDTH, HEIGHT));
    button.setMaximumSize(new Dimension(WIDTH, HEIGHT));
    return button;
}
Also used : AppsAction(org.compiere.apps.AppsAction) Dimension(java.awt.Dimension) CButton(org.compiere.swing.CButton)

Example 7 with CButton

use of org.compiere.swing.CButton in project adempiere by adempiere.

the class POSUserPinListener method doPerformAction.

protected void doPerformAction(ActionEvent actionEvent) {
    if (!"KeyEvent".equals(actionEvent.getActionCommand().toString()) || !actionEvent.getActionCommand().toString().equals("Cancel"))
        return;
    Object objectSource = actionEvent.getSource();
    VNumber number = null;
    CButton button = null;
    if (objectSource instanceof VNumber)
        number = (VNumber) objectSource;
    if (objectSource instanceof CButton)
        button = (CButton) objectSource;
    if (!pos.isRequiredPIN())
        return;
    if (//Number field validation
    (number != null && (Msg.translate(Env.getCtx(), "Discount").equals(number.getName()) || Msg.translate(Env.getCtx(), "PriceActual").equals(number.getName())) || //Button validation
    (button != null && ("Cancel".equals(button.getName()))))) {
        POSUserPinDialog.show(pos);
    }
}
Also used : VNumber(org.compiere.grid.ed.VNumber) CButton(org.compiere.swing.CButton)

Example 8 with CButton

use of org.compiere.swing.CButton in project adempiere by adempiere.

the class AdempierePLAF method getCancelButton.

//  getOKButton
/**
	 *  Create Cancel Button
	 *  @return Cancel button
	 */
public static CButton getCancelButton() {
    CButton b = new CButton();
    b.setIcon(new ImageIcon(AdempierePLAF.class.getResource("icons/Cancel24.gif")));
    b.setMargin(new Insets(0, 10, 0, 10));
    b.setToolTipText(s_res.getString("Cancel"));
    return b;
}
Also used : ImageIcon(javax.swing.ImageIcon) Insets(java.awt.Insets) CButton(org.compiere.swing.CButton)

Example 9 with CButton

use of org.compiere.swing.CButton in project adempiere by adempiere.

the class AdempierePLAF method getOKButton.

/**
	 *  Create OK Button
	 *  @return OK button
	 */
public static CButton getOKButton() {
    CButton b = new CButton();
    b.setIcon(new ImageIcon(AdempierePLAF.class.getResource("icons/Ok24.gif")));
    b.setMargin(new Insets(0, 10, 0, 10));
    b.setToolTipText(s_res.getString("OK"));
    return b;
}
Also used : ImageIcon(javax.swing.ImageIcon) Insets(java.awt.Insets) CButton(org.compiere.swing.CButton)

Example 10 with CButton

use of org.compiere.swing.CButton in project adempiere by adempiere.

the class ConfirmPanel method createExportButton.

//	createHelpButton
/************************
	 *	Create Export Button wlth label text
	 *  @param text text
	 *  @return Button
	 */
public static final CButton createExportButton(String text) {
    AppsAction aa = new AppsAction(A_EXPORT, null, text);
    CButton button = (CButton) aa.getButton();
    button.setMargin(s_insets);
    return button;
}
Also used : CButton(org.compiere.swing.CButton)

Aggregations

CButton (org.compiere.swing.CButton)40 Insets (java.awt.Insets)11 Dimension (java.awt.Dimension)9 AppsAction (org.compiere.apps.AppsAction)6 CPanel (org.compiere.swing.CPanel)5 GridBagConstraints (java.awt.GridBagConstraints)3 ImageIcon (javax.swing.ImageIcon)3 VLookup (org.compiere.grid.ed.VLookup)3 MLookup (org.compiere.model.MLookup)3 BorderLayout (java.awt.BorderLayout)2 Color (java.awt.Color)2 Font (java.awt.Font)2 Timestamp (java.sql.Timestamp)2 HashMap (java.util.HashMap)2 JScrollPane (javax.swing.JScrollPane)2 MigLayout (net.miginfocom.swing.MigLayout)2 VString (org.compiere.grid.ed.VString)2 MImage (org.compiere.model.MImage)2 MPOSKey (org.compiere.model.MPOSKey)2 MPOSKeyLayout (org.compiere.model.MPOSKeyLayout)2