Search in sources :

Example 31 with JComboBox

use of javax.swing.JComboBox in project adempiere by adempiere.

the class VBPartner method initBPartner.

//	jbInit
/**
	 *	Dynamic Init
	 */
private void initBPartner() {
    //	Get Data
    m_greeting = fillGreeting();
    //	Display
    m_gbc.anchor = GridBagConstraints.NORTHWEST;
    m_gbc.gridx = 0;
    m_gbc.gridy = 0;
    m_gbc.gridwidth = 1;
    m_gbc.weightx = 0;
    m_gbc.weighty = 0;
    m_gbc.fill = GridBagConstraints.HORIZONTAL;
    m_gbc.ipadx = 0;
    m_gbc.ipady = 0;
    m_line = 0;
    //	Value
    fValue = new VString("Value", true, false, true, 30, 60, "", null);
    fValue.addActionListener(this);
    createLine(fValue, "Value", true);
    //	Greeting Business Partner
    fGreetingBP = new JComboBox(m_greeting);
    createLine(fGreetingBP, "Greeting", false);
    //	Name
    fName = new VString("Name", true, false, true, 30, 60, "", null);
    fName.addActionListener(this);
    createLine(fName, "Name", false).setFontBold(true);
    //	Name2
    fName2 = new VString("Name2", false, false, true, 30, 60, "", null);
    createLine(fName2, "Name2", false);
    //	TaxId
    fTaxId = new VString("TaxID", false, false, true, 30, 60, "", null);
    createLine(fTaxId, "TaxID", false);
    //	Contact
    fContact = new VString("Contact", false, false, true, 30, 60, "", null);
    createLine(fContact, "Contact", true).setFontBold(true);
    //	Greeting Contact
    fGreetingC = new JComboBox(m_greeting);
    createLine(fGreetingC, "Greeting", false);
    //	Title
    fTitle = new VString("Title", false, false, true, 30, 60, "", null);
    createLine(fTitle, "Title", false);
    //	Email
    fEMail = new VString("EMail", false, false, true, 30, 40, "", null);
    createLine(fEMail, "EMail", false);
    //	Location
    boolean ro = m_readOnly;
    if (!ro)
        ro = !MRole.getDefault().canUpdate(Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()), MBPartnerLocation.Table_ID, 0, false);
    if (!ro)
        ro = !MRole.getDefault().canUpdate(Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()), MLocation.Table_ID, 0, false);
    fAddress = new VLocation("C_Location_ID", false, ro, true, new MLocationLookup(Env.getCtx(), m_WindowNo));
    fAddress.setValue(null);
    createLine(fAddress, "C_Location_ID", true).setFontBold(true);
    //	Phone
    fPhone = new VString("Phone", false, false, true, 30, 40, "", null);
    createLine(fPhone, "Phone", true);
    //	Phone2
    fPhone2 = new VString("Phone2", false, false, true, 30, 40, "", null);
    createLine(fPhone2, "Phone2", false);
    //	Fax
    fFax = new VString("Fax", false, false, true, 30, 40, "", null);
    createLine(fFax, "Fax", false);
    //
    fName.setBackground(AdempierePLAF.getFieldBackground_Mandatory());
    fAddress.setBackground(AdempierePLAF.getFieldBackground_Mandatory());
}
Also used : JComboBox(javax.swing.JComboBox) MLocationLookup(org.compiere.model.MLocationLookup)

Example 32 with JComboBox

use of javax.swing.JComboBox in project adempiere by adempiere.

the class POSActionPanel method init.

/**
	 * 	Initialize
	 */
@Override
public void init() {
    //	Content
    setLayout(new GridBagLayout());
    //	Button Panel
    buttonPanel = new CPanel(new GridBagLayout());
    topPadding = 0;
    leftPadding = 1;
    bottonPadding = 0;
    rightPadding = 1;
    // NEW
    buttonNew = createButtonAction(ACTION_NEW, KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
    buttonNew.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonNew.setToolTipText("F2-" + Msg.translate(ctx, "new.order"));
    buttonPanel.add(buttonNew, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // Print
    buttonPrint = createButtonAction(ACTION_PRINT, KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));
    buttonPrint.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonPrint.setToolTipText("F12-" + Msg.translate(ctx, "Print"));
    buttonPanel.add(buttonPrint, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // DOCTYPE
    buttonDocType = createButtonAction(ACTION_DOCTYPE, KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0));
    buttonDocType.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonDocType.setToolTipText("F10-" + Msg.translate(ctx, "C_DocType_ID"));
    buttonPanel.add(buttonDocType, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // PRODUCT
    buttonProduct = createButtonAction(ACTION_PRODUCT, KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.ALT_MASK));
    buttonProduct.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonProduct.setToolTipText("ALT+I-" + Msg.translate(ctx, "InfoProduct"));
    buttonPanel.add(buttonProduct, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // BPARTNER
    buttonBPartner = createButtonAction(ACTION_BPARTNER, KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.CTRL_MASK + Event.ALT_MASK));
    buttonBPartner.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonBPartner.setToolTipText("CTL+ALT+I-" + Msg.translate(ctx, "C_BPartner_ID"));
    buttonPanel.add(buttonBPartner, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // PROCESS
    buttonProcess = createButtonAction(ACTION_PROCESS, KeyStroke.getKeyStroke(KeyEvent.VK_P, Event.ALT_MASK));
    buttonProcess.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonProcess.setToolTipText("ALT+P-" + Msg.translate(ctx, "Process"));
    buttonPanel.add(buttonProcess, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // HISTORY
    buttonHistory = createButtonAction(ACTION_HISTORY, KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0));
    buttonHistory.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonHistory.setToolTipText("F9-" + Msg.translate(ctx, "smenu.order.history"));
    buttonPanel.add(buttonHistory, new GridBagConstraints(6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // 	BACK
    buttonBack = createButtonAction(ACTION_BACK, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.ALT_MASK));
    buttonBack.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonBack.setToolTipText("ALT-LEFT-" + Msg.translate(ctx, "prev"));
    buttonPanel.add(buttonBack, new GridBagConstraints(7, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonBack.setEnabled(true);
    //	NEXT
    buttonNext = createButtonAction(ACTION_NEXT, KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.ALT_MASK));
    buttonNext.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonNext.setToolTipText("ALT-RIGHT-" + Msg.translate(ctx, "next"));
    buttonPanel.add(buttonNext, new GridBagConstraints(8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonNext.setEnabled(true);
    // PAYMENT
    buttonCollect = createButtonAction(ACTION_PAYMENT, KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0));
    buttonCollect.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonCollect.setToolTipText("F4-" + Msg.translate(ctx, "Payment"));
    buttonPanel.add(buttonCollect, new GridBagConstraints(9, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    buttonCollect.setEnabled(false);
    // CANCEL
    buttonCancel = createButtonAction(ACTION_CANCEL, KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
    buttonCancel.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonCancel.setToolTipText("F3-" + Msg.translate(ctx, "POS.IsCancel"));
    buttonPanel.add(buttonCancel, new GridBagConstraints(10, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // Logout
    buttonLogout = createButtonAction(ACTION_LOGOUT, KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.ALT_MASK));
    buttonLogout.setPreferredSize(new Dimension(posPanel.getButtonSize(), posPanel.getButtonSize()));
    buttonLogout.setToolTipText("ALT+L-" + Msg.translate(ctx, "LogOut"));
    buttonPanel.add(buttonLogout, new GridBagConstraints(11, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(topPadding, leftPadding, bottonPadding, rightPadding), 0, 0));
    // BP
    String labelName = Msg.translate(Env.getCtx(), I_M_Product.COLUMNNAME_M_Product_ID);
    fieldProductName = new POSTextField(labelName, posPanel.getKeyboard());
    fieldProductName.setPlaceholder(labelName);
    fieldProductName.addActionListener(this);
    fieldProductName.setFont(posPanel.getFont());
    fieldProductName.setPreferredSize(new Dimension(250, posPanel.getFieldHeight()));
    fieldProductName.setMinimumSize(new Dimension(250, posPanel.getFieldHeight()));
    fieldProductName.setFocusable(true);
    fieldProductName.setFocusTraversalKeysEnabled(false);
    lookupProduct = new POSLookupProduct(this, fieldProductName, 0);
    fieldProductName.addKeyListener(lookupProduct);
    //	Add Button Panel
    add(buttonPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0));
    add(fieldProductName, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0));
    if (posPanel.isEnableProductLookup() && !posPanel.isVirtualKeyboard()) {
        JComboBox<KeyNamePair> fillingComponent = new JComboBox<KeyNamePair>();
        Font font = new Font("monospaced", Font.PLAIN, 14);
        fillingComponent.setFont(font);
        findProductTimer = new javax.swing.Timer(500, lookupProduct);
        lookupProduct.setFillingComponent(fillingComponent);
        lookupProduct.setPriceListId(posPanel.getM_PriceList_ID());
        lookupProduct.setPartnerId(posPanel.getC_BPartner_ID());
        lookupProduct.setWarehouseId(posPanel.getM_Warehouse_ID());
        findProductTimer.start();
        add(fillingComponent, new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 20), 0, 0));
    }
    enableButton();
    actionProcessMenu = new POSActionMenu(posPanel);
    //	List Orders
    posPanel.listOrder();
    getMainFocus();
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension) Font(java.awt.Font) KeyNamePair(org.compiere.util.KeyNamePair)

Example 33 with JComboBox

use of javax.swing.JComboBox in project adempiere by adempiere.

the class POSClientWindow method init.

private void init() {
    container = getContentPane();
    container.setLayout(null);
    btnConnect = new JButton();
    btnConnect.setText("Connect");
    btnConnect.setBounds(70, 123, 100, 23);
    btnConnect.addActionListener(this);
    btnDisconnect = new JButton();
    btnDisconnect.setText("Disconnect");
    btnDisconnect.setBounds(170, 123, 120, 23);
    btnDisconnect.addActionListener(this);
    btnDisconnect.setEnabled(false);
    lblTitle = new JLabel();
    lblTitle.setText("Print POS");
    lblTitle.setBounds(120, 13, 180, 23);
    lblHost = new JLabel();
    lblHost.setText("Host Server");
    lblHost.setBounds(55, 40, 190, 23);
    fHost = new JTextField();
    fHost.setText("localhost");
    fHost.setBounds(140, 40, 180, 23);
    lblPrint = new JLabel();
    lblPrint.setText("Printer");
    lblPrint.setBounds(85, 67, 190, 23);
    PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
    cPrint = new JComboBox();
    for (PrintService s : services) {
        cPrint.addItem(s.getName());
    }
    cPrint.setBounds(140, 67, 180, 23);
    fTerminal.setBounds(0, 190, 300, 300);
    fTerminal.setBackground(Color.black);
    fTerminal.setForeground(Color.green);
    fTerminal.setSelectionColor(Color.red);
    fTerminal.setFont(new Font("consolas", 1, 10));
    fTerminal.setEnabled(false);
    fTerminal.setWrapStyleWord(true);
    fTerminal.setLineWrap(true);
    container.add(lblTitle);
    container.add(lblHost);
    container.add(fHost);
    container.add(lblPrint);
    container.add(cPrint);
    container.add(btnConnect);
    container.add(btnDisconnect);
    JScrollPane scroll = new JScrollPane(fTerminal);
    scroll.setBounds(new Rectangle(25, 150, 300, 120));
    getContentPane().add(scroll);
}
Also used : JScrollPane(javax.swing.JScrollPane) JComboBox(javax.swing.JComboBox) JButton(javax.swing.JButton) Rectangle(java.awt.Rectangle) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) Font(java.awt.Font) PrintService(javax.print.PrintService)

Example 34 with JComboBox

use of javax.swing.JComboBox in project adempiere by adempiere.

the class CColumnControlButton method init.

/**
     * Initialize the column control button's gui
     */
private void init() {
    setFocusPainted(false);
    setFocusable(false);
    // this is a trick to get hold of the client prop which
    // prevents closing of the popup
    JComboBox box = new JComboBox();
    Object preventHide = box.getClientProperty("doNotCancelPopup");
    putClientProperty("doNotCancelPopup", preventHide);
}
Also used : JComboBox(javax.swing.JComboBox)

Example 35 with JComboBox

use of javax.swing.JComboBox in project jadx by skylot.

the class LogViewer method initUI.

public final void initUI() {
    textPane = new RSyntaxTextArea();
    textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
    JPanel controlPane = new JPanel();
    controlPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    @SuppressWarnings("unchecked") final JComboBox cb = new JComboBox(LEVEL_ITEMS);
    cb.setSelectedItem(level);
    cb.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int i = cb.getSelectedIndex();
            level = LEVEL_ITEMS[i];
            registerLogListener();
        }
    });
    JLabel levelLabel = new JLabel(NLS.str("log.level"));
    levelLabel.setLabelFor(cb);
    controlPane.add(levelLabel);
    controlPane.add(cb);
    JScrollPane scrollPane = new JScrollPane(textPane);
    JButton close = new JButton(NLS.str("tabs.close"));
    close.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent event) {
            close();
        }
    });
    close.setAlignmentX(0.5f);
    Container contentPane = getContentPane();
    contentPane.add(controlPane, BorderLayout.PAGE_START);
    contentPane.add(scrollPane, BorderLayout.CENTER);
    contentPane.add(close, BorderLayout.PAGE_END);
    setTitle("Log Viewer");
    pack();
    setSize(800, 600);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setModalityType(ModalityType.MODELESS);
    setLocationRelativeTo(null);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) Container(java.awt.Container) RSyntaxTextArea(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea) JComboBox(javax.swing.JComboBox) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel)

Aggregations

JComboBox (javax.swing.JComboBox)226 JLabel (javax.swing.JLabel)97 JPanel (javax.swing.JPanel)88 ActionEvent (java.awt.event.ActionEvent)69 ActionListener (java.awt.event.ActionListener)66 JButton (javax.swing.JButton)55 GridBagLayout (java.awt.GridBagLayout)42 GridBagConstraints (java.awt.GridBagConstraints)41 Insets (java.awt.Insets)40 Dimension (java.awt.Dimension)39 JScrollPane (javax.swing.JScrollPane)37 JTextField (javax.swing.JTextField)36 BoxLayout (javax.swing.BoxLayout)34 JCheckBox (javax.swing.JCheckBox)33 DefaultCellEditor (javax.swing.DefaultCellEditor)27 JTable (javax.swing.JTable)26 BorderLayout (java.awt.BorderLayout)25 Component (java.awt.Component)25 TableColumn (javax.swing.table.TableColumn)23 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)22