Example usage for javax.swing.border EtchedBorder EtchedBorder

List of usage examples for javax.swing.border EtchedBorder EtchedBorder

Introduction

In this page you can find the example usage for javax.swing.border EtchedBorder EtchedBorder.

Prototype

@ConstructorProperties({ "etchType", "highlightColor", "shadowColor" })
public EtchedBorder(int etchType, Color highlight, Color shadow) 

Source Link

Document

Creates an etched border with the specified etch-type, highlight and shadow colors.

Usage

From source file:com.floreantpos.ui.model.MenuItemForm.java

/** This method is called from within the constructor to
 * initialize the form.//from   w  w w. j a v  a2 s  .co  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:org.fhaes.gui.AnalysisResultsPanel.java

/**
 * Set up the AnalysisResults GUI/*from  w w  w . ja va  2  s  .c  o m*/
 */
private void initGUI() {

    setLayout(new BorderLayout(0, 0));
    if (Platform.isOSX())
        setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    ImageIcon iconMultipleTables = Builder.getImageIcon("multipletables16.png");
    ImageIcon iconTable = Builder.getImageIcon("table16.png");

    // ImageIcon iconChart = Builder.getImageIcon("chart16.png");

    // Categories
    rootNode = new FHAESCategoryTreeNode("FHAES analysis results");
    categoryGeneral = new FHAESCategoryTreeNode("Descriptive summaries",
            Builder.getImageIcon("interval16.png"));
    categoryInterval = new FHAESCategoryTreeNode("Interval analysis", Builder.getImageIcon("interval16.png"));
    categorySeasonality = new FHAESCategoryTreeNode("Seasonality", Builder.getImageIcon("seasonality16.png"));
    categoryBinarySummaryMatrices = new FHAESCategoryTreeNode("Binary summary matrices",
            Builder.getImageIcon("matrix16.png"));
    categoryBinaryMatrices = new FHAESCategoryTreeNode("Binary comparison matrices",
            Builder.getImageIcon("matrix16.png"));
    categorySimMatrices = new FHAESCategoryTreeNode("Similarity matrices",
            Builder.getImageIcon("matrix16.png"));
    categoryDisSimMatrices = new FHAESCategoryTreeNode("Dissimilarity matrices",
            Builder.getImageIcon("matrix16.png"));

    // Menu actions

    // Results

    itemJaccard = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX, iconMultipleTables);
    itemJaccard.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(SJACFile, new CSVFileFilter());
        }
    });

    itemCohen = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX, iconMultipleTables);
    itemCohen.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(SCOHFile, new CSVFileFilter());
        }
    });

    itemJaccardD = new FHAESResultTreeNode(FHAESResult.JACCARD_SIMILARITY_MATRIX_D, iconMultipleTables);
    itemJaccardD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(DSJACFile, new CSVFileFilter());
        }
    });

    itemCohenD = new FHAESResultTreeNode(FHAESResult.COHEN_SIMILARITITY_MATRIX_D, iconMultipleTables);
    itemCohenD.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(DSCOHFile, new CSVFileFilter());
        }
    });

    itemIntervalSummary = new FHAESResultTreeNode(FHAESResult.INTERVAL_SUMMARY, iconMultipleTables);
    itemIntervalSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(intervalsSummaryFile, new CSVFileFilter());
        }
    });

    itemExceedence = new FHAESResultTreeNode(FHAESResult.INTERVAL_EXCEEDENCE_TABLE, iconMultipleTables);
    itemExceedence.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(intervalsExceedenceFile, new CSVFileFilter());
        }
    });

    itemSeasonalitySummary = new FHAESResultTreeNode(FHAESResult.SEASONALITY_SUMMARY, iconMultipleTables);
    itemSeasonalitySummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(seasonalitySummaryFile, new CSVFileFilter());
        }
    });

    itemBin00 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_00, iconMultipleTables);
    itemBin00.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin00File, new CSVFileFilter());
        }
    });

    itemBin01 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_01, iconMultipleTables);
    itemBin01.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin01File, new CSVFileFilter());
        }
    });

    itemBin10 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_10, iconMultipleTables);
    itemBin10.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin10File, new CSVFileFilter());
        }
    });

    itemBin11 = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_11, iconMultipleTables);
    itemBin11.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(bin11File, new CSVFileFilter());
        }
    });

    itemBinSum = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SUM, iconMultipleTables);
    itemBinSum.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(binSumFile, new CSVFileFilter());
        }

    });
    itemBinSiteSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_SITE, iconMultipleTables);
    itemBinSiteSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(siteSummaryFile, new CSVFileFilter());
        }
    });
    itemBinSiteSummary.addAction(new FHAESAction("Export to shapefile", "formatshp.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            new ShapeFileDialog(App.mainFrame, fhm);

        }
    });

    itemBinTreeSummary = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_TREE, iconMultipleTables);
    itemBinTreeSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(treeSummaryFile, new CSVFileFilter());
        }
    });

    itemNTP = new FHAESResultTreeNode(FHAESResult.BINARY_MATRIX_NTP, iconMultipleTables);
    itemNTP.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(NTPFile, new CSVFileFilter());
        }
    });

    this.itemGeneralSummary = new FHAESResultTreeNode(FHAESResult.GENERAL_SUMMARY, iconMultipleTables);
    itemGeneralSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(generalSummaryFile, new CSVFileFilter());
        }

    });

    this.itemSingleFileSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_FILE_SUMMARY, iconTable);
    itemSingleFileSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(singleFileSummaryFile, new CSVFileFilter());
        }

    });

    this.itemSingleEventSummary = new FHAESResultTreeNode(FHAESResult.SINGLE_EVENT_SUMMARY, iconTable);
    itemSingleEventSummary.addAction(new FHAESAction("Save to CSV", "formatcsv.png") {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {

            saveFileToDisk(singleEventSummaryFile, new CSVFileFilter());
        }

    });

    // Add results to categories
    categoryGeneral.add(itemGeneralSummary);
    categoryGeneral.add(itemSingleFileSummary);
    categoryGeneral.add(itemSingleEventSummary);
    categorySimMatrices.add(itemJaccard);
    categorySimMatrices.add(itemCohen);
    categoryDisSimMatrices.add(itemJaccardD);
    categoryDisSimMatrices.add(itemCohenD);
    categoryInterval.add(itemIntervalSummary);
    categoryInterval.add(itemExceedence);
    categorySeasonality.add(itemSeasonalitySummary);
    categoryBinaryMatrices.add(itemBin11);
    categoryBinaryMatrices.add(itemBin01);
    categoryBinaryMatrices.add(itemBin10);
    categoryBinaryMatrices.add(itemBin00);
    categoryBinaryMatrices.add(itemBinSum);
    categoryBinarySummaryMatrices.add(itemBinSiteSummary);
    categoryBinarySummaryMatrices.add(itemBinTreeSummary);
    categoryBinarySummaryMatrices.add(itemNTP);

    // Add categories to root of tree
    rootNode.add(categoryGeneral);
    rootNode.add(categoryInterval);
    rootNode.add(categorySeasonality);
    rootNode.add(categoryBinarySummaryMatrices);
    rootNode.add(categoryBinaryMatrices);
    rootNode.add(categorySimMatrices);
    rootNode.add(categoryDisSimMatrices);

    treeModel = new DefaultTreeModel(rootNode);

    splitPane = new JSplitPane();
    if (Platform.isOSX())
        splitPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    splitPane.setResizeWeight(0.9);
    add(splitPane, BorderLayout.CENTER);

    JPanel panelTree = new JPanel();
    splitPane.setRightComponent(panelTree);
    panelTree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
    panelTree.setLayout(new BorderLayout(0, 0));

    // Build tree
    treeResults = new JTree();
    panelTree.add(treeResults);
    treeResults.setModel(treeModel);

    treeResults.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    treeResults.setCellRenderer(new FHAESResultTreeRenderer());

    pickResultPanel = new PickResultPanel();
    runAnalysisPanel = new RunAnalysisPanel();

    cards = new JPanel();
    cl = new CardLayout();
    cards.setLayout(cl);
    cards.add(pickResultPanel, PICKRESULTPANEL);
    cards.add(runAnalysisPanel, RUNANALYSIS);
    cards.add(emptyPanel, EMPTYPANEL);

    splitPane.setLeftComponent(cards);

    cl.show(cards, RUNANALYSIS);

    splitPaneResult = new JSplitPane();
    splitPaneResult.setOneTouchExpandable(true);
    splitPaneResult.setOrientation(JSplitPane.VERTICAL_SPLIT);
    cards.add(splitPaneResult, RESULTSPANEL);

    panelResult = new JPanel();

    panelResult.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panelResult.setLayout(new BorderLayout(0, 0));

    goldFishPanel = new GoldFishPanel();
    splitPaneResult.setRightComponent(goldFishPanel);

    // Build table
    scrollPane = new JScrollPane();

    panelResult.add(scrollPane);
    table = new JXTable();
    adapter = new JTableSpreadsheetByRowAdapter(table);

    table.setModel(new DefaultTableModel());
    table.setHorizontalScrollEnabled(true);
    scrollPane.setViewportView(table);
    splitPaneResult.setLeftComponent(panelResult);

    // OSX Style hack
    if (Platform.isOSX())
        panelResult.setBackground(MainWindow.MAC_BACKGROUND_COLOR);
    if (Platform.isOSX())
        scrollPane.setBackground(MainWindow.MAC_BACKGROUND_COLOR);

    // Expand all nodes
    for (int i = 0; i < treeResults.getRowCount(); i++) {
        treeResults.expandRow(i);
    }

    treeResults.addTreeSelectionListener(this);

    treeResults.addMouseListener(new MouseListener() {

        @Override
        public void mouseClicked(MouseEvent e) {

            if (SwingUtilities.isRightMouseButton(e)) {
                int x = e.getX();
                int y = e.getY();
                JTree tree = (JTree) e.getSource();
                TreePath path = tree.getPathForLocation(x, y);
                if (path == null)
                    return;
                if (!tree.isEnabled())
                    return;

                tree.setSelectionPath(path);
                Component mc = e.getComponent();

                if (path != null && path.getLastPathComponent() instanceof FHAESResultTreeNode) {
                    FHAESResultTreeNode node = (FHAESResultTreeNode) path.getLastPathComponent();

                    if (!node.isEnabled())
                        return;

                    FHAESResultPopupMenu popupMenu = new FHAESResultPopupMenu(node.getArrayOfActions());
                    popupMenu.show(mc, e.getX(), e.getY());
                }
            }
        }

        @Override
        public void mouseEntered(MouseEvent arg0) {

        }

        @Override
        public void mouseExited(MouseEvent arg0) {

        }

        @Override
        public void mousePressed(MouseEvent arg0) {

        }

        @Override
        public void mouseReleased(MouseEvent arg0) {

        }

    });

    this.splitPaneResult.setDividerLocation(10000);
    this.splitPaneResult.setDividerSize(3);
    this.splitPaneResult.setResizeWeight(1);
}

From source file:org.jtrfp.trcl.gui.ConfigWindow.java

public ConfigWindow() {
    setTitle("Settings");
    setSize(340, 540);/*from  w  w  w  .  j ava2  s.  c om*/
    if (config == null)
        config = new TRConfiguration();
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    JPanel generalTab = new JPanel();
    tabbedPane.addTab("General",
            new ImageIcon(ConfigWindow.class
                    .getResource("/org/freedesktop/tango/22x22/mimetypes/application-x-executable.png")),
            generalTab, null);
    GridBagLayout gbl_generalTab = new GridBagLayout();
    gbl_generalTab.columnWidths = new int[] { 0, 0 };
    gbl_generalTab.rowHeights = new int[] { 0, 188, 222, 0 };
    gbl_generalTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_generalTab.rowWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
    generalTab.setLayout(gbl_generalTab);

    JPanel settingsLoadSavePanel = new JPanel();
    GridBagConstraints gbc_settingsLoadSavePanel = new GridBagConstraints();
    gbc_settingsLoadSavePanel.insets = new Insets(0, 0, 5, 0);
    gbc_settingsLoadSavePanel.anchor = GridBagConstraints.WEST;
    gbc_settingsLoadSavePanel.gridx = 0;
    gbc_settingsLoadSavePanel.gridy = 0;
    generalTab.add(settingsLoadSavePanel, gbc_settingsLoadSavePanel);
    settingsLoadSavePanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Overall Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    FlowLayout flowLayout_1 = (FlowLayout) settingsLoadSavePanel.getLayout();
    flowLayout_1.setAlignment(FlowLayout.LEFT);

    JButton btnSave = new JButton("Export...");
    btnSave.setToolTipText("Export these settings to an external file");
    settingsLoadSavePanel.add(btnSave);
    btnSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            exportSettings();
        }
    });

    JButton btnLoad = new JButton("Import...");
    btnLoad.setToolTipText("Import an external settings file");
    settingsLoadSavePanel.add(btnLoad);
    btnLoad.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            importSettings();
        }
    });

    JButton btnConfigReset = new JButton("Reset");
    btnConfigReset.setToolTipText("Reset all settings to defaults");
    settingsLoadSavePanel.add(btnConfigReset);
    btnConfigReset.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            defaultSettings();
        }
    });

    JPanel registeredPODsPanel = new JPanel();
    registeredPODsPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Registered PODs", TitledBorder.LEFT, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_registeredPODsPanel = new GridBagConstraints();
    gbc_registeredPODsPanel.insets = new Insets(0, 0, 5, 0);
    gbc_registeredPODsPanel.fill = GridBagConstraints.BOTH;
    gbc_registeredPODsPanel.gridx = 0;
    gbc_registeredPODsPanel.gridy = 1;
    generalTab.add(registeredPODsPanel, gbc_registeredPODsPanel);
    GridBagLayout gbl_registeredPODsPanel = new GridBagLayout();
    gbl_registeredPODsPanel.columnWidths = new int[] { 272, 0 };
    gbl_registeredPODsPanel.rowHeights = new int[] { 76, 0, 0 };
    gbl_registeredPODsPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_registeredPODsPanel.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
    registeredPODsPanel.setLayout(gbl_registeredPODsPanel);

    JPanel podListPanel = new JPanel();
    GridBagConstraints gbc_podListPanel = new GridBagConstraints();
    gbc_podListPanel.insets = new Insets(0, 0, 5, 0);
    gbc_podListPanel.fill = GridBagConstraints.BOTH;
    gbc_podListPanel.gridx = 0;
    gbc_podListPanel.gridy = 0;
    registeredPODsPanel.add(podListPanel, gbc_podListPanel);
    podListPanel.setLayout(new BorderLayout(0, 0));

    JScrollPane podListScrollPane = new JScrollPane();
    podListPanel.add(podListScrollPane, BorderLayout.CENTER);

    podList = new JList(podLM);
    podList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    podListScrollPane.setViewportView(podList);

    JPanel podListOpButtonPanel = new JPanel();
    podListOpButtonPanel.setBorder(null);
    GridBagConstraints gbc_podListOpButtonPanel = new GridBagConstraints();
    gbc_podListOpButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_podListOpButtonPanel.gridx = 0;
    gbc_podListOpButtonPanel.gridy = 1;
    registeredPODsPanel.add(podListOpButtonPanel, gbc_podListOpButtonPanel);
    FlowLayout flowLayout = (FlowLayout) podListOpButtonPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);

    JButton addPodButton = new JButton("Add...");
    addPodButton.setIcon(
            new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png")));
    addPodButton.setToolTipText("Add a POD to the registry to be considered when running a game.");
    podListOpButtonPanel.add(addPodButton);
    addPodButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addPOD();
        }
    });

    JButton removePodButton = new JButton("Remove");
    removePodButton.setIcon(new ImageIcon(
            ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png")));
    removePodButton.setToolTipText("Remove a POD file from being considered when playing a game");
    podListOpButtonPanel.add(removePodButton);
    removePodButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            podLM.removeElement(podList.getSelectedValue());
        }
    });

    JButton podEditButton = new JButton("Edit...");
    podEditButton.setIcon(null);
    podEditButton.setToolTipText("Edit the selected POD path");
    podListOpButtonPanel.add(podEditButton);
    podEditButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            editPODPath();
        }
    });

    JPanel missionPanel = new JPanel();
    GridBagConstraints gbc_missionPanel = new GridBagConstraints();
    gbc_missionPanel.fill = GridBagConstraints.BOTH;
    gbc_missionPanel.gridx = 0;
    gbc_missionPanel.gridy = 2;
    generalTab.add(missionPanel, gbc_missionPanel);
    missionPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Missions",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagLayout gbl_missionPanel = new GridBagLayout();
    gbl_missionPanel.columnWidths = new int[] { 0, 0 };
    gbl_missionPanel.rowHeights = new int[] { 0, 0, 0 };
    gbl_missionPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_missionPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
    missionPanel.setLayout(gbl_missionPanel);

    JScrollPane scrollPane = new JScrollPane();
    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 0;
    gbc_scrollPane.gridy = 0;
    missionPanel.add(scrollPane, gbc_scrollPane);

    missionList = new JList(missionLM);
    missionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(missionList);

    JPanel missionListOpButtonPanel = new JPanel();
    GridBagConstraints gbc_missionListOpButtonPanel = new GridBagConstraints();
    gbc_missionListOpButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_missionListOpButtonPanel.gridx = 0;
    gbc_missionListOpButtonPanel.gridy = 1;
    missionPanel.add(missionListOpButtonPanel, gbc_missionListOpButtonPanel);

    JButton addVOXButton = new JButton("Add...");
    addVOXButton.setIcon(
            new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png")));
    addVOXButton.setToolTipText("Add an external VOX file as a mission");
    missionListOpButtonPanel.add(addVOXButton);
    addVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addVOX();
        }
    });

    final JButton removeVOXButton = new JButton("Remove");
    removeVOXButton.setIcon(new ImageIcon(
            ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png")));
    removeVOXButton.setToolTipText("Remove the selected mission");
    missionListOpButtonPanel.add(removeVOXButton);
    removeVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            missionLM.remove(missionList.getSelectedIndex());
        }
    });

    final JButton editVOXButton = new JButton("Edit...");
    editVOXButton.setToolTipText("Edit the selected Mission's VOX path");
    missionListOpButtonPanel.add(editVOXButton);
    editVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            editVOXPath();
        }
    });

    missionList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            final String val = (String) missionList.getSelectedValue();
            if (val == null)
                missionList.setSelectedIndex(0);
            else if (isBuiltinVOX(val)) {
                removeVOXButton.setEnabled(false);
                editVOXButton.setEnabled(false);
            } else {
                removeVOXButton.setEnabled(true);
                editVOXButton.setEnabled(true);
            }
        }
    });

    JPanel soundTab = new JPanel();
    tabbedPane.addTab("Sound",
            new ImageIcon(
                    ConfigWindow.class.getResource("/org/freedesktop/tango/22x22/devices/audio-card.png")),
            soundTab, null);
    GridBagLayout gbl_soundTab = new GridBagLayout();
    gbl_soundTab.columnWidths = new int[] { 0, 0 };
    gbl_soundTab.rowHeights = new int[] { 65, 51, 70, 132, 0, 0, 0 };
    gbl_soundTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_soundTab.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
    soundTab.setLayout(gbl_soundTab);

    JPanel checkboxPanel = new JPanel();
    GridBagConstraints gbc_checkboxPanel = new GridBagConstraints();
    gbc_checkboxPanel.insets = new Insets(0, 0, 5, 0);
    gbc_checkboxPanel.fill = GridBagConstraints.BOTH;
    gbc_checkboxPanel.gridx = 0;
    gbc_checkboxPanel.gridy = 0;
    soundTab.add(checkboxPanel, gbc_checkboxPanel);

    chckbxLinearInterpolation = new JCheckBox("Linear Filtering");
    chckbxLinearInterpolation.setToolTipText("Use the GPU's TMU to smooth playback of low-rate samples.");
    chckbxLinearInterpolation.setHorizontalAlignment(SwingConstants.LEFT);
    checkboxPanel.add(chckbxLinearInterpolation);

    chckbxLinearInterpolation.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            needRestart = true;
        }
    });

    chckbxBufferLag = new JCheckBox("Buffer Lag");
    chckbxBufferLag.setToolTipText("Improves efficiency, doubles latency.");
    checkboxPanel.add(chckbxBufferLag);

    JPanel modStereoWidthPanel = new JPanel();
    FlowLayout flowLayout_2 = (FlowLayout) modStereoWidthPanel.getLayout();
    flowLayout_2.setAlignment(FlowLayout.LEFT);
    modStereoWidthPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "MOD Stereo Width", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_modStereoWidthPanel = new GridBagConstraints();
    gbc_modStereoWidthPanel.anchor = GridBagConstraints.NORTH;
    gbc_modStereoWidthPanel.insets = new Insets(0, 0, 5, 0);
    gbc_modStereoWidthPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_modStereoWidthPanel.gridx = 0;
    gbc_modStereoWidthPanel.gridy = 1;
    soundTab.add(modStereoWidthPanel, gbc_modStereoWidthPanel);

    modStereoWidthSlider = new JSlider();
    modStereoWidthSlider.setPaintTicks(true);
    modStereoWidthSlider.setMinorTickSpacing(25);
    modStereoWidthPanel.add(modStereoWidthSlider);

    final JLabel modStereoWidthLbl = new JLabel("NN%");
    modStereoWidthPanel.add(modStereoWidthLbl);

    JPanel bufferSizePanel = new JPanel();
    FlowLayout flowLayout_3 = (FlowLayout) bufferSizePanel.getLayout();
    flowLayout_3.setAlignment(FlowLayout.LEFT);
    bufferSizePanel.setBorder(
            new TitledBorder(null, "Buffer Size", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_bufferSizePanel = new GridBagConstraints();
    gbc_bufferSizePanel.anchor = GridBagConstraints.NORTH;
    gbc_bufferSizePanel.insets = new Insets(0, 0, 5, 0);
    gbc_bufferSizePanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_bufferSizePanel.gridx = 0;
    gbc_bufferSizePanel.gridy = 2;
    soundTab.add(bufferSizePanel, gbc_bufferSizePanel);

    audioBufferSizeCB = new JComboBox();
    audioBufferSizeCB.setModel(new DefaultComboBoxModel(AudioBufferSize.values()));
    bufferSizePanel.add(audioBufferSizeCB);

    soundOutputSelectorGUI = new SoundOutputSelectorGUI();
    soundOutputSelectorGUI.setBorder(
            new TitledBorder(null, "Output Driver", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_soundOutputSelectorGUI = new GridBagConstraints();
    gbc_soundOutputSelectorGUI.anchor = GridBagConstraints.NORTH;
    gbc_soundOutputSelectorGUI.insets = new Insets(0, 0, 5, 0);
    gbc_soundOutputSelectorGUI.fill = GridBagConstraints.HORIZONTAL;
    gbc_soundOutputSelectorGUI.gridx = 0;
    gbc_soundOutputSelectorGUI.gridy = 3;
    soundTab.add(soundOutputSelectorGUI, gbc_soundOutputSelectorGUI);

    modStereoWidthSlider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            modStereoWidthLbl.setText(modStereoWidthSlider.getValue() + "%");
            needRestart = true;
        }
    });

    JPanel okCancelPanel = new JPanel();
    getContentPane().add(okCancelPanel, BorderLayout.SOUTH);
    okCancelPanel.setLayout(new BorderLayout(0, 0));

    JButton btnOk = new JButton("OK");
    btnOk.setToolTipText("Apply these settings and close the window");
    okCancelPanel.add(btnOk, BorderLayout.WEST);
    btnOk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            applySettings();
            ConfigWindow.this.setVisible(false);
        }
    });

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setToolTipText("Close the window without applying settings");
    okCancelPanel.add(btnCancel, BorderLayout.EAST);

    JLabel lblConfigpath = new JLabel(TRConfiguration.getConfigFilePath().getAbsolutePath());
    lblConfigpath.setIcon(null);
    lblConfigpath.setToolTipText("Default config file path");
    lblConfigpath.setHorizontalAlignment(SwingConstants.CENTER);
    lblConfigpath.setFont(new Font("Dialog", Font.BOLD, 6));
    okCancelPanel.add(lblConfigpath, BorderLayout.CENTER);
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            ConfigWindow.this.setVisible(false);
        }
    });
}

From source file:org.tellervo.desktop.io.ImportDialog.java

private void initGui() {
    setTitle("Import to Database");
    setBounds(100, 100, 804, 734);/*from ww w  . j a va2 s . c om*/

    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        horizSplitPane = new JSplitPane();
        horizSplitPane.setOneTouchExpandable(true);
        horizSplitPane.setBorder(null);
        horizSplitPane.setDividerLocation(0.4);
        contentPanel.add(horizSplitPane);
        {
            splitPaneVert = new JSplitPane();
            splitPaneVert.setOneTouchExpandable(true);
            splitPaneVert.setBorder(null);
            splitPaneVert.setOrientation(JSplitPane.VERTICAL_SPLIT);
            horizSplitPane.setLeftComponent(splitPaneVert);
            {
                panelTreeTable = new JPanel();
                panelTreeTable.setBorder(new TitledBorder(null, "TRiDaS Representation", TitledBorder.LEADING,
                        TitledBorder.TOP, null, null));
                splitPaneVert.setLeftComponent(panelTreeTable);
                panelTreeTable.setLayout(new BorderLayout(0, 0));
                {
                    JButton btnSetFromDB = new JButton("Set current entity from database");
                    panelTreeTable.add(btnSetFromDB, BorderLayout.SOUTH);
                }
            }
            {
                panelWarnings = new JPanel();
                panelWarnings.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
                        "Warnings", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
                splitPaneVert.setRightComponent(panelWarnings);
                panelWarnings.setLayout(new BorderLayout(0, 0));
                {
                    JScrollPane scrollPane = new JScrollPane();
                    panelWarnings.add(scrollPane, BorderLayout.CENTER);
                    {
                        tblWarnings = new JTable();
                        scrollPane.setViewportView(tblWarnings);
                    }
                }
            }
        }
        {
            tabbedPane = new JTabbedPane(JTabbedPane.TOP);
            tabbedPane.setBorder(null);
            horizSplitPane.setRightComponent(tabbedPane);
            {
                JPanel panelMetadata = new JPanel();
                panelMetadata.setLayout(new BorderLayout());
                initPropertiesPanel();

                panelMetadata.add(propertiesPanel, BorderLayout.CENTER);
                tabbedPane.addTab("Metadata", null, panelMetadata, null);

            }
            {
                JPanel panelData = new JPanel();
                tabbedPane.addTab("Data", null, panelData, null);
                tabbedPane.setEnabledAt(1, false);
            }
            {
                panelOrigFile = new JPanel();
                tabbedPane.addTab("Original file", null, panelOrigFile, null);
                panelOrigFile.setLayout(new BorderLayout(0, 0));
                {
                    DefaultSyntaxKit.initKit();

                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    panelOrigFile.add(scrollPane, BorderLayout.CENTER);

                    originalFilePane = new JTextArea();
                    scrollPane.setViewportView(originalFilePane);
                    originalFilePane.setEditable(false);
                    originalFilePane.setFont(new java.awt.Font("Courier", 0, 12));
                }
            }
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton button = new JButton("Finish");
            buttonPane.add(button);
        }
    }
}