List of usage examples for javax.swing SwingConstants TRAILING
int TRAILING
To view the source code for javax.swing SwingConstants TRAILING.
Click Source Link
From source file:com.floreantpos.ui.views.payment.SettleTicketDialog.java
private JPanel createTotalViewerPanel() { JLabel lblSubtotal = new javax.swing.JLabel(); lblSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblSubtotal.setText(com.floreantpos.POSConstants.SUBTOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfSubtotal = new javax.swing.JTextField(10); tfSubtotal.setHorizontalAlignment(SwingConstants.TRAILING); tfSubtotal.setEditable(false);//from w w w . j a va 2 s.co m JLabel lblDiscount = new javax.swing.JLabel(); lblDiscount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDiscount.setText(Messages.getString("TicketView.9") + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDiscount = new javax.swing.JTextField(10); // tfDiscount.setFont(tfDiscount.getFont().deriveFont(Font.PLAIN, 16)); tfDiscount.setHorizontalAlignment(SwingConstants.TRAILING); tfDiscount.setEditable(false); tfDiscount.setText(ticket.getDiscountAmount().toString()); JLabel lblDeliveryCharge = new javax.swing.JLabel(); lblDeliveryCharge.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDeliveryCharge.setText("Delivery Charge:" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDeliveryCharge = new javax.swing.JTextField(10); tfDeliveryCharge.setHorizontalAlignment(SwingConstants.TRAILING); tfDeliveryCharge.setEditable(false); JLabel lblTax = new javax.swing.JLabel(); lblTax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTax.setText(com.floreantpos.POSConstants.TAX + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTax = new javax.swing.JTextField(10); // tfTax.setFont(tfTax.getFont().deriveFont(Font.PLAIN, 16)); tfTax.setEditable(false); tfTax.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblGratuity = new javax.swing.JLabel(); lblGratuity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblGratuity .setText(Messages.getString("SettleTicketDialog.5") + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ tfGratuity = new javax.swing.JTextField(10); tfGratuity.setEditable(false); tfGratuity.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblTotal = new javax.swing.JLabel(); lblTotal.setFont(lblTotal.getFont().deriveFont(Font.BOLD, PosUIManager.getFontSize(18))); lblTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTotal.setText(com.floreantpos.POSConstants.TOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTotal = new javax.swing.JTextField(10); tfTotal.setFont(tfTotal.getFont().deriveFont(Font.BOLD, PosUIManager.getFontSize(18))); tfTotal.setHorizontalAlignment(SwingConstants.TRAILING); tfTotal.setEditable(false); JPanel ticketAmountPanel = new com.floreantpos.swing.TransparentPanel( new MigLayout("hidemode 3,ins 2 2 3 2,alignx trailing,fill", "[grow]2[]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ticketAmountPanel.add(lblSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblDiscount, "newline,growx,aligny center"); //$NON-NLS-1$ //$NON-NLS-2$ ticketAmountPanel.add(tfDiscount, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTax, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTax, "growx,aligny center"); //$NON-NLS-1$ if (ticket.getOrderType().isDelivery() && !ticket.isCustomerWillPickup()) { ticketAmountPanel.add(lblDeliveryCharge, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfDeliveryCharge, "growx,aligny center"); //$NON-NLS-1$ } ticketAmountPanel.add(lblGratuity, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfGratuity, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTotal, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTotal, "growx,aligny center"); //$NON-NLS-1$ return ticketAmountPanel; }
From source file:com.floreantpos.ui.views.payment.GroupSettleTicketDialog.java
private JPanel createTotalViewerPanel() { JLabel lblSubtotal = new javax.swing.JLabel(); lblSubtotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblSubtotal.setText(com.floreantpos.POSConstants.SUBTOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfSubtotal = new javax.swing.JTextField(10); tfSubtotal.setHorizontalAlignment(SwingConstants.TRAILING); tfSubtotal.setEditable(false);/*from w ww. j a v a 2 s. c o m*/ JLabel lblDiscount = new javax.swing.JLabel(); lblDiscount.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDiscount.setText(Messages.getString("TicketView.9") + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDiscount = new javax.swing.JTextField(10); tfDiscount.setHorizontalAlignment(SwingConstants.TRAILING); tfDiscount.setEditable(false); JLabel lblDeliveryCharge = new javax.swing.JLabel(); lblDeliveryCharge.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblDeliveryCharge.setText("Delivery Charge:" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfDeliveryCharge = new JTextField(10); tfDeliveryCharge.setHorizontalAlignment(SwingConstants.TRAILING); tfDeliveryCharge.setEditable(false); JLabel lblTax = new javax.swing.JLabel(); lblTax.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTax.setText(com.floreantpos.POSConstants.TAX + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTax = new javax.swing.JTextField(); tfTax.setEditable(false); tfTax.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblGratuity = new javax.swing.JLabel(); lblGratuity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblGratuity .setText(Messages.getString("SettleTicketDialog.5") + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ tfGratuity = new javax.swing.JTextField(); tfGratuity.setEditable(false); tfGratuity.setHorizontalAlignment(SwingConstants.TRAILING); JLabel lblTotal = new javax.swing.JLabel(); lblTotal.setFont(lblTotal.getFont().deriveFont(Font.BOLD, 18)); lblTotal.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblTotal.setText(com.floreantpos.POSConstants.TOTAL + ":" + " " + CurrencyUtil.getCurrencySymbol()); //$NON-NLS-1$ //$NON-NLS-2$ tfTotal = new javax.swing.JTextField(10); tfTotal.setFont(tfTotal.getFont().deriveFont(Font.BOLD, 18)); tfTotal.setHorizontalAlignment(SwingConstants.TRAILING); tfTotal.setEditable(false); JPanel ticketAmountPanel = new com.floreantpos.swing.TransparentPanel( new MigLayout("hidemode 3,ins 2 2 3 2,alignx trailing,fill", "[grow][]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ticketAmountPanel.add(lblSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfSubtotal, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblDiscount, "newline,growx,aligny center"); //$NON-NLS-1$ //$NON-NLS-2$ ticketAmountPanel.add(tfDiscount, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTax, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTax, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblDeliveryCharge, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfDeliveryCharge, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblGratuity, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfGratuity, "growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(lblTotal, "newline,growx,aligny center"); //$NON-NLS-1$ ticketAmountPanel.add(tfTotal, "growx,aligny center"); //$NON-NLS-1$ return ticketAmountPanel; }
From source file:greenfoot.gui.export.ExportPublishPane.java
/** * Creates a login panel with a username and password and a create account option * @return Login panel Component/* w ww . j a v a 2 s . com*/ */ private JComponent getLoginPanel() { JComponent loginPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 4)); loginPanel.setBackground(background); loginPanel.setAlignmentX(LEFT_ALIGNMENT); Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(12, 12, 12, 12)); loginPanel.setBorder(border); JLabel text = new JLabel(Config.getString("export.publish.login")); text.setForeground(headingColor); text.setVerticalAlignment(SwingConstants.TOP); loginPanel.add(text); text = new JLabel(Config.getString("export.publish.username"), SwingConstants.TRAILING); text.setFont(font); loginPanel.add(text); userNameField = new JTextField(10); userNameField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { String text = userNameField.getText(); return text.length() > 0; } }); userNameField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { checkForExistingScenario(); } }); loginPanel.add(userNameField); text = new JLabel(Config.getString("export.publish.password"), SwingConstants.TRAILING); text.setFont(font); loginPanel.add(text); passwordField = new JPasswordField(10); loginPanel.add(passwordField); JLabel createAccountLabel = new JLabel(Config.getString("export.publish.createAccount")); { createAccountLabel.setBackground(background); createAccountLabel.setHorizontalAlignment(SwingConstants.RIGHT); GreenfootUtil.makeLink(createAccountLabel, createAccountUrl); } loginPanel.add(createAccountLabel); return loginPanel; }
From source file:com.floreantpos.ui.model.MenuItemForm.java
/** This method is called from within the constructor to * initialize the form.//from ww w . java 2 s.c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { lblStockCount = new JLabel(Messages.getString("MenuItemForm.17")); //$NON-NLS-1$ tfStockCount = new DoubleTextField(1); cbDisableStockCount = new JCheckBox(Messages.getString("MenuItemForm.18")); //$NON-NLS-1$ lblButtonColor = new JLabel(Messages.getString("MenuItemForm.19")); //$NON-NLS-1$ tabbedPane = new javax.swing.JTabbedPane(); tabGeneral = new javax.swing.JPanel(); lfname = new javax.swing.JLabel(); lfname.setHorizontalAlignment(SwingConstants.TRAILING); tfName = new com.floreantpos.swing.FixedLengthTextField(20); lgroup = new javax.swing.JLabel(); lgroup.setHorizontalAlignment(SwingConstants.TRAILING); cbGroup = new javax.swing.JComboBox(); cbGroup.setPreferredSize(new Dimension(198, 0)); btnNewGroup = new javax.swing.JButton(); lblPrice = new javax.swing.JLabel(); lblPrice.setHorizontalAlignment(SwingConstants.TRAILING); tfPrice = new DoubleTextField(20); tfPrice.setHorizontalAlignment(javax.swing.JTextField.RIGHT); tfDescription = new JTextArea(new FixedLengthDocument(255)); //tfDescription.setDocument(; tfUnitName = new FixedLengthTextField(20); lTax = new javax.swing.JLabel(); lTax.setHorizontalAlignment(SwingConstants.TRAILING); cbTax = new javax.swing.JComboBox(); btnNewTax = new javax.swing.JButton(); lDiscountRate = new javax.swing.JLabel(); lDiscountRate.setHorizontalAlignment(SwingConstants.TRAILING); lPercentage = new javax.swing.JLabel(); tfDiscountRate = new DoubleTextField(18); tfDiscountRate.setHorizontalAlignment(SwingConstants.TRAILING); chkVisible = new javax.swing.JCheckBox(); tabModifier = new javax.swing.JPanel(); btnNewModifierGroup = new javax.swing.JButton(); btnDeleteModifierGroup = new javax.swing.JButton(); btnEditModifierGroup = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); tableTicketItemModifierGroups = new javax.swing.JTable(); tabShift = new javax.swing.JPanel(); tabPrice = new javax.swing.JPanel(); tabButtonStyle = new javax.swing.JPanel(); btnDeleteShift = new javax.swing.JButton(); btnAddShift = new javax.swing.JButton(); btnNewPrice = new javax.swing.JButton(); btnUpdatePrice = new javax.swing.JButton(); btnDeletePrice = new javax.swing.JButton(); btnDeleteAll = new javax.swing.JButton(); btnDefaultValue = new javax.swing.JButton(); jScrollPane2 = new javax.swing.JScrollPane(); jScrollPane3 = new javax.swing.JScrollPane(); shiftTable = new javax.swing.JTable(); priceTable = new javax.swing.JTable(); cbPrinterGroup = new JComboBox<PrinterGroup>(new DefaultComboBoxModel<PrinterGroup>( PrinterGroupDAO.getInstance().findAll().toArray(new PrinterGroup[0]))); cbPrinterGroup.setPreferredSize(new Dimension(226, 0)); tfTranslatedName = new FixedLengthTextField(20); tfTranslatedName.setLength(120); lblUnitName = new JLabel(Messages.getString("MenuItemForm.23")); //$NON-NLS-1$ lblKitchenPrinter = new JLabel(Messages.getString("MenuItemForm.27")); //$NON-NLS-1$ lgroup.setText(Messages.getString("LABEL_GROUP")); //$NON-NLS-1$ lfname.setText(Messages.getString("LABEL_NAME")); //$NON-NLS-1$ tfName.setLength(120); lblTranslatedName = new JLabel(Messages.getString("MenuItemForm.lblTranslatedName.text")); //$NON-NLS-1$ tfBarcode = new FixedLengthTextField(20); tfSortOrder = new IntegerTextField(20); lblSortOrder = new JLabel(Messages.getString("MenuItemForm.lblSortOrder.text")); //$NON-NLS-1$ tfSortOrder.setText(""); //$NON-NLS-1$ lblBarcode = new JLabel(Messages.getString("MenuItemForm.lblBarcode.text")); //$NON-NLS-1$ cbTax.setPreferredSize(new Dimension(198, 0)); ///lblButtonColor = new JLabel(Messages.getString("MenuItemForm.lblButtonColor.text")); //$NON-NLS-1$ btnButtonColor = new JButton(); //$NON-NLS-1$ btnButtonColor.setPreferredSize(new Dimension(228, 40)); lblTextColor = new JLabel(Messages.getString("MenuItemForm.lblTextColor.text")); //$NON-NLS-1$ btnTextColor = new JButton(Messages.getString("MenuItemForm.SAMPLE_TEXT")); //$NON-NLS-1$ // btnTextColor.setPreferredSize(new Dimension(228, 40)); cbShowTextWithImage = new JCheckBox(Messages.getString("MenuItemForm.40")); //$NON-NLS-1$ cbShowTextWithImage.setActionCommand(Messages.getString("MenuItemForm.41")); //$NON-NLS-1$ lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$ btnNewTax.setText("..."); //$NON-NLS-1$ cbFractionalUnit = new JCheckBox(Messages.getString("MenuItemForm.24")); //$NON-NLS-1$ btnNewGroup.setText("..."); //$NON-NLS-1$ btnNewGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doCreateNewGroup(evt); } }); if (Application.getInstance().isPriceIncludesTax()) { lblPrice.setText(Messages.getString("LABEL_SALES_PRICE_INCLUDING_TAX")); //$NON-NLS-1$ } else { lblPrice.setText(Messages.getString("LABEL_SALES_PRICE_EXCLUDING_TAX")); //$NON-NLS-1$ } tfPrice.setHorizontalAlignment(javax.swing.JTextField.RIGHT); lTax.setText(Messages.getString("LABEL_TAX")); //$NON-NLS-1$ btnNewTax.setText("..."); //$NON-NLS-1$ btnNewTax.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNewTaxdoCreateNewTax(evt); } }); lDiscountRate.setText(com.floreantpos.POSConstants.DISCOUNT_RATE + ":"); //$NON-NLS-1$ lPercentage.setText("%"); //$NON-NLS-1$ chkVisible.setText(com.floreantpos.POSConstants.VISIBLE); chkVisible.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); chkVisible.setMargin(new java.awt.Insets(0, 0, 0, 0)); tabbedPane.addTab(com.floreantpos.POSConstants.GENERAL, tabGeneral); tabbedPane.setPreferredSize(new Dimension(750, 470)); btnNewModifierGroup.setText(com.floreantpos.POSConstants.ADD); btnNewModifierGroup.setActionCommand("AddModifierGroup"); //$NON-NLS-1$ btnNewModifierGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNewModifierGroupActionPerformed(evt); } }); btnDeleteModifierGroup.setText(com.floreantpos.POSConstants.DELETE); btnDeleteModifierGroup.setActionCommand("DeleteModifierGroup"); //$NON-NLS-1$ btnEditModifierGroup.setText(com.floreantpos.POSConstants.EDIT); btnEditModifierGroup.setActionCommand("EditModifierGroup"); //$NON-NLS-1$ menuItemMGListModel = new MenuItemMGListModel(); tableTicketItemModifierGroups.setModel(menuItemMGListModel); btnNewModifierGroup.addActionListener(this); btnEditModifierGroup.addActionListener(this); btnDeleteModifierGroup.addActionListener(this); btnAddShift.addActionListener(this); btnDeleteShift.addActionListener(this); tfDiscountRate.setDocument(new DoubleDocument()); tabGeneral.setLayout(new MigLayout("insets 20", "[][]20px[][]", "[][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ /*JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$ lblImage.setHorizontalAlignment(SwingConstants.TRAILING); tabGeneral.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$ lblImagePreview = new JLabel(""); //$NON-NLS-1$ lblImagePreview.setHorizontalAlignment(JLabel.CENTER); lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); lblImagePreview.setPreferredSize(new Dimension(100, 100)); tabGeneral.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$ JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$ btnSelectImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSelectImageFile(); } }); tabGeneral.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$ btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$ btnClearImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doClearImage(); } }); tabGeneral.add(btnClearImage, "cell 1 0"); //$NON-NLS-1$ */ tabGeneral.add(lfname, "cell 0 1 ,right"); //$NON-NLS-1$ tabGeneral.add(tfName, "cell 1 1,grow"); //$NON-NLS-1$ tabGeneral.add(lblTranslatedName, "cell 0 2,right"); //$NON-NLS-1$ tabGeneral.add(tfTranslatedName, "cell 1 2,grow"); //$NON-NLS-1$ /*tabGeneral.add(new JLabel("Description"), "cell 0 3,right"); JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); tabGeneral.add(scrlDescription, "cell 1 3");*/ tabGeneral.add(lblUnitName, "cell 0 3,right"); //$NON-NLS-1$ tabGeneral.add(tfUnitName, "cell 1 3,grow"); //$NON-NLS-1$ JLabel lblBuyPrice = new JLabel(Messages.getString("LABEL_BUY_PRICE")); //$NON-NLS-1$ tabGeneral.add(lblBuyPrice, "cell 0 4,alignx right"); //$NON-NLS-1$ tfBuyPrice = new DoubleTextField(20); tfBuyPrice.setHorizontalAlignment(SwingConstants.TRAILING); tabGeneral.add(tfBuyPrice, "cell 1 4,grow"); //$NON-NLS-1$ tabGeneral.add(lblPrice, "cell 0 5,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfPrice, "cell 1 5,grow"); //$NON-NLS-1$ tabGeneral.add(lgroup, "cell 0 6,alignx right"); //$NON-NLS-1$ tabGeneral.add(cbGroup, "cell 1 6"); //$NON-NLS-1$ tabGeneral.add(btnNewGroup, "cell 1 6"); //$NON-NLS-1$ tabGeneral.add(lblBarcode, "cell 0 7,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfBarcode, "cell 1 7,grow"); //$NON-NLS-1$ tabGeneral.add(lblSortOrder, "cell 0 8,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfSortOrder, "cell 1 8,grow"); //$NON-NLS-1$ tabGeneral.add(lblStockCount, "cell 0 9,alignx right"); //$NON-NLS-1$ tabGeneral.add(tfStockCount, "cell 1 9,grow"); //$NON-NLS-1$ //tabGeneral.add(cbShowTextWithImage, "cell 1 8"); //$NON-NLS-1$ tabGeneral.add(chkVisible, "cell 1 10"); //$NON-NLS-1$ tabGeneral.add(cbFractionalUnit, "cell 1 11"); //$NON-NLS-1$ tabGeneral.add(cbDisableStockCount, "cell 1 12"); //$NON-NLS-1$ // right side tabGeneral.add(lblKitchenPrinter, "cell 2 1,right"); //$NON-NLS-1$ tabGeneral.add(cbPrinterGroup, "cell 3 1,grow"); //$NON-NLS-1$ tabGeneral.add(lTax, "cell 2 2,right"); //$NON-NLS-1$ tabGeneral.add(cbTax, "cell 3 2"); //$NON-NLS-1$ tabGeneral.add(btnNewTax, "cell 3 2,grow"); //$NON-NLS-1$ /*tabGeneral.add(lblButtonColor, "cell 2 3,right"); //$NON-NLS-1$ tabGeneral.add(btnButtonColor, "cell 3 3,grow"); //$NON-NLS-1$ tabGeneral.add(lblTextColor, "cell 2 4,right"); //$NON-NLS-1$ tabGeneral.add(btnTextColor, "cell 3 4 3 5"); //$NON-NLS-1$ btnTextColor.setPreferredSize(new Dimension(228, 50));*/ tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.25")), "cell 2 3,,aligny top,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$ orderList = new CheckBoxList(); List<OrderType> orderTypes = Application.getInstance().getOrderTypes(); orderList.setModel(orderTypes); // List<String> orderListM = new ArrayList(); // orderListM.add(OrderType.DINE_IN.toString()); // orderListM.add(OrderType.BAR_TAB.toString()); // orderListM.add(OrderType.DRIVE_THRU.toString()); // orderListM.add(OrderType.HOME_DELIVERY.toString()); // orderListM.add(OrderType.PICKUP.toString()); // orderListM.add(OrderType.RETAIL.toString()); // orderListM.add(OrderType.TAKE_OUT.toString()); // orderList.setModel(orderListM); JScrollPane orderCheckBoxList = new JScrollPane(orderList); orderCheckBoxList.setPreferredSize(new Dimension(228, 100)); tabGeneral.add(orderCheckBoxList, "cell 3 3 3 4"); //$NON-NLS-1$ tfDescription.setWrapStyleWord(true); tfDescription.setLineWrap(true); tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.29")), "cell 2 7,aligny top,alignx right"); //$NON-NLS-1$ //$NON-NLS-2$ JScrollPane scrlDescription = new JScrollPane(tfDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrlDescription.setPreferredSize(new Dimension(228, 90)); tabGeneral.add(scrlDescription, "cell 3 7 3 4"); //$NON-NLS-1$ add(tabbedPane); //TODO: addRecepieExtension(); /*btnButtonColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.42"), btnButtonColor.getBackground()); //$NON-NLS-1$ btnButtonColor.setBackground(color); btnTextColor.setBackground(color); } }); btnTextColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.43"), btnTextColor.getForeground()); //$NON-NLS-1$ btnTextColor.setForeground(color); } });*/ jScrollPane1.setViewportView(tableTicketItemModifierGroups); GroupLayout jPanel2Layout = new GroupLayout(tabModifier); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE) .addComponent(btnDeleteModifierGroup).addComponent(btnEditModifierGroup) .addComponent(btnNewModifierGroup)) .addContainerGap())); jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout .createParallelGroup(Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addComponent(btnNewModifierGroup) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnEditModifierGroup) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnDeleteModifierGroup)) .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)) .addContainerGap())); tabModifier.setLayout(jPanel2Layout); tabbedPane.addTab(com.floreantpos.POSConstants.MODIFIER_GROUPS, tabModifier); btnDeleteShift.setText(com.floreantpos.POSConstants.DELETE_SHIFT); btnAddShift.setText(com.floreantpos.POSConstants.ADD_SHIFT); shiftTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ jScrollPane2.setViewportView(shiftTable); org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(tabShift); tabShift.setLayout(jPanel3Layout); jPanel3Layout .setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup().addContainerGap(76, Short.MAX_VALUE) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 670, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup().add(btnAddShift).add(5, 5, 5) .add(btnDeleteShift))) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(jPanel3Layout.createSequentialGroup() .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 345, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(btnAddShift).add(btnDeleteShift)) .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); tabbedPane.addTab(com.floreantpos.POSConstants.SHIFTS, tabShift); // btnNewPrice.setText(Messages.getString("MenuItemForm.9")); //$NON-NLS-1$ btnNewPrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewPrice(); } }); btnUpdatePrice.setText(Messages.getString("MenuItemForm.13")); //$NON-NLS-1$ btnUpdatePrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updatePrice(); } }); btnDeletePrice.setText(Messages.getString("MenuItemForm.14")); //$NON-NLS-1$ btnDeletePrice.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deletePrice(); } }); btnDeleteAll.setText(Messages.getString("MenuItemForm.15")); //$NON-NLS-1$ btnDeleteAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteAll(); } }); btnDefaultValue.setText(Messages.getString("MenuItemForm.7")); //$NON-NLS-1$ /*btnDefaultValue.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setDefaultValue(); } });*/ priceTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ jScrollPane3.setViewportView(priceTable); tabPrice.setLayout(new BorderLayout()); tabPrice.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tabPrice.add(jScrollPane3, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.add(btnNewPrice); buttonPanel.add(btnUpdatePrice); //buttonPanel.add(btnDefaultValue); buttonPanel.add(btnDeletePrice); // buttonPanel.add(btnDeleteAll); tabPrice.add(buttonPanel, BorderLayout.SOUTH); tabbedPane.addTab(Messages.getString("MenuItemForm.16"), tabPrice); //$NON-NLS-1$ // tabbedPane.addChangeListener(this); // tabButtonStyle.setLayout(new MigLayout("insets 10", "[][]100[][][][]", "[][][center][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JLabel lblImage = new JLabel(Messages.getString("MenuItemForm.28")); //$NON-NLS-1$ lblImage.setHorizontalAlignment(SwingConstants.TRAILING); tabButtonStyle.add(lblImage, "cell 0 0,right"); //$NON-NLS-1$ lblImagePreview = new JLabel(""); //$NON-NLS-1$ lblImagePreview.setHorizontalAlignment(JLabel.CENTER); lblImagePreview.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); lblImagePreview.setPreferredSize(new Dimension(100, 100)); tabButtonStyle.add(lblImagePreview, "cell 1 0"); //$NON-NLS-1$ JButton btnSelectImage = new JButton("..."); //$NON-NLS-1$ btnClearImage = new JButton(Messages.getString("MenuItemForm.34")); //$NON-NLS-1$ tabButtonStyle.add(btnClearImage, "cell 1 0"); //$NON-NLS-1$ tabButtonStyle.add(btnSelectImage, "cell 1 0"); //$NON-NLS-1$ tabButtonStyle.add(lblButtonColor, "cell 0 2,right"); //$NON-NLS-1$ tabButtonStyle.add(btnButtonColor, "cell 1 2,grow"); //$NON-NLS-1$ tabButtonStyle.add(lblTextColor, "cell 0 3,right"); //$NON-NLS-1$ tabButtonStyle.add(btnTextColor, "cell 1 3"); //$NON-NLS-1$ tabButtonStyle.add(cbShowTextWithImage, "cell 1 4"); //$NON-NLS-1$ /* tabButtonStyle.add(lblImagePreview, "cell 3 0 3 4"); //$NON-NLS-1$ tabButtonStyle.add(btnClearImage, "cell 3 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(btnSelectImage, "cell 3 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(lblImage, "cell 2 0,gaptop 40"); //$NON-NLS-1$ tabButtonStyle.add(lblButtonColor, "cell 0 0,right"); //$NON-NLS-1$ tabButtonStyle.add(btnButtonColor, "cell 1 0,grow"); //$NON-NLS-1$ tabButtonStyle.add(lblTextColor, "cell 0 1,right"); //$NON-NLS-1$ tabButtonStyle.add(btnTextColor, "cell 1 1"); //$NON-NLS-1$ */ btnTextColor.setPreferredSize(new Dimension(228, 50)); btnSelectImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSelectImageFile(); } }); btnClearImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doClearImage(); } }); btnButtonColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.42"), //$NON-NLS-1$ btnButtonColor.getBackground()); btnButtonColor.setBackground(color); btnTextColor.setBackground(color); } }); btnTextColor.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color color = JColorChooser.showDialog(MenuItemForm.this, Messages.getString("MenuItemForm.43"), //$NON-NLS-1$ btnTextColor.getForeground()); btnTextColor.setForeground(color); } }); tabbedPane.addTab(Messages.getString("MenuItemForm.26"), tabButtonStyle); //$NON-NLS-1$ }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryObjectsTable.java
@SuppressWarnings("unchecked") private void addRenderers() { try {//from w w w . j ava 2 s.c o m setDefaultRenderer(Class.forName("java.lang.Object"), new JBDefaultTableCellRenderer()); setDefaultRenderer(Class.forName("java.util.Collection"), new CollectionRenderer()); final JList<Object> list = new JList<Object>(); list.setVisibleRowCount(3); list.setOpaque(true); list.setCellRenderer(new ListDefaultRenderer()); list.addListSelectionListener(new ListSelectionListener() { @SuppressWarnings({ "static-access", "unused" }) public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { Object obj = list.getSelectedValue(); obj = RegistryObjectsTable.this.convertValue(obj); if (obj instanceof URL) { HyperLinker.displayURL(obj.toString()); } else if (obj instanceof String) { //Check if URL is valid URL _url = null; try { _url = new URL(obj.toString()); HyperLinker.displayURL(obj.toString()); } catch (MalformedURLException exc) { //No need to do anything. It is normal for text to not be a URL _url = null; } } } } }); JScrollPane listPane = new JScrollPane(list); setDefaultEditor(Class.forName("java.util.Collection"), new JBDefaultCellEditor(listPane)); HyperLinkLabel hyperLinkLabel = new HyperLinkLabel(); hyperLinkLabel.setHorizontalAlignment(SwingConstants.TRAILING); setDefaultEditor(Class.forName("java.lang.Object"), new JBDefaultCellEditor(hyperLinkLabel)); } catch (ClassNotFoundException e) { return; } }
From source file:it.cnr.icar.eric.client.ui.swing.BusinessQueryPanel.java
/** * Class Constructor.//from w w w . j av a 2 s. c om */ public BusinessQueryPanel(final FindParamsPanel findParamsPanel, ConfigurationType uiConfigurationType) throws JAXRException { super(findParamsPanel, uiConfigurationType); GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); objectTypeLabel = new JLabel(resourceBundle.getString("title.objectType"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(objectTypeLabel, c); add(objectTypeLabel); //TODO: SwingBoost: Localize this TreeNode tempTreeNode = new DefaultMutableTreeNode("loading object types..."); objectTypeCombo = new it.cnr.icar.eric.client.ui.swing.TreeCombo(new DefaultTreeModel(tempTreeNode)); c.gridx = 0; c.gridy = 1; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(objectTypeCombo, c); add(objectTypeCombo); objectTypeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ev) { if (ev.getStateChange() == ItemEvent.DESELECTED) { return; } @SuppressWarnings("unused") String objectType = getObjectType().toString(); } }); //The caseSensitive CheckBox caseSensitiveCheckBox = new JCheckBox(resourceBundle.getString("title.caseSensitiveSearch")); caseSensitiveCheckBox.setSelected(false); caseSensitiveCheckBox.setEnabled(true); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(caseSensitiveCheckBox, c); add(caseSensitiveCheckBox); //The name Text nameLabel = new JLabel(resourceBundle.getString("title.name"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 3; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(nameLabel, c); add(nameLabel); nameText = new JTextField(); c.gridx = 0; c.gridy = 4; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(nameText, c); add(nameText); nameText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { findParamsPanel.find(); } }); //The description text descLabel = new JLabel(resourceBundle.getString("title.description"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 5; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(descLabel, c); add(descLabel); descText = new JTextField(); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(descText, c); add(descText); descText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { findParamsPanel.find(); } }); //Classifications classificationsLabel = new JLabel(resourceBundle.getString("title.classifications"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 7; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(classificationsLabel, c); add(classificationsLabel); classificationsList = new ClassificationsList(); classificationsList.setEditable(true); classificationsList.setVisibleRowCount(3); JScrollPane classificationsListScrollPane = new JScrollPane(classificationsList); //Workaround for bug 740746 where very wide item resulted in too short a height classificationsListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 8; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(classificationsListScrollPane, c); add(classificationsListScrollPane); //Identifiers identifiersLabel = new JLabel(resourceBundle.getString("title.externalIdentifiers"), SwingConstants.LEADING); c.gridx = 0; c.gridy = 9; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(identifiersLabel, c); add(identifiersLabel); extIdsList = new ExternalIdentifiersList(); extIdsList.setEditable(true); extIdsList.setVisibleRowCount(3); JScrollPane extIdsListScrollPane = new JScrollPane(extIdsList); //Workaround for bug 740746 where very wide item resulted in too short a height extIdsListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 10; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(extIdsListScrollPane, c); add(extIdsListScrollPane); //External Links linksLabel = new JLabel(resourceBundle.getString("title.externalLinks"), SwingConstants.TRAILING); c.gridx = 0; c.gridy = 11; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(linksLabel, c); add(linksLabel); linksList = new ExternalLinksList(); linksList.setEditable(true); linksList.setVisibleRowCount(3); JScrollPane linksListScrollPane = new JScrollPane(linksList); //Workaround for bug 740746 where very wide item resulted in too short a height linksListScrollPane.setMinimumSize(new Dimension(-1, 50)); c.gridx = 0; c.gridy = 12; c.gridwidth = 2; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); gbl.setConstraints(linksListScrollPane, c); add(linksListScrollPane); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
From source file:de.tbuchloh.kiskis.gui.AbstractAccountDetailView.java
protected void addRow(final JPanel panel, final String labelText, final Component comp) { final JLabel label = new JLabel(labelText, SwingConstants.TRAILING); panel.add(label);/*w w w.ja v a 2s . c o m*/ label.setLabelFor(comp); panel.add(comp); }
From source file:net.sourceforge.processdash.ui.lib.chart.StandardDiscItemRenderer.java
protected void drawDiscLabel(Graphics2D g2, Ellipse2D shape, Paint labelPaint, Font labelFont, String label) { g2.setFont(labelFont);/* w ww . j a va 2 s . co m*/ g2.setPaint(labelPaint); FontMetrics m = g2.getFontMetrics(); int height = m.getAscent(); double halfHeight = height / 2.0; double radius = shape.getWidth() / 2; double availableRadius = radius - getLabelPadding(); double halfWidth = Math.sqrt(availableRadius * availableRadius - halfHeight * halfHeight); int width = (int) Math.floor(halfWidth * 2 + 0.99); Rectangle viewR = new Rectangle(width, height); Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); String text = SwingUtilities.layoutCompoundLabel(m, label, null, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.CENTER, SwingConstants.TRAILING, viewR, iconR, textR, 0); if (text.equals(label) || text.length() >= 3 + minLabelChars) { double x = shape.getCenterX() - halfWidth + textR.x; double y = shape.getCenterY() + halfHeight + textR.y; g2.drawString(text, (float) x, (float) y); } }
From source file:it.cnr.icar.eric.client.ui.swing.RegistryBrowser.java
/** * Creates a new RegistryBrowser object. *//*from w ww . j av a 2 s. co m*/ @SuppressWarnings("unchecked") private RegistryBrowser() { instance = this; classLoader = getClass().getClassLoader(); // new // JAXRBrowserClassLoader(getClass().getClassLoader()); Thread.currentThread().setContextClassLoader(classLoader); /* * try { classLoader.loadClass("javax.xml.soap.SOAPMessage"); } catch * (ClassNotFoundException e) { * log.error("Could not find class javax.xml.soap.SOAPMessage", e); } */ UIManager.addPropertyChangeListener(new UISwitchListener(getRootPane())); // add listener for 'locale' bound property addPropertyChangeListener(PROPERTY_LOCALE, this); menuBar = new JMenuBar(); fileMenu = new JMenu(); editMenu = new JMenu(); viewMenu = new JMenu(); helpMenu = new JMenu(); JSeparator JSeparator1 = new JSeparator(); newItem = new JMenuItem(); importItem = new JMenuItem(); saveItem = new JMenuItem(); saveAsItem = new JMenuItem(); exitItem = new JMenuItem(); cutItem = new JMenuItem(); copyItem = new JMenuItem(); pasteItem = new JMenuItem(); aboutItem = new JMenuItem(); setJMenuBar(menuBar); setTitle(resourceBundle.getString("title.registryBrowser.java")); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); getContentPane().setLayout(new BorderLayout(0, 0)); // Scale window to be centered using 70% of screen Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setBounds((int) (dim.getWidth() * .15), (int) (dim.getHeight() * .1), (int) (dim.getWidth() * .7), (int) (dim.getHeight() * .75)); setVisible(false); saveFileDialog.setMode(FileDialog.SAVE); saveFileDialog.setTitle(resourceBundle.getString("dialog.save.title")); GridBagLayout gb = new GridBagLayout(); topPanel.setLayout(gb); getContentPane().add("North", topPanel); GridBagConstraints c = new GridBagConstraints(); toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0)); toolbarPanel.setBounds(0, 0, 488, 29); discoveryToolBar = createDiscoveryToolBar(); toolbarPanel.add(discoveryToolBar); // c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 0, 0, 0); gb.setConstraints(toolbarPanel, c); topPanel.add(toolbarPanel); // Panel containing context info like registry location and user context JPanel contextPanel = new JPanel(); GridBagLayout gb1 = new GridBagLayout(); contextPanel.setLayout(gb1); locationLabel = new JLabel(resourceBundle.getString("label.registryLocation")); // locationLabel.setPreferredSize(new Dimension(80, 23)); // c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.5; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 0, 0); gb1.setConstraints(locationLabel, c); // contextPanel.setBackground(Color.green); contextPanel.add(locationLabel); selectAnItemText = new ItemText(selectAnItem); registryCombo.addItem(selectAnItemText.toString()); ConfigurationType uiConfigurationType = UIUtility.getInstance().getConfigurationType(); RegistryURIListType urlList = uiConfigurationType.getRegistryURIList(); List<String> urls = urlList.getRegistryURI(); Iterator<String> urlsIter = urls.iterator(); while (urlsIter.hasNext()) { ItemText url = new ItemText(urlsIter.next()); registryCombo.addItem(url.toString()); } registryCombo.setEditable(true); registryCombo.setEnabled(true); registryCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final String url = (String) registryCombo.getSelectedItem(); if ((url == null) || (url.equals(selectAnItem))) { return; } // Clean tabbedPaneParent. Will create new content tabbedPaneParent.removeAll(); conceptsTreeDialog = null; ConceptsTreeDialog.clearCache(); // design: // 1. connect and construct tabbedPane in a now swing thread // 2. add tabbedPane in swing thread // 3. call reloadModel that should use WingWorkers final SwingWorker worker1 = new SwingWorker(RegistryBrowser.this) { public Object doNonUILogic() { try { // Try to connect if (connectToRegistry(url)) { return new JBTabbedPane(); } } catch (JAXRException e1) { displayError(e1); } return null; } public void doUIUpdateLogic() { tabbedPane = (JBTabbedPane) get(); if (tabbedPane != null) { tabbedPaneParent.add(tabbedPane, BorderLayout.CENTER); tabbedPane.reloadModel(); try { // DBH 1/30/04 - Add the submissions panel if // the user is authenticated. ConnectionImpl connection = RegistryBrowser.client.connection; boolean newValue = connection.isAuthenticated(); firePropertyChange(PROPERTY_AUTHENTICATED, false, newValue); getRootPane().updateUI(); } catch (JAXRException e1) { displayError(e1); } } } }; worker1.start(); } }); // c.gridx = 1; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.9; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(0, 0, 5, 0); gb1.setConstraints(registryCombo, c); contextPanel.add(registryCombo); JLabel currentUserLabel = new JLabel(resourceBundle.getString("label.currentUser"), SwingConstants.TRAILING); c.gridx = 2; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); gb1.setConstraints(currentUserLabel, c); // contextPanel.add(currentUserLabel); currentUserText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { @SuppressWarnings("unused") String text = currentUserText.getText(); } }); currentUserText.setEditable(false); c.gridx = 3; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.9; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 0, 5, 5); gb1.setConstraints(currentUserText, c); // contextPanel.add(currentUserText); c.gridx = 0; c.gridy = 1; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.9; c.weighty = 0.5; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.CENTER; c.insets = new Insets(0, 0, 0, 0); gb.setConstraints(contextPanel, c); topPanel.add(contextPanel, c); tabbedPaneParent.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); tabbedPaneParent.setLayout(new BorderLayout()); tabbedPaneParent.setToolTipText(resourceBundle.getString("tabbedPane.tip")); getContentPane().add("Center", tabbedPaneParent); fileMenu.setText(resourceBundle.getString("menu.file")); fileMenu.setActionCommand("File"); fileMenu.setMnemonic((int) 'F'); menuBar.add(fileMenu); saveItem.setHorizontalTextPosition(SwingConstants.TRAILING); saveItem.setText(resourceBundle.getString("menu.save")); saveItem.setActionCommand("Save"); saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); saveItem.setMnemonic((int) 'S'); // fileMenu.add(saveItem); fileMenu.add(JSeparator1); importItem.setText(resourceBundle.getString("menu.import")); importItem.setActionCommand("Import"); importItem.setMnemonic((int) 'I'); importItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RegistryBrowser.setWaitCursor(); importFromFile(); RegistryBrowser.setDefaultCursor(); } }); fileMenu.add(importItem); exitItem.setText(resourceBundle.getString("menu.exit")); exitItem.setActionCommand("Exit"); exitItem.setMnemonic((int) 'X'); fileMenu.add(exitItem); editMenu.setText(resourceBundle.getString("menu.edit")); editMenu.setActionCommand("Edit"); editMenu.setMnemonic((int) 'E'); // menuBar.add(editMenu); cutItem.setHorizontalTextPosition(SwingConstants.TRAILING); cutItem.setText(resourceBundle.getString("menu.cut")); cutItem.setActionCommand("Cut"); cutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK)); cutItem.setMnemonic((int) 'T'); editMenu.add(cutItem); copyItem.setHorizontalTextPosition(SwingConstants.TRAILING); copyItem.setText(resourceBundle.getString("menu.copy")); copyItem.setActionCommand("Copy"); copyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK)); copyItem.setMnemonic((int) 'C'); editMenu.add(copyItem); pasteItem.setHorizontalTextPosition(SwingConstants.TRAILING); pasteItem.setText(resourceBundle.getString("menu.paste")); pasteItem.setActionCommand("Paste"); pasteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK)); pasteItem.setMnemonic((int) 'P'); editMenu.add(pasteItem); viewMenu.setText(resourceBundle.getString("menu.view")); viewMenu.setActionCommand("view"); viewMenu.setMnemonic((int) 'V'); themeMenu = new MetalThemeMenu(resourceBundle.getString("menu.theme"), themes); viewMenu.add(themeMenu); menuBar.add(viewMenu); helpMenu.setText(resourceBundle.getString("menu.help")); helpMenu.setActionCommand("Help"); helpMenu.setMnemonic((int) 'H'); menuBar.add(helpMenu); aboutItem.setHorizontalTextPosition(SwingConstants.TRAILING); aboutItem.setText(resourceBundle.getString("menu.about")); aboutItem.setActionCommand("About..."); aboutItem.setMnemonic((int) 'A'); aboutItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object[] aboutArgs = { BROWSER_VERSION }; MessageFormat form = new MessageFormat(resourceBundle.getString("dialog.about.text")); JOptionPane.showMessageDialog(RegistryBrowser.this, form.format(aboutArgs), resourceBundle.getString("dialog.about.title"), JOptionPane.INFORMATION_MESSAGE); } }); helpMenu.add(aboutItem); // REGISTER_LISTENERS SymWindow aSymWindow = new SymWindow(); this.addWindowListener(aSymWindow); SymAction lSymAction = new SymAction(); saveItem.addActionListener(lSymAction); exitItem.addActionListener(lSymAction); SwingUtilities.updateComponentTreeUI(getContentPane()); SwingUtilities.updateComponentTreeUI(menuBar); SwingUtilities.updateComponentTreeUI(fileChooser); // Auto select the registry that is configured to connect to by default String selectedIndexStr = ProviderProperties.getInstance() .getProperty("jaxr-ebxml.registryBrowser.registryLocationCombo.initialSelectionIndex", "0"); int index = Integer.parseInt(selectedIndexStr); try { registryCombo.setSelectedIndex(index); } catch (IllegalArgumentException e) { Object[] invalidIndexArguments = { new Integer(index) }; MessageFormat form = new MessageFormat(resourceBundle.getString("message.error.invalidIndex")); displayError(form.format(invalidIndexArguments), e); } }
From source file:jeplus.gui.EPlusEditorPanel.java
/** * This method is called from within the constructor to initialise the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from ww w . ja v a 2 s . c o m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { rTextScrollPane1 = new org.fife.ui.rtextarea.RTextScrollPane(); rsTextArea = new org.fife.ui.rsyntaxtextarea.RSyntaxTextArea(); jToolBar1 = new javax.swing.JToolBar(); cmdLoad = new javax.swing.JButton(); cmdCheck = new javax.swing.JButton(); cmdSave = new javax.swing.JButton(); jSeparator2 = new javax.swing.JToolBar.Separator(); jLabel2 = new javax.swing.JLabel(); cboSearchStrings = new javax.swing.JComboBox(); cmdRefresh = new javax.swing.JButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); jLabel1 = new javax.swing.JLabel(); searchField = new javax.swing.JTextField(); prevButton = new javax.swing.JButton(); nextButton = new javax.swing.JButton(); jSeparator3 = new javax.swing.JToolBar.Separator(); regexCB = new javax.swing.JCheckBox(); matchCaseCB = new javax.swing.JCheckBox(); setLayout(new java.awt.BorderLayout()); rsTextArea.setColumns(60); rsTextArea.setRows(20); rsTextArea.setToolTipText(""); rsTextArea.setCodeFoldingEnabled(true); rTextScrollPane1.setViewportView(rsTextArea); add(rTextScrollPane1, java.awt.BorderLayout.CENTER); jToolBar1.setFloatable(false); jToolBar1.setRollover(true); jToolBar1.setMinimumSize(new java.awt.Dimension(0, 0)); cmdLoad.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jeplus/images/folder.png"))); // NOI18N cmdLoad.setToolTipText("Open a new file or reload the current file."); cmdLoad.setFocusable(false); cmdLoad.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cmdLoad.setMargin(new java.awt.Insets(2, 2, 2, 2)); cmdLoad.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmdLoadActionPerformed(evt); } }); jToolBar1.add(cmdLoad); cmdCheck.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jeplus/images/check.png"))); // NOI18N cmdCheck.setFocusable(false); cmdCheck.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cmdCheck.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); cmdCheck.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmdCheckActionPerformed(evt); } }); jToolBar1.add(cmdCheck); cmdSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jeplus/images/save1.png"))); // NOI18N cmdSave.setToolTipText("Save the current file"); cmdSave.setFocusable(false); cmdSave.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cmdSave.setMargin(new java.awt.Insets(2, 2, 2, 2)); cmdSave.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmdSaveActionPerformed(evt); } }); jToolBar1.add(cmdSave); jSeparator2.setForeground(new java.awt.Color(153, 153, 153)); jSeparator2.setMaximumSize(new java.awt.Dimension(60, 32767)); jSeparator2.setPreferredSize(new java.awt.Dimension(30, 0)); jToolBar1.add(jSeparator2); jLabel2.setText("Tags: "); jToolBar1.add(jLabel2); cboSearchStrings.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cboSearchStrings.setToolTipText("Select a search string to locate it in the file."); cboSearchStrings.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cboSearchStringsActionPerformed(evt); } }); jToolBar1.add(cboSearchStrings); cmdRefresh.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jeplus/images/view-refresh.png"))); // NOI18N cmdRefresh.setToolTipText("Update search strings from the project."); cmdRefresh.setFocusable(false); cmdRefresh.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cmdRefresh.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); cmdRefresh.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmdRefreshActionPerformed(evt); } }); jToolBar1.add(cmdRefresh); jSeparator1.setMaximumSize(new java.awt.Dimension(60, 32767)); jSeparator1.setPreferredSize(new java.awt.Dimension(30, 0)); jToolBar1.add(jSeparator1); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel1.setText("Text search: "); jLabel1.setMaximumSize(new java.awt.Dimension(80, 14)); jToolBar1.add(jLabel1); searchField.setColumns(30); searchField.setToolTipText("Text search"); searchField.setMaximumSize(new java.awt.Dimension(100, 25)); searchField.setPreferredSize(new java.awt.Dimension(200, 20)); jToolBar1.add(searchField); prevButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jeplus/images/go-previous.png"))); // NOI18N prevButton.setToolTipText("Search backwards from the cursor."); prevButton.setFocusable(false); prevButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jToolBar1.add(prevButton); nextButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jeplus/images/go-next.png"))); // NOI18N nextButton.setToolTipText("Search forward from the cursor."); nextButton.setFocusable(false); nextButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jToolBar1.add(nextButton); jSeparator3.setMaximumSize(new java.awt.Dimension(60, 32767)); jSeparator3.setPreferredSize(new java.awt.Dimension(30, 0)); jToolBar1.add(jSeparator3); regexCB.setText("Regex"); regexCB.setToolTipText("Use Regular Expression. For an example, try search \"@@.*@@\""); regexCB.setFocusable(false); regexCB.setMaximumSize(new java.awt.Dimension(120, 31)); regexCB.setPreferredSize(new java.awt.Dimension(80, 31)); jToolBar1.add(regexCB); matchCaseCB.setText("Match case"); matchCaseCB.setToolTipText("Match cases in search"); matchCaseCB.setFocusable(false); matchCaseCB.setMaximumSize(new java.awt.Dimension(120, 15)); matchCaseCB.setPreferredSize(new java.awt.Dimension(90, 15)); jToolBar1.add(matchCaseCB); add(jToolBar1, java.awt.BorderLayout.PAGE_START); }