Search in sources :

Example 26 with CLabel

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

the class VPOSBPartner method createLine.

//	initBPartner
/**
	 * 	Create Line
	 * 	@param field 	field
	 * 	@param title	label value
	 * 	@param addSpace	add more space
	 * 	@return label
	 */
private CLabel createLine(JComponent field, String title, boolean addSpace) {
    if (addSpace) {
        m_gbc.gridy = m_line++;
        m_gbc.gridx = 1;
        m_gbc.insets = fieldInsets;
        centerPanel.add(Box.createHorizontalStrut(6), m_gbc);
    }
    //	Line
    m_gbc.gridy = m_line++;
    //	Label
    m_gbc.gridx = 0;
    m_gbc.insets = labelInsets;
    m_gbc.fill = GridBagConstraints.HORIZONTAL;
    CLabel label = new CLabel(Msg.translate(Env.getCtx(), title));
    centerPanel.add(label, m_gbc);
    //	Field
    m_gbc.gridx = 1;
    m_gbc.insets = fieldInsets;
    m_gbc.fill = GridBagConstraints.HORIZONTAL;
    centerPanel.add(field, m_gbc);
    if (isReadOnly)
        field.setEnabled(false);
    return label;
}
Also used : CLabel(org.compiere.swing.CLabel)

Example 27 with CLabel

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

the class VCollect method jbInit.

// init
/**
	 * Instance Frame and fill fields
	 * @throws Exception
	 * @return void
	 */
private void jbInit() throws Exception {
    screenSize = pos.getSize();
    widthSize = (screenSize.width * 40) / 100;
    heightSize = (screenSize.height * 50) / 100;
    //	Instance Dialog
    //dialog = new CDialog(Env.getWindow(pos.getWindowNo()), Msg.translate(ctx, "Payment"), true);
    dialog = new CPanel();
    dialog.setName(Msg.translate(ctx, "Payment"));
    //
    mainLayout = new BorderLayout();
    parameterLayout = new GridBagLayout();
    mainPanel = new CPanel();
    parameterPanel = new CPanel();
    centerPanel = new CPanel();
    scrollPane = new JScrollPane();
    scrollPane.setPreferredSize(new Dimension(widthSize, heightSize));
    mainPanel.setLayout(mainLayout);
    parameterPanel.setLayout(parameterLayout);
    centerPanel.setLayout(parameterLayout);
    mainPanel.add(scrollPane);
    scrollPane.getViewport().add(centerPanel);
    //	Add Payment Amount
    labelPayAmt = new CLabel(Msg.translate(ctx, "PayAmt") + ":");
    labelPayAmt.setFont(pos.getBigFont());
    //
    fieldPayAmt = new CLabel();
    fieldPayAmt.setFont(pos.getBigFont());
    //	Add Payment Amount
    labelOpenAmt = new CLabel(Msg.translate(ctx, "OpenAmt") + ":");
    labelOpenAmt.setFont(pos.getBigFont());
    //	
    fieldOpenAmt = new CLabel();
    fieldOpenAmt.setFont(pos.getBigFont());
    //	For Returned Amount
    labelReturnAmt = new CLabel(Msg.translate(ctx, "AmountReturned") + ":");
    labelReturnAmt.setFont(pos.getBigFont());
    //	
    fieldReturnAmt = new CLabel();
    fieldReturnAmt.setFont(pos.getBigFont());
    labelPaidAmt = new CLabel(Msg.translate(ctx, "PaidAmt") + ":");
    labelPaidAmt.setFont(pos.getBigFont());
    labelPaidAmt.setVisible(false);
    fieldPaidAmt = new CLabel();
    fieldPaidAmt.setFont(pos.getBigFont());
    fieldPaidAmt.setVisible(false);
    //	Add Plus Button
    AppsAction action = new AppsAction("Plus", KeyStroke.getKeyStroke(KeyEvent.VK_F2, Event.F2), false);
    action.setDelegate(this);
    buttonPlus = (CButton) action.getButton();
    buttonPlus.setPreferredSize(new Dimension(pos.getButtonSize(), pos.getButtonSize()));
    buttonPlus.setFocusable(false);
    //	For Confirm Panel Button
    buttonCancel = ConfirmPanel.createCancelButton(true);
    buttonCancel.setPreferredSize(new Dimension(pos.getButtonSize(), pos.getButtonSize()));
    buttonOk = ConfirmPanel.createOKButton(true);
    buttonOk.setPreferredSize(new Dimension(pos.getButtonSize(), pos.getButtonSize()));
    parameterPanel.add(labelPayAmt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(fieldPayAmt, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(labelOpenAmt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(fieldOpenAmt, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(labelReturnAmt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(fieldReturnAmt, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(labelPaidAmt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(fieldPaidAmt, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(buttonPlus, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(buttonCancel, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    parameterPanel.add(buttonOk, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    //	Add Fields to Main Panel
    mainPanel.add(parameterPanel, BorderLayout.NORTH);
    buttonOk.addActionListener(this);
    buttonCancel.addActionListener(this);
    //	Add to Dialog
    dialog.add(mainPanel, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) CLabel(org.compiere.swing.CLabel) AppsAction(org.compiere.apps.AppsAction) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension)

Example 28 with CLabel

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

the class VCollectDetail method loadCreditMemo.

/**
	 * Load for Credit Memo
	 * @return void
	 */
private void loadCreditMemo() {
    creditMemoPanel = new CPanel(layout);
    //	Add label credit note
    labelCreditMemo = new CLabel(Msg.translate(Env.getCtx(), "CreditMemo") + ":");
    labelCreditMemo.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    //	For Credit Memo
    MLookup cardNotelookup = getCreditMemoLockup(parentCollect.getC_BPartner_ID());
    fieldCreditMemo = new VLookup("CreditMemo", false, false, true, cardNotelookup);
    //	For Credit Memo Type
    //		((VComboBox)fieldCreditMemo.getCombo()).setRenderer(new POSLookupListCellRenderer(font));
    fieldCreditMemo.setPreferredSize(new Dimension(FIELD_WIDTH, FIELD_HEIGHT));
    //		((VComboBox)fieldCreditMemo.getCombo()).setFont(font);
    fieldCreditMemo.addVetoableChangeListener(this);
    //	Add to Panel
    creditMemoPanel.add(labelCreditMemo, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    creditMemoPanel.add(fieldCreditMemo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NORTH, new Insets(2, 0, 2, 2), 0, 0));
    //	Default visible false
    creditMemoPanel.setVisible(false);
}
Also used : CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MLookup(org.compiere.model.MLookup) CPanel(org.compiere.swing.CPanel) VLookup(org.compiere.grid.ed.VLookup) Dimension(java.awt.Dimension)

Example 29 with CLabel

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

the class POSInfoProduct method init.

@Override
protected void init() {
    //	Set Layout
    setLayout(new GridBagLayout());
    //	Set Border
    TitledBorder border = BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "InfoProduct"));
    border.setTitleFont(posPanel.getFont());
    border.setTitleColor(AdempierePLAF.getTextColor_Label());
    setBorder(border);
    //	
    FontMetrics metrics = getFontMetrics(posPanel.getPlainFont());
    //	Instance Panels
    rightPanel = new CPanel(new GridBagLayout());
    //	For Name
    labelName = new CLabel(Msg.getElement(Env.getCtx(), "ProductName"));
    labelName.setFont(posPanel.getBigFont());
    labelName.setHorizontalAlignment(CLabel.LEFT);
    //	Add
    rightPanel.add(labelName, new GridBagConstraints(0, 0, 1, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 0), 0, 0));
    labelPriceName = new CLabel(Msg.parseTranslation(ctx, "@PriceStd@ , @PriceList@ ") + posPanel.getCurSymbol());
    labelPriceName.setFont(posPanel.getBigFont());
    labelPriceName.setHorizontalAlignment(CLabel.LEFT);
    labelPriceName.setHorizontalTextPosition(CLabel.LEFT);
    //	Add
    rightPanel.add(labelPriceName, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
    /*labelPriceLimit = new CLabel (posPanel.getNumberFormat().format(Env.ZERO));
		labelPriceLimit.setFont(posPanel.getBigFont());
		labelPriceLimit.setHorizontalAlignment(CLabel.RIGHT);
		labelPriceLimit.setHorizontalTextPosition(CLabel.RIGHT);
		labelPriceLimit.setPreferredSize(new Dimension(100, metrics.getHeight()));
		labelPriceLimit.setMinimumSize(new Dimension(150, metrics.getHeight()));
		//	Add
		rightPanel.add(labelPriceLimit, new GridBagConstraints(1, 1, 1, 1, 1, 1
				,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));*/
    //	For Price
    labelPrice = new CLabel(posPanel.getNumberFormat().format(Env.ZERO));
    labelPrice.setFont(posPanel.getBigFont());
    labelPrice.setHorizontalAlignment(CLabel.RIGHT);
    labelPrice.setHorizontalTextPosition(CLabel.RIGHT);
    labelPrice.setPreferredSize(new Dimension(100, metrics.getHeight()));
    labelPrice.setMinimumSize(new Dimension(150, metrics.getHeight()));
    //	Add
    rightPanel.add(labelPrice, new GridBagConstraints(2, 1, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
    labelPriceList = new CLabel(posPanel.getNumberFormat().format(Env.ZERO));
    labelPriceList.setFont(posPanel.getBigFont());
    labelPriceList.setHorizontalAlignment(CLabel.RIGHT);
    labelPriceList.setHorizontalTextPosition(CLabel.RIGHT);
    labelPriceList.setPreferredSize(new Dimension(100, metrics.getHeight()));
    labelPriceList.setMinimumSize(new Dimension(150, metrics.getHeight()));
    //	Add
    rightPanel.add(labelPriceList, new GridBagConstraints(3, 1, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
    //	For Value
    labelValue = new CLabel(Msg.getElement(Env.getCtx(), "ProductValue"));
    labelValue.setFont(posPanel.getPlainFont());
    labelValue.setHorizontalAlignment(CLabel.LEFT);
    labelValue.setHorizontalTextPosition(CLabel.LEFT);
    //	Add
    rightPanel.add(labelValue, new GridBagConstraints(0, 2, 1, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	For UOM
    labelUOMSymbol = new CLabel(Msg.getElement(Env.getCtx(), "C_UOM_ID"));
    labelUOMSymbol.setFont(posPanel.getPlainFont());
    labelUOMSymbol.setHorizontalAlignment(CLabel.LEFT);
    labelUOMSymbol.setHorizontalTextPosition(CLabel.LEFT);
    //	Add
    rightPanel.add(labelUOMSymbol, new GridBagConstraints(0, 3, 1, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	For Category
    labelProductCategory = new CLabel(Msg.getElement(Env.getCtx(), "M_Product_Category_ID"));
    labelProductCategory.setFont(posPanel.getPlainFont());
    labelProductCategory.setHorizontalAlignment(CLabel.LEFT);
    //	Add
    rightPanel.add(labelProductCategory, new GridBagConstraints(0, 4, 2, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	For Category
    labelProductTax = new CLabel(Msg.getElement(Env.getCtx(), "C_TaxCategory_ID"));
    labelProductTax.setFont(posPanel.getPlainFont());
    labelProductTax.setHorizontalAlignment(CLabel.LEFT);
    //	Add
    rightPanel.add(labelProductTax, new GridBagConstraints(0, 5, 2, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	For Description
    labelDescription = new CLabel(Msg.getElement(Env.getCtx(), "Description"));
    labelDescription.setFont(posPanel.getPlainFont());
    labelDescription.setHorizontalAlignment(CLabel.LEFT);
    labelDescription.setPreferredSize(new Dimension(20, metrics.getHeight()));
    labelDescription.setMaximumSize(new Dimension(20, metrics.getHeight()));
    //	Add
    rightPanel.add(labelDescription, new GridBagConstraints(0, 6, 2, 1, 0, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    //	For Image
    buttonImage = new CButton();
    buttonImage.setFont(posPanel.getFont());
    buttonImage.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
    buttonImage.setMinimumSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
    buttonImage.setFocusable(false);
    buttonImage.setVerticalTextPosition(SwingConstants.BOTTOM);
    buttonImage.setHorizontalTextPosition(SwingConstants.CENTER);
    //	Add to panel
    //	Add Doc Info
    add(buttonImage, new GridBagConstraints(0, 0, 1, 1, 0.1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	Add to Header
    add(rightPanel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
}
Also used : CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) FontMetrics(java.awt.FontMetrics) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) CButton(org.compiere.swing.CButton)

Example 30 with CLabel

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

the class POSScalesPanel method dynInit.

private boolean dynInit() {
    labelWeight = new CLabel("0.000", CLabel.CENTER);
    labelWeight.setFont(new Font("Arial", Font.BOLD, 50));
    centerPanel.setLayout(parameterLayout);
    centerPanel.add(labelWeight);
    AppsAction action = new AppsAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false);
    action.setDelegate(pos.getScalesListener());
    buttonCaptureWeight = (CButton) action.getButton();
    buttonCaptureWeight.setPreferredSize(new Dimension(pos.getButtonSize(), pos.getButtonSize()));
    buttonCaptureWeight.setFocusable(true);
    buttonCaptureWeight.addKeyListener(pos.getScalesListener());
    parameterPanel.add(buttonCaptureWeight, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    mainPanel.add(parameterPanel, BorderLayout.SOUTH);
    return true;
}
Also used : CLabel(org.compiere.swing.CLabel) AppsAction(org.compiere.apps.AppsAction) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Dimension(java.awt.Dimension) Font(java.awt.Font)

Aggregations

CLabel (org.compiere.swing.CLabel)36 CPanel (org.compiere.swing.CPanel)14 Dimension (java.awt.Dimension)12 GridBagConstraints (java.awt.GridBagConstraints)10 Insets (java.awt.Insets)10 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)8 BorderLayout (java.awt.BorderLayout)7 CComboBox (org.compiere.swing.CComboBox)7 GridBagLayout (java.awt.GridBagLayout)6 TitledBorder (javax.swing.border.TitledBorder)6 Component (java.awt.Component)5 JScrollPane (javax.swing.JScrollPane)5 MigLayout (net.miginfocom.swing.MigLayout)5 Font (java.awt.Font)3 JRadioButton (javax.swing.JRadioButton)3 POSTextField (org.adempiere.pos.POSTextField)3 AppsAction (org.compiere.apps.AppsAction)3 VEditor (org.compiere.grid.ed.VEditor)3 VLookup (org.compiere.grid.ed.VLookup)3 VNumber (org.compiere.grid.ed.VNumber)3