private DoubleTextField getDoubleTextField(String text, int bold, int fontSize, int align) { DoubleTextField tf = new DoubleTextField(); tf.setText(text); tf.setFont(tf.getFont().deriveFont(bold, PosUIManager.getSize(fontSize))); tf.setHorizontalAlignment(align); tf.setBackground(Color.WHITE); return tf; }
public JPanel getPaginationPanel() { JPanel southPanel = new JPanel(new BorderLayout(5, 5)); southPanel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); btnPrev.setText(POSConstants.CAPITAL_PREV); btnPrev.setPreferredSize(PosUIManager.getSize(80, 30)); southPanel.add(btnPrev, BorderLayout.WEST); btnNext.setPreferredSize(PosUIManager.getSize(80, 30)); btnNext.setText(POSConstants.CAPITAL_NEXT); southPanel.add(btnNext, BorderLayout.EAST); ScrollAction action = new ScrollAction(); btnPrev.addActionListener(action); btnNext.addActionListener(action); return southPanel; }
private JLabel getJLabel(String text, int bold, int fontSize, int align) { JLabel lbl = new JLabel(text); lbl.setFont(lbl.getFont().deriveFont(bold, PosUIManager.getSize(fontSize))); lbl.setHorizontalAlignment(align); return lbl; }
public KitchenDisplayView(boolean showHeader) { setLayout(new BorderLayout(5, 5)); PosPrinters printers = Application.getPrinters(); List<Printer> kitchenPrinters = printers.getKitchenPrinters(); DefaultComboBoxModel<Printer> printerModel = new DefaultComboBoxModel<Printer>(); printerModel.addElement(null); for (Printer printer : kitchenPrinters) { printerModel.addElement(printer); } Font font = getFont().deriveFont(18f); cbPrinters.setFont(font); cbPrinters.setRenderer(new PosComboRenderer()); cbPrinters.setModel(printerModel); cbPrinters.addActionListener(this); JPanel firstTopPanel = new JPanel(new BorderLayout(5, 5)); if (showHeader) { headerPanel = new HeaderPanel(); firstTopPanel.add(headerPanel, BorderLayout.NORTH); } filterPanel = new JPanel(); PosButton btnBack = new PosButton("Back"); btnBack.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { RootView.getInstance().showDefaultView(); } }); JLabel label = new JLabel(Messages.getString("KitchenDisplayView.5")); // $NON-NLS-1$ label.setFont(font); JLabel label2 = new JLabel(Messages.getString("KitchenDisplayView.6")); // $NON-NLS-1$ label2.setFont(font); filterPanel.setLayout(new MigLayout("", "[][][][][fill,grow][]", "")); filterPanel.add(label); filterPanel.add(cbPrinters); filterPanel.add(label2); filterPanel.add(cbTicketTypes); btnFilter = new PosButton("Filter"); btnFilter.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { KitchenFilterDialog dialog = new KitchenFilterDialog(); dialog.add(filterPanel, BorderLayout.CENTER); dialog.open(); } }); JPanel topPanel = new JPanel( new MigLayout( "fill, ins 2 2 0 2", "[][fill, grow][]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // topPanel.setBorder(BorderFactory.createTitledBorder("Filter: All Printers- All Orders")); // //$NON-NLS-1$ // topPanel.add(label); // topPanel.add(cbPrinters); Dimension size = PosUIManager.getSize(60, 40); Font filterFont = getFont().deriveFont(Font.BOLD, 12f); lblFilter = new JLabel("Filter: All Printers- All Orders"); // $NON-NLS-1$ lblFilter.setForeground(new Color(49, 106, 196)); lblFilter.setFont(filterFont); topPanel.add(lblFilter); topPanel.add(btnFilter, "w " + size.width + "!,h " + size.height + "!"); topPanel.add(btnBack, "w " + size.width + "!, h " + size.height + "!"); topPanel.setBackground(Color.white); cbTicketTypes.setFont(font); cbTicketTypes.setRenderer(new PosComboRenderer()); DefaultComboBoxModel<OrderType> ticketTypeModel = new DefaultComboBoxModel<OrderType>(); for (OrderType orderType : Application.getInstance().getOrderTypes()) { ticketTypeModel.addElement(orderType); } ticketTypeModel.insertElementAt(null, 0); cbTicketTypes.setModel(ticketTypeModel); cbTicketTypes.setSelectedIndex(0); cbTicketTypes.addActionListener(this); // topPanel.add(label2); // topPanel.add(cbTicketTypes); btnLogout = new PosButton(new LogoutAction(true, false)); // $NON-NLS-1$ // btnLogout.addActionListener(this); topPanel.add(btnLogout, "w " + size.width + "!, h " + size.height + "!, wrap"); topPanel.add(new JSeparator(), "grow,span"); firstTopPanel.setPreferredSize(new Dimension(0, PosUIManager.getSize(50))); firstTopPanel.add(topPanel); add(firstTopPanel, BorderLayout.NORTH); ticketPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); // JScrollPane scrollPane = new JScrollPane(ticketPanel); // scrollPane.getHorizontalScrollBar().setSize(new Dimension(100, 60)); // scrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(100, 60)); add(ticketPanel); add(ticketPanel.getPaginationPanel(), BorderLayout.SOUTH); viewUpdateTimer = new Timer(5 * 1000, this); viewUpdateTimer.setRepeats(true); }