Example usage for javax.swing JLabel setHorizontalAlignment

List of usage examples for javax.swing JLabel setHorizontalAlignment

Introduction

In this page you can find the example usage for javax.swing JLabel setHorizontalAlignment.

Prototype

@BeanProperty(visualUpdate = true, enumerationValues = { "SwingConstants.LEFT", "SwingConstants.CENTER",
        "SwingConstants.RIGHT", "SwingConstants.LEADING",
        "SwingConstants.TRAILING" }, description = "The alignment of the label's content along the X axis.")
public void setHorizontalAlignment(int alignment) 

Source Link

Document

Sets the alignment of the label's contents along the X axis.

Usage

From source file:com.diversityarrays.kdxplore.curate.SampleEntryPanel.java

SampleEntryPanel(CurationData cd, IntFunction<Trait> traitProvider, TypedSampleMeasurementTableModel tsm,
        JTable table, TsmCellRenderer tsmCellRenderer, JToggleButton showPpiOption,
        Closure<Void> refreshFieldLayoutView,
        BiConsumer<Comparable<?>, List<CurationCellValue>> showChangedValue, SampleType[] sampleTypes) {
    this.curationData = cd;
    this.traitProvider = traitProvider;
    this.typedSampleTableModel = tsm;
    this.typedSampleTable = table;

    this.showPpiOption = showPpiOption;

    this.initialTableRowHeight = typedSampleTable.getRowHeight();
    this.tsmCellRenderer = tsmCellRenderer;
    this.refreshFieldLayoutView = refreshFieldLayoutView;
    this.showChangedValue = showChangedValue;

    List<SampleType> list = new ArrayList<>();
    list.add(NO_SAMPLE_TYPE);/*from www .ja  va2s.c  o m*/
    for (SampleType st : sampleTypes) {
        list.add(st);
        sampleTypeById.put(st.getTypeId(), st);
    }

    sampleTypeCombo = new JComboBox<SampleType>(list.toArray(new SampleType[list.size()]));

    typedSampleTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (TableModelEvent.HEADER_ROW == e.getFirstRow()) {
                typedSampleTable.setAutoCreateColumnsFromModel(true);
                everSetData = false;
            }
        }
    });

    showStatsAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_STATS_FOR_KDSMART_SAMPLES());
    showStatsOption.setFont(showStatsOption.getFont().deriveFont(Font.BOLD));
    showStatsOption.setPreferredSize(new Dimension(30, 30));

    JLabel helpPanel = new JLabel();
    helpPanel.setHorizontalAlignment(JLabel.CENTER);
    String html = "<HTML>Either enter a value or select<br>a <i>Source</i> for <b>Value From:</b>";
    if (shouldShowSampleType(sampleTypes)) {
        html += "<BR>You may also select a <i>Sample Type</i> if it is relevant.";
    }
    helpPanel.setText(html);

    singleOrMultiCardPanel.add(helpPanel, CARD_SINGLE);
    singleOrMultiCardPanel.add(applyToPanel, CARD_MULTI);
    //        singleOrMultiCardPanel.add(multiCellControlsPanel, CARD_MULTI);

    validationMessage.setBorder(new LineBorder(Color.LIGHT_GRAY));
    validationMessage.setForeground(Color.RED);
    validationMessage.setBackground(new JLabel().getBackground());
    validationMessage.setHorizontalAlignment(SwingConstants.CENTER);
    //      validationMessage.setEditable(false);
    Box setButtons = Box.createHorizontalBox();
    setButtons.add(new JButton(deleteAction));
    setButtons.add(new JButton(notApplicableAction));
    setButtons.add(new JButton(missingAction));
    setButtons.add(new JButton(setValueAction));

    deleteAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_UNSET());
    notApplicableAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_NA());
    missingAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_MISSING());
    setValueAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_VALUE());

    Box sampleType = Box.createHorizontalBox();
    sampleType.add(new JLabel(Vocab.LABEL_SAMPLE_TYPE()));
    sampleType.add(sampleTypeCombo);

    statisticsControls = generateStatControls();

    setBorder(new TitledBorder(new LineBorder(Color.GREEN.darker().darker()), "Sample Entry Panel"));
    GBH gbh = new GBH(this);
    int y = 0;

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, statisticsControls);
    ++y;

    if (shouldShowSampleType(sampleTypes)) {
        sampleType.setBorder(new LineBorder(Color.RED));
        sampleType.setToolTipText("DEVELOPER MODE: sampleType is possible hack for accept/suppress");
        gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, sampleType);
        ++y;
    }

    sampleSourceControls = Box.createHorizontalBox();
    sampleSourceControls.add(new JLabel(Vocab.PROMPT_VALUES_FROM()));
    //        sampleSourceControls.add(new JSeparator(JSeparator.VERTICAL));
    sampleSourceControls.add(sampleSourceComboBox);
    sampleSourceControls.add(Box.createHorizontalGlue());
    sampleSourceComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateSetValueAction();
        }
    });

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, sampleSourceControls);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, valueDescription);
    ++y;

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, showStatsOption);
    gbh.add(1, y, 1, 1, GBH.HORZ, 2, 1, GBH.CENTER, sampleValueTextField);
    ++y;

    gbh.add(0, y, 2, 1, GBH.NONE, 1, 1, GBH.CENTER, setButtons);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 2, 1, GBH.CENTER, validationMessage);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 2, 0, GBH.CENTER, singleOrMultiCardPanel);
    ++y;

    deleteAction.setEnabled(false);
    sampleSourceControls.setVisible(false);

    sampleValueTextField.setGrayWhenDisabled(true);
    sampleValueTextField.addActionListener(enterKeyListener);

    sampleValueTextField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            updateSetValueAction();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            updateSetValueAction();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            updateSetValueAction();
        }
    });

    setValueAction.setEnabled(false);
}

From source file:edu.harvard.i2b2.query.ui.TopPanel.java

public void addPanel() {
    int rightmostPosition = dataModel.lastLabelPosition();
    JLabel label = new JLabel();
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setText("and");
    label.setToolTipText("Click to change the relationship");
    label.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    label.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override//  www .j av a  2  s.c  o  m
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jAndOrLabelMouseClicked(evt);
        }
    });

    // jPanel1.add(label);
    // label.setBounds(rightmostPosition, 90, 30, 18);

    ConceptTreePanel panel = new ConceptTreePanel("Group " + (dataModel.getCurrentPanelCount() + 1), this);
    jPanel1.add(panel);
    panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100);
    jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181 + 60, getHeight() - 100));
    jScrollPane4.setViewportView(jPanel1);

    dataModel.addPanel(panel, label, rightmostPosition + 5 + 180);

    jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum());
    jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40);
    resizePanels(getParent().getWidth(), getParent().getHeight());
}

From source file:edu.harvard.i2b2.query.ui.TopPanel.java

private void jMorePanelsButtonActionPerformed(java.awt.event.ActionEvent evt) {
    if (dataModel.hasEmptyPanels()) {
        JOptionPane.showMessageDialog(this, "Please use an existing empty panel before adding a new one.");
        return;//w ww .ja v a 2  s. c  o m
    }
    int rightmostPosition = dataModel.lastLabelPosition();
    JLabel label = new JLabel();
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setText("and");
    label.setToolTipText("Click to change the relationship");
    label.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    label.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jAndOrLabelMouseClicked(evt);
        }
    });

    ConceptTreePanel panel = new ConceptTreePanel("Group " + (dataModel.getCurrentPanelCount() + 1), this);
    jPanel1.add(panel);
    panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100);
    jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181 + 60, getHeight() - 100));
    jScrollPane4.setViewportView(jPanel1);

    dataModel.addPanel(panel, label, rightmostPosition + 5 + 180);

    /*
     * System.out.println(jScrollPane4.getViewport().getExtentSize().width+":"
     * + jScrollPane4.getViewport().getExtentSize().height);
     * System.out.println
     * (jScrollPane4.getHorizontalScrollBar().getVisibleRect().width+":"
     * +jScrollPane4.getHorizontalScrollBar().getVisibleRect().height);
     * System
     * .out.println(jScrollPane4.getHorizontalScrollBar().getVisibleAmount
     * ());
     * System.out.println(jScrollPane4.getHorizontalScrollBar().getValue());
     */
    jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum());
    jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40);
    // this.jScrollPane4.removeAll();
    // this.jScrollPane4.setViewportView(jPanel1);
    // revalidate();
    // jScrollPane3.setBounds(420, 0, 170, 300);
    // jScrollPane4.setBounds(20, 35, 335, 220);
    resizePanels(getParent().getWidth(), getParent().getHeight());
}

From source file:org.pentaho.support.standalone.SDSupportUtility.java

/**
 * initializing UI//from   ww w. j  a v  a 2s  .  co  m
 * 
 * @throws Exception
 */
public SDSupportUtility() throws Exception {

    prop = loadProperty();

    setResizable(false);
    setTitle(SDConstant.PENT_SUP_WIZARD);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 665, 516);

    contentPane = new JPanel();
    contentPane.setBackground(UIManager.getColor("Button.background"));
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lblLastAttached = new JLabel("Last Attached");
    lblLastAttached.setOpaque(false);
    lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT);
    lblLastAttached.setBounds(322, 335, 127, 23);
    contentPane.add(lblLastAttached);

    JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard");
    lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51));
    lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP);
    lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT);
    lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23));
    lblPentahoCustomerSupport.setBounds(130, 109, 506, 37);
    contentPane.add(lblPentahoCustomerSupport);

    JLabel lbllogo = new JLabel();
    lbllogo.setIcon(new ImageIcon(
            SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png")));
    lbllogo.setBounds(10, 11, 409, 93);
    contentPane.add(lbllogo);

    chckbxNewCheckBoxEnvironment = new JCheckBox("Environment");
    chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.ENVIRONMENT);
            } else {
                ArgList.remove(SDConstant.ENVIRONMENT);
            }
        }
    });
    chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23);
    contentPane.add(chckbxNewCheckBoxEnvironment);
    chckbxNewCheckBoxEnvironment.setOpaque(false);

    chckbxNewCheckBoxStructure = new JCheckBox("Structure Details");
    chckbxNewCheckBoxStructure.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.STRUCT);
            } else {
                ArgList.remove(SDConstant.STRUCT);
            }
        }
    });
    chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23);
    contentPane.add(chckbxNewCheckBoxStructure);
    chckbxNewCheckBoxStructure.setOpaque(false);

    chckbxLogs = new JCheckBox("Logs");
    chckbxLogs.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.LOGS);
            } else {
                ArgList.remove(SDConstant.LOGS);
            }
        }
    });
    chckbxLogs.setBounds(377, 164, 248, 23);
    contentPane.add(chckbxLogs);
    chckbxLogs.setOpaque(false);

    chckbxGetSecureFiles = new JCheckBox("Secure Files");
    chckbxGetSecureFiles.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.SECURITY);
            } else {
                ArgList.remove(SDConstant.SECURITY);
            }
        }
    });
    chckbxGetSecureFiles.setBounds(109, 190, 243, 23);
    contentPane.add(chckbxGetSecureFiles);
    chckbxGetSecureFiles.setOpaque(false);

    chckbxMd5 = new JCheckBox("MD5 Hash Value");
    chckbxMd5.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.MD5);
            } else {
                ArgList.remove(SDConstant.MD5);
            }
        }
    });
    chckbxMd5.setBounds(109, 216, 243, 23);
    contentPane.add(chckbxMd5);
    chckbxMd5.setOpaque(false);

    chckbxDbdetails = new JCheckBox("Datasource Details");
    chckbxDbdetails.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.DATASOURCE);
            } else {
                ArgList.remove(SDConstant.DATASOURCE);
            }
        }
    });
    chckbxDbdetails.setBounds(109, 294, 243, 23);
    contentPane.add(chckbxDbdetails);
    chckbxDbdetails.setOpaque(false);

    chckbxLicense = new JCheckBox("License File");
    chckbxLicense.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.LICENSE);
            } else {
                ArgList.remove(SDConstant.LICENSE);
            }
        }
    });
    chckbxLicense.setBounds(109, 164, 243, 23);
    contentPane.add(chckbxLicense);
    chckbxLicense.setOpaque(false);

    chckbxProcesslist = new JCheckBox("Running Process");
    chckbxProcesslist.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.RUNNING_TASK);
            } else {
                ArgList.remove(SDConstant.RUNNING_TASK);
            }
        }
    });
    chckbxProcesslist.setBounds(109, 242, 243, 23);
    contentPane.add(chckbxProcesslist);
    chckbxProcesslist.setOpaque(false);

    chckbxTomcatxml = new JCheckBox("XML files from Tomcat");
    chckbxTomcatxml.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                tomcatXml = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                tomcatXml = false;
            }
        }
    });
    chckbxTomcatxml.setBounds(377, 242, 248, 23);
    contentPane.add(chckbxTomcatxml);
    chckbxTomcatxml.setOpaque(false);

    chckbxServerXml = new JCheckBox("XML files from Server");
    chckbxServerXml.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverXml = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverXml = false;
            }
        }
    });
    chckbxServerXml.setBounds(377, 216, 248, 23);
    contentPane.add(chckbxServerXml);
    chckbxServerXml.setOpaque(false);

    chckbxGetBatfiles = new JCheckBox("Start up files from server");
    chckbxGetBatfiles.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverBatFile = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverBatFile = false;
            }
        }
    });
    chckbxGetBatfiles.setBounds(377, 268, 248, 23);
    contentPane.add(chckbxGetBatfiles);
    chckbxGetBatfiles.setOpaque(false);

    chckbxServerproperties = new JCheckBox("Properites files from server");
    chckbxServerproperties.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {

            if (e.getStateChange() == ItemEvent.SELECTED) {
                ArgList.add(SDConstant.FILE);
                serverProrperties = true;
            } else {
                ArgList.remove(SDConstant.FILE);
                serverProrperties = false;
            }
        }
    });
    chckbxServerproperties.setBounds(377, 294, 248, 23);
    contentPane.add(chckbxServerproperties);
    chckbxServerproperties.setOpaque(false);

    btnNewButton = new JButton("Package");
    btnNewButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent arg0) {

            try {

                if (installType.equalsIgnoreCase("Manual")) {

                    if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) {
                        JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error",
                                JOptionPane.ERROR_MESSAGE);
                    } else {

                        WEB_XML = new StringBuilder();
                        WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator)
                                .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO)
                                .append(File.separator).append(SDConstant.WEB_INF).append(File.separator)
                                .append(SDConstant.WEB_XML);

                        PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString());
                        prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH);
                        prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH);
                    }

                }

                if (prop.getProperty(SDConstant.BI_PATH) == null) {
                    JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error",
                            JOptionPane.ERROR_MESSAGE);
                }
                if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) {
                    JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error",
                            JOptionPane.ERROR_MESSAGE);
                }
                disableAll();
                setBIServerPath(prop);
                final String data = textFieldBrowser.getText();
                if (!data.equalsIgnoreCase(null)) {
                    ArgList.add(SDConstant.BROWSER);
                }

                String[] array = new String[ArgList.size()];

                int count = 0;
                for (int i = 0; i < ArgList.size(); i++) {

                    String retName = ArgList.get(i);
                    if (retName.equals("file")) {
                        if (count == 0) {
                            array[i] = retName;
                            count++;
                        }
                    } else {
                        array[i] = retName;
                    }

                }

                ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME);

                factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory");
                ConfigRetreiver[] config = factory.getConfigRetrevier(array);

                ExecutorService service = Executors.newFixedThreadPool(10);

                for (final ConfigRetreiver configobj : config) {
                    if (null != configobj) {
                        configobj.setBISeverPath(prop);
                        configobj.setServerName("biserver");

                        if (installType.equalsIgnoreCase("Installer")) {
                            configobj.setInstallType("Installer");
                        } else if (installType.equalsIgnoreCase("Archive")) {
                            configobj.setInstallType("Archive");
                        } else if (installType.equalsIgnoreCase("Manual")) {
                            configobj.setInstallType("Manual");
                        }

                        if (configobj instanceof FileRetriever) {
                            configobj.setBidiXml(serverXml);
                            configobj.setBidiBatFile(serverBatFile);
                            configobj.setBidiProrperties(serverProrperties);
                            configobj.setTomcatXml(tomcatXml);
                        }
                        if (configobj instanceof BrowserInfoRetriever) {
                            configobj.setBrowserInfo(data);
                        }

                        service.execute(new Runnable() {
                            public void run() {
                                if (null != configobj)
                                    configobj.readAndSaveConfiguration(prop);
                            }
                        });
                    }
                }
                btnNewButton.setVisible(false);
                progressBar.setVisible(true);
                ProgressThread thread = new ProgressThread();
                thread.setSupport(getSupport());
                thread.setProp(prop);
                new Thread(thread).start();

                service.shutdown();
            } catch (Exception e1) {
                e1.printStackTrace();
            }

        }

    });

    chckbxSelectAll = new JCheckBox("Select/ De-select");
    chckbxSelectAll.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                selectAll();
            } else {
                deSelectAll();
            }
        }
    });

    chckbxSelectAll.setBounds(46, 138, 201, 23);
    chckbxSelectAll.setOpaque(false);
    contentPane.add(chckbxSelectAll);
    btnNewButton.setForeground(SystemColor.infoText);
    btnNewButton.setBounds(10, 430, 639, 37);
    contentPane.add(btnNewButton);
    chckbxServerproperties.setOpaque(false);

    JLabel lblAttach = new JLabel("Attach Artifact");
    lblAttach.setHorizontalAlignment(SwingConstants.LEFT);
    lblAttach.setBounds(32, 335, 177, 23);
    contentPane.add(lblAttach);
    lblAttach.setOpaque(false);

    JButton btnNewButtonBrowse = new JButton("Browse");
    btnNewButtonBrowse.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent arg0) {
            saveSelectedFile(prop);

            JFrame parentFrame = new JFrame();
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle("Specify a file to save");
            fileChooser.setMultiSelectionEnabled(true);

            int userSelection = fileChooser.showSaveDialog(parentFrame);

            if (userSelection == JFileChooser.APPROVE_OPTION) {
                fileToSave = fileChooser.getSelectedFiles();
                for (int i = 0; i < fileToSave.length; i++) {
                    File file = fileToSave[i];
                    String artifactpath = file.getAbsolutePath();

                    File f = new File(artifactpath);
                    String absolutefilename = f.getName();
                    String filename = ArtifactsDirectory.concat(absolutefilename);
                    CopyFile artifactcopy = new CopyFile(artifactpath, filename);
                    try {
                        artifactcopy.copy();
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }

                }
                uploadedFiles();

                rowList = new JList(model);
                listScrollPane.setViewportView(rowList);
                panel.add(listScrollPane);

            }
            rowList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    lblDelete.setVisible(true);
                }
            });

        }
    });
    btnNewButtonBrowse.setBounds(208, 335, 104, 23);
    contentPane.add(btnNewButtonBrowse);
    btnNewButtonBrowse.setOpaque(false);

    textFieldBrowser = new JTextField();
    textFieldBrowser.setBounds(208, 364, 441, 23);
    contentPane.add(textFieldBrowser);
    textFieldBrowser.setColumns(10);

    progressBar = new JProgressBar(0, 100);
    progressBar.setBounds(8, 437, 639, 24);
    progressBar.setVisible(false);
    progressBar.setStringPainted(true);
    contentPane.add(progressBar);

    JLabel lblBrowserInformation = new JLabel("Browser Information");
    lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT);
    lblBrowserInformation.setLabelFor(textFieldBrowser);
    lblBrowserInformation.setBounds(32, 368, 174, 14);
    contentPane.add(lblBrowserInformation);

    panel = new JPanel();
    panel.setBounds(423, 325, 127, 33);
    contentPane.add(panel);
    panel.setLayout(null);

    listScrollPane = new JScrollPane();
    listScrollPane.setBounds(0, 0, 127, 33);
    panel.add(listScrollPane);

    lblDelete = new JLabel("");
    lblDelete.setBounds(552, 325, 22, 23);
    lblDelete.setVisible(false);
    lblDelete.setIcon(
            new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png")));
    contentPane.add(lblDelete);
    lblDelete.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?");
            if (option == JOptionPane.YES_OPTION) {
                String sel = rowList.getSelectedValue().toString();
                String selected = dir + "/" + sel;
                File fileExists = new File(selected);
                fileExists.delete();
                model.remove(sel.indexOf(sel));
                lblDelete.setVisible(false);

            }
        }
    });

    JLabel instalType = new JLabel("Installation Type : ");
    instalType.setBounds(32, 395, 177, 23);
    instalType.setVisible(true);
    contentPane.add(instalType);

    ButtonGroup btnGrp = new ButtonGroup();

    rdbtnInstaller = new JRadioButton("Installer");
    rdbtnInstaller.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Installer";
        }
    });
    rdbtnInstaller.setBounds(208, 395, 104, 23);
    rdbtnInstaller.setSelected(true);
    contentPane.add(rdbtnInstaller);
    btnGrp.add(rdbtnInstaller);

    rdbtnArchive = new JRadioButton("Archive");
    rdbtnArchive.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Archive";
        }
    });
    rdbtnArchive.setBounds(333, 395, 104, 23);
    contentPane.add(rdbtnArchive);
    btnGrp.add(rdbtnArchive);

    rdbtnManual = new JRadioButton("Manual");
    rdbtnManual.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            installType = "Manual";
        }
    });
    rdbtnManual.setBounds(460, 395, 127, 27);
    contentPane.add(rdbtnManual);
    btnGrp.add(rdbtnManual);

    JLabel lblBackground = new JLabel();
    lblBackground.setIcon(new ImageIcon(
            SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg")));
    lblBackground.setBackground(SystemColor.controlHighlight);
    lblBackground.setHorizontalAlignment(SwingConstants.CENTER);
    lblBackground.setBounds(0, 0, 659, 488);
    contentPane.add(lblBackground);
}

From source file:edu.harvard.i2b2.query.ui.MainPanel.java

public void addPanel() {
    int rightmostPosition = dataModel.lastLabelPosition();
    JLabel label = new JLabel();
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setText("and");
    label.setToolTipText("Click to change the relationship");
    label.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    label.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override//  w w w  .  ja  v  a  2  s  . c  o m
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jAndOrLabelMouseClicked(evt);
        }
    });

    // jPanel1.add(label);
    // label.setBounds(rightmostPosition, 90, 30, 18);

    GroupPanel panel = new GroupPanel("Group " + (dataModel.getCurrentPanelCount() + 1), this);
    jPanel1.add(panel);
    panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100);
    jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181 + 60, getHeight() - 100));
    jScrollPane4.setViewportView(jPanel1);

    dataModel.addPanel(panel, label, rightmostPosition + 5 + 180);

    jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum());
    jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40);
    resizePanels(getParent().getWidth(), getParent().getHeight());
}

From source file:edu.harvard.i2b2.query.ui.MainPanel.java

private void jMorePanelsButtonActionPerformed(java.awt.event.ActionEvent evt) {
    if (dataModel.hasEmptyPanels()) {
        JOptionPane.showMessageDialog(this, "Please use an existing empty panel before adding a new one.");
        return;/*from  w w  w.j ava2  s.co  m*/
    }
    int rightmostPosition = dataModel.lastLabelPosition();
    JLabel label = new JLabel();
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setText("and");
    label.setToolTipText("Click to change the relationship");
    label.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    label.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jAndOrLabelMouseClicked(evt);
        }
    });

    GroupPanel panel = new GroupPanel("Group " + (dataModel.getCurrentPanelCount() + 1), this);
    jPanel1.add(panel);
    panel.setBounds(rightmostPosition + 5, 0, 180, getParent().getHeight() - 100);
    jPanel1.setPreferredSize(new Dimension(rightmostPosition + 5 + 181 + 60, getHeight() - 100));
    jScrollPane4.setViewportView(jPanel1);

    dataModel.addPanel(panel, label, rightmostPosition + 5 + 180);

    /*
     * System.out.println(jScrollPane4.getViewport().getExtentSize().width+":"
     * + jScrollPane4.getViewport().getExtentSize().height);
     * System.out.println
     * (jScrollPane4.getHorizontalScrollBar().getVisibleRect().width+":"
     * +jScrollPane4.getHorizontalScrollBar().getVisibleRect().height);
     * System
     * .out.println(jScrollPane4.getHorizontalScrollBar().getVisibleAmount
     * ());
     * System.out.println(jScrollPane4.getHorizontalScrollBar().getValue());
     */
    jScrollPane4.getHorizontalScrollBar().setValue(jScrollPane4.getHorizontalScrollBar().getMaximum());
    jScrollPane4.getHorizontalScrollBar().setUnitIncrement(40);
    // this.jScrollPane4.removeAll();
    // this.jScrollPane4.setViewportView(jPanel1);
    // revalidate();
    // jScrollPane3.setBounds(420, 0, 170, 300);   
    // jScrollPane4.setBounds(20, 35, 335, 220);
    resizePanels(getParent().getWidth(), getParent().getHeight());
}

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

private void initComponents() {
    setLayout(new BorderLayout());
    JLabel lblButtonColor = new JLabel(Messages.getString("MenuItemForm.19")); //$NON-NLS-1$
    tabbedPane = new javax.swing.JTabbedPane();

    JPanel tabGeneral = new javax.swing.JPanel();

    JLabel lblName = new JLabel();
    lblName.setHorizontalAlignment(SwingConstants.TRAILING);

    tfName = new com.floreantpos.swing.FixedLengthTextField(20);
    tfDescription = new JTextArea(new FixedLengthDocument(120));

    JLabel lTax = new javax.swing.JLabel();
    lTax.setHorizontalAlignment(SwingConstants.TRAILING);

    cbTax = new javax.swing.JComboBox();
    JButton btnNewTax = new javax.swing.JButton();

    JPanel tabShift = new javax.swing.JPanel();
    JPanel tabPrice = new javax.swing.JPanel();

    JPanel tabButtonStyle = new javax.swing.JPanel();
    JButton btnDeleteShift = new javax.swing.JButton();
    JButton btnAddShift = new javax.swing.JButton();

    JButton btnNewPrice = new javax.swing.JButton();
    JButton btnUpdatePrice = new javax.swing.JButton();
    JButton btnDeletePrice = new javax.swing.JButton();
    JButton btnDeleteAll = new javax.swing.JButton();
    JButton btnDefaultValue = new javax.swing.JButton();
    JButton btnAutoGenerate = new javax.swing.JButton();

    JScrollPane jScrollPane2 = new javax.swing.JScrollPane();
    JScrollPane priceTabScrollPane = new javax.swing.JScrollPane();

    shiftTable = new JTable();

    priceTable = new JTable();
    priceTable.setRowHeight(PosUIManager.getSize(priceTable.getRowHeight()));
    priceTable.setCellSelectionEnabled(true);
    priceTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    priceTable.setSurrendersFocusOnKeystroke(true);
    cbPrinterGroup = new JComboBox<PrinterGroup>(new DefaultComboBoxModel<PrinterGroup>(
            PrinterGroupDAO.getInstance().findAll().toArray(new PrinterGroup[0])));
    cbPrinterGroup.setPreferredSize(new Dimension(226, 0));

    tfDefaultSellPortion = new IntegerTextField(10);
    tfTranslatedName = new FixedLengthTextField(20);
    tfTranslatedName.setLength(120);/* w  w w .  j a va2s. co m*/
    lblKitchenPrinter = new JLabel(Messages.getString("MenuItemForm.27")); //$NON-NLS-1$
    lblName.setText(Messages.getString("LABEL_NAME")); //$NON-NLS-1$
    tfName.setLength(120);
    JLabel lblTranslatedName = new JLabel(Messages.getString("MenuItemForm.lblTranslatedName.text")); //$NON-NLS-1$
    tfSortOrder = new IntegerTextField(20);
    tfSortOrder.setText(""); //$NON-NLS-1$
    cbTax.setPreferredSize(new Dimension(198, 0));
    btnButtonColor = new JButton(); //$NON-NLS-1$
    btnButtonColor.setPreferredSize(new Dimension(228, 40));
    JLabel lblTextColor = new JLabel(Messages.getString("MenuItemForm.lblTextColor.text")); //$NON-NLS-1$
    btnTextColor = new JButton(Messages.getString("MenuItemForm.SAMPLE_TEXT")); //$NON-NLS-1$
    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("...");
    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);
        }
    });

    tabbedPane.addTab(com.floreantpos.POSConstants.GENERAL, tabGeneral);
    tabbedPane.setPreferredSize(new Dimension(750, 470));

    tabbedPane.addTab(com.floreantpos.POSConstants.MODIFIER_GROUPS, getModifierGroupTab());

    btnAddShift.addActionListener(this);
    btnDeleteShift.addActionListener(this);

    tabGeneral.setLayout(new MigLayout("insets 20", "[][]20px[][]", "[][][][][][][][][][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    tabGeneral.add(lblName, "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");

    JLabel lgroup = new javax.swing.JLabel();
    lgroup.setHorizontalAlignment(SwingConstants.TRAILING);
    lgroup.setText(Messages.getString("LABEL_GROUP")); //$NON-NLS-1$

    tabGeneral.add(lgroup, "cell 0 3,alignx right"); //$NON-NLS-1$
    JLabel lblBarcode = new JLabel(Messages.getString("MenuItemForm.lblBarcode.text")); //$NON-NLS-1$

    tabGeneral.add(lblBarcode, "cell 0 4,alignx right"); //$NON-NLS-1$
    tfBarcode = new FixedLengthTextField(20);
    tabGeneral.add(tfBarcode, "cell 1 4,grow"); //$NON-NLS-1$
    JLabel lblStockCount = new JLabel(Messages.getString("MenuItemForm.17")); //$NON-NLS-1$

    tabGeneral.add(lblStockCount, "cell 0 5,alignx right"); //$NON-NLS-1$
    tfStockCount = new DoubleTextField(1);
    tabGeneral.add(tfStockCount, "cell 1 5,grow"); //$NON-NLS-1$
    chkVisible = new javax.swing.JCheckBox();

    tabGeneral.add(new JLabel("Default sell portion (%)"), "cell 0 6");
    tabGeneral.add(tfDefaultSellPortion, "cell 1 6,grow");

    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));

    tabGeneral.add(chkVisible, "cell 1 7");
    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$

    cbGroup = new javax.swing.JComboBox();
    cbGroup.setPreferredSize(new Dimension(198, 0));

    tabGeneral.add(cbGroup, "flowx,cell 1 3"); //$NON-NLS-1$
    JButton btnNewGroup = new javax.swing.JButton();

    btnNewGroup.setText("..."); //$NON-NLS-1$
    btnNewGroup.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            doCreateNewGroup(evt);
        }
    });
    tabGeneral.add(btnNewGroup, "cell 1 3"); //$NON-NLS-1$

    tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.25")), "cell 2 3,right"); //$NON-NLS-1$ //$NON-NLS-2$
    orderList = new CheckBoxList();

    List<OrderType> orderTypes = Application.getInstance().getOrderTypes();
    orderList.setModel(orderTypes);

    JScrollPane orderCheckBoxList = new JScrollPane(orderList);
    orderCheckBoxList.setPreferredSize(new Dimension(228, 100));
    tabGeneral.add(orderCheckBoxList, "cell 3 3 3 3"); //$NON-NLS-1$
    cbDisableStockCount = new JCheckBox(Messages.getString("MenuItemForm.18")); //$NON-NLS-1$
    tabGeneral.add(cbDisableStockCount, "cell 1 8"); //$NON-NLS-1$

    tabGeneral.add(new JLabel(Messages.getString("MenuItemForm.29")), "cell 2 6,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, 70));
    tfDescription.setLineWrap(true);
    tabGeneral.add(scrlDescription, "cell 3 6 3 3"); //$NON-NLS-1$

    add(tabbedPane);
    //TODO: 
    addRecepieExtension();

    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();
        }
    });

    btnAutoGenerate.setText("Auto Generate"); //$NON-NLS-1$
    btnAutoGenerate.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            autoGeneratePizzaItemSizeAndPrice();
        }
    });

    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$
    priceTabScrollPane.setViewportView(priceTable);

    tabPrice.setLayout(new BorderLayout());
    tabPrice.add(priceTabScrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();

    buttonPanel.add(btnNewPrice);
    buttonPanel.add(btnUpdatePrice);
    buttonPanel.add(btnDeletePrice);
    buttonPanel.add(btnAutoGenerate);

    tabPrice.add(buttonPanel, BorderLayout.SOUTH);
    tabGeneral.add(tabPrice, "cell 0 10,grow,span");
    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$

    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(POSUtil.getBackOfficeWindow(),
                    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(POSUtil.getBackOfficeWindow(),
                    Messages.getString("MenuItemForm.43"), btnTextColor.getForeground()); //$NON-NLS-1$
            btnTextColor.setForeground(color);
        }
    });

    tabbedPane.addTab(Messages.getString("MenuItemForm.26"), tabButtonStyle); //$NON-NLS-1$
}

From source file:at.becast.youploader.gui.FrmMain.java

public void initQueuetab() {
    JScrollPane TabQueues = new JScrollPane();
    QueuePanel = new JPanel();
    TabQueues.setViewportView(QueuePanel);

    QueuePanel.setLayout(new MigLayout("", "[875px,grow,fill]", "[][][][]"));
    JPanel buttonPanel = new JPanel();
    GridBagConstraints gbc_panel_2 = new GridBagConstraints();
    gbc_panel_2.fill = GridBagConstraints.BOTH;
    gbc_panel_2.gridx = 0;/*from w  w w .  ja v a  2s.  c o m*/
    gbc_panel_2.gridy = 1;
    buttonPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC,
            FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
            FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
            FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
            FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
            FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(39dlu;default)"),
            FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC,
            FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(92dlu;default)"),
            FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(46dlu;min)"), FormSpecs.RELATED_GAP_COLSPEC,
            ColumnSpec.decode("left:max(22dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC,
            FormSpecs.DEFAULT_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    RowSpec.decode("max(0dlu;default)"), }));

    JButton btnStart = new JButton(LANG.getString("frmMain.start"));
    btnStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            startUploads();
        }
    });

    JLabel lblAfterUploadsFinish = new JLabel(LANG.getString("frmMain.afterfinish"));
    buttonPanel.add(lblAfterUploadsFinish, "10, 2, 7, 1");
    buttonPanel.add(btnStart, "2, 4");

    JButton btnStop = new JButton(LANG.getString("frmMain.stop"));
    btnStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            UploadMgr.stop();
        }
    });
    buttonPanel.add(btnStop, "6, 4");

    cmbAfterFinish = new JComboBox<Object>();
    cmbAfterFinish.setModel(new DefaultComboBoxModel<Object>(new String[] {
            LANG.getString("frmMain.afterfinish.donothing"), LANG.getString("frmMain.afterfinish.suspend"),
            LANG.getString("frmMain.afterfinish.shutdown") }));
    buttonPanel.add(cmbAfterFinish, "10, 4, 7, 1, fill, default");

    JLabel lblUploads = new JLabel(LANG.getString("frmMain.uploads") + ":");
    buttonPanel.add(lblUploads, "18, 4, right, fill");

    JSlider slider = new JSlider();
    slider.setPaintTicks(true);
    slider.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            JSlider s = (JSlider) evt.getSource();
            UploadMgr.setUploadlimit(s.getValue());
        }
    });
    slider.setMajorTickSpacing(1);
    slider.setMinorTickSpacing(1);

    slider.setMinimum(1);
    slider.setMaximum(5);
    slider.setValue(1);
    slider.setSnapToTicks(true);
    slider.setPaintLabels(true);
    buttonPanel.add(slider, "20, 4, fill, fill");

    JLabel lblUploadSpeed = new JLabel(LANG.getString("frmMain.uploadspeed") + ":");
    lblUploadSpeed.setHorizontalAlignment(SwingConstants.TRAILING);
    buttonPanel.add(lblUploadSpeed, "24, 4");

    spinner = new JSpinner();
    spinner.setModel(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(10)));
    spinner.setEditor(new SpeedValuesSpinnerEditor(spinner));
    spinner.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            JSpinner s = (JSpinner) e.getSource();
            speed = Integer.parseInt(s.getValue().toString());
            Main.s.put("speed", String.valueOf(speed));
            UploadMgr.setLimit(speed);
        }
    });
    spinner.setValue(speed);
    buttonPanel.add(spinner, "26, 4");

    JLabel lblKbps = new JLabel("kbps");
    buttonPanel.add(lblKbps, "28, 4");

    JPanel TabQueue = new JPanel();
    TabbedPane.addTab(LANG.getString("frmMain.Tabs.Queue"), null, TabQueue, null);
    TabQueue.setLayout(new BorderLayout(0, 0));

    TabQueue.add(buttonPanel, BorderLayout.SOUTH);

    TabQueue.add(TabQueues, BorderLayout.CENTER);
}

From source file:com.diversityarrays.kdxplore.KDXploreFrame.java

private void initialiseKdxApps() throws IOException {

    String[] classNames = KdxploreConfig.getInstance().getMainPluginClassNames();
    if (classNames != null && classNames.length > 0) {
        List<String> classNamesToLoad = new ArrayList<>();
        Collections.addAll(classNamesToLoad, classNames);
        if (!classNamesToLoad.contains(OFFLINE_DATA_APP_SERVICE_CLASS_NAME)) {
            classNamesToLoad.add(0, OFFLINE_DATA_APP_SERVICE_CLASS_NAME);
            classNames = classNamesToLoad.toArray(new String[classNamesToLoad.size()]);
        }/* w  w  w.ja  v a2s .c o m*/
    }

    Map<KdxApp, Component> componentByApp = collectKdxApps(classNames);

    appByComponent.clear();
    for (KdxApp app : componentByApp.keySet()) {
        Component comp = componentByApp.get(app);
        if (comp != null) {
            appByComponent.put(comp, app);
        }
    }

    allKdxApps.clear();
    allKdxApps.addAll(componentByApp.keySet());

    // Initialise the apps in initialisation order.
    allKdxApps.sort(Comparator.comparing(KdxApp::getInitialisationOrder));

    // And while we're initialising them we collect
    // those that can perform a databaseBackup (i.e. have a BackupProvider).
    backupProviders.clear();
    List<KdxApp> wantedAppsWithUi = new ArrayList<>();

    for (KdxApp app : allKdxApps) {
        BackupProvider bp = app.getBackupProvider();
        if (bp != null) {
            backupProviders.add(bp);
        }

        /**
         * See {@link com.diversityarrays.kdxplore.prefs.KdxplorePreferences#SHOW_ALL_APPS}
         */
        if (appIsWanted(app)) {
            try {
                app.initialiseAppBeforeUpdateCheck(appInitContext);
            } catch (Exception e) {
                String msg = Msg.MSG_KDXAPP_INIT_PROBLEM(app.getAppName());
                Shared.Log.w(TAG, msg, e);
                messagesPanel.println(msg);
                messagesPanel.println(e.getMessage());
            }
        }

        if (appIsWanted(app) && null != componentByApp.get(app)) {
            wantedAppsWithUi.add(app);
        }
    }

    // - - - - - - - - - - - - - - - - - - - - -
    // Display the apps in display order.
    wantedAppsWithUi.sort(Comparator.comparing(KdxApp::getDisplayOrder));
    backupProviders.sort(Comparator.comparing(BackupProvider::getDisplayOrder));

    switch (wantedAppsWithUi.size()) {
    case 0:
        JLabel label = new JLabel(Msg.MSG_NO_KDXPLORE_APPS_AVAILABLE());
        label.setHorizontalAlignment(JLabel.CENTER);
        cardPanel.add(label, CARD_KDXAPPS);
        break;
    case 1:
        KdxApp kdxApp = wantedAppsWithUi.get(0);
        Component uiComponent = componentByApp.get(kdxApp);

        Component appComponent = makeComponentForTab(kdxApp, uiComponent);
        cardPanel.add(appComponent, CARD_KDXAPPS);

        getRootPane().setDefaultButton(kdxApp.getDefaultButton());

        String msg = Msg.MSG_SHOWING_KDXAPP(kdxApp.getAppName());
        messagesPanel.println(msg);
        System.err.println(msg + " uiClass=" //$NON-NLS-1$
                + uiComponent.getClass().getName());
        break;
    default:
        kdxAppTabs = new JTabbedPane(JTabbedPane.LEFT);
        cardPanel.add(kdxAppTabs, CARD_KDXAPPS);
        Bag<String> tabsSeen = new HashBag<>();
        for (KdxApp app : wantedAppsWithUi) {
            Component ui = componentByApp.get(app);

            String tabName = app.getAppName();
            DevelopmentState devState = app.getDevelopmentState();
            switch (devState) {
            case ALPHA:
                tabName = tabName + " (\u03b1)"; // TODO move to UnicodeChars
                break;
            case BETA:
                tabName = tabName + " (\u03b2)"; // TODO move to UnicodeChars
                break;
            case PRODUCTION:
                break;
            default:
                tabName = tabName + " " + devState.name();
                break;
            }
            tabsSeen.add(tabName);
            int count = tabsSeen.getCount(tabName);
            if (count > 1) {
                tabName = tabName + "_" + count; //$NON-NLS-1$
            }

            Component tabComponent = makeComponentForTab(app, ui);
            kdxAppTabs.addTab(tabName, tabComponent);
            if (macapp == null) {
                int index = kdxAppTabs.indexOfTab(tabName);
                if (index >= 0) {
                    JLabel tabLabel = new JLabel(tabName);
                    tabLabel.setBorder(new EmptyBorder(2, 2, 2, 2));
                    tabLabel.setUI(new VerticalLabelUI(VerticalLabelUI.UPWARDS));
                    kdxAppTabs.setTabComponentAt(index, tabLabel);
                }
            }
            messagesPanel.println(Msg.MSG_SHOWING_KDXAPP(tabName));
        }

        kdxAppTabs.addChangeListener(kdxAppTabsChangeListener);
        kdxAppTabs.setSelectedIndex(0);
        break;
    }
}

From source file:com.openbravo.pos.sales.restaurant.JRetailTicketsBagRestaurantMap.java

private JPanel getLabelPanel(String msg) {
    JPanel panel = new JPanel();
    Font font = new Font("Verdana", Font.BOLD, 12);
    panel.setFont(font);/* w  ww .jav  a2s . c o m*/
    panel.setOpaque(true);
    JLabel label = new JLabel(msg, JLabel.LEFT);
    label.setForeground(Color.RED);
    label.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    panel.add(label);
    return panel;
}