Example usage for java.awt FlowLayout RIGHT

List of usage examples for java.awt FlowLayout RIGHT

Introduction

In this page you can find the example usage for java.awt FlowLayout RIGHT.

Prototype

int RIGHT

To view the source code for java.awt FlowLayout RIGHT.

Click Source Link

Document

This value indicates that each row of components should be right-justified.

Usage

From source file:com.floreantpos.config.ui.DatabaseConfigurationView.java

protected void initUI() {
    setLayout(new BorderLayout());

    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new MigLayout("fill", "[][grow,fill]", "[][][][][][][][grow,fill]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    tfServerAddress = new POSTextField();
    tfServerPort = new POSTextField();
    tfDatabaseName = new POSTextField();
    tfUserName = new POSTextField();
    tfPassword = new POSPasswordField();
    databaseCombo = new JComboBox(Database.values());

    String databaseProviderName = AppConfig.getDatabaseProviderName();
    if (StringUtils.isNotEmpty(databaseProviderName)) {
        databaseCombo.setSelectedItem(Database.getByProviderName(databaseProviderName));
    }/*  w w w. j av  a  2 s  . co m*/

    contentPanel.add(new JLabel(Messages.getString("DatabaseConfigurationDialog.8"))); //$NON-NLS-1$
    contentPanel.add(databaseCombo, "grow, wrap"); //$NON-NLS-1$
    lblServerAddress = new JLabel(Messages.getString("DatabaseConfigurationDialog.10") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblServerAddress);
    contentPanel.add(tfServerAddress, "grow, wrap"); //$NON-NLS-1$
    lblServerPort = new JLabel(Messages.getString("DatabaseConfigurationDialog.13") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblServerPort);
    contentPanel.add(tfServerPort, "grow, wrap"); //$NON-NLS-1$
    lblDbName = new JLabel(Messages.getString("DatabaseConfigurationDialog.16") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblDbName);
    contentPanel.add(tfDatabaseName, "grow, wrap"); //$NON-NLS-1$
    lblUserName = new JLabel(Messages.getString("DatabaseConfigurationDialog.19") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblUserName);
    contentPanel.add(tfUserName, "grow, wrap"); //$NON-NLS-1$
    lblDbPassword = new JLabel(Messages.getString("DatabaseConfigurationDialog.22") + ":"); //$NON-NLS-1$ //$NON-NLS-2$
    contentPanel.add(lblDbPassword);
    contentPanel.add(tfPassword, "grow, wrap"); //$NON-NLS-1$
    contentPanel.add(new JSeparator(), "span, grow, gaptop 10"); //$NON-NLS-1$

    btnTestConnection = new JButton(Messages.getString("DatabaseConfigurationDialog.26")); //$NON-NLS-1$
    btnTestConnection.setActionCommand(TEST);
    btnSave = new JButton(Messages.getString("DatabaseConfigurationDialog.27")); //$NON-NLS-1$
    btnSave.setActionCommand(SAVE);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    btnCreateDb = new JButton(Messages.getString("DatabaseConfigurationDialog.29")); //$NON-NLS-1$
    btnCreateDb.setActionCommand(CONFIGURE_DB);
    buttonPanel.add(btnCreateDb);
    buttonPanel.add(btnTestConnection);
    buttonPanel.add(btnSave);

    contentPanel.add(buttonPanel, "span, grow"); //$NON-NLS-1$

    JScrollPane scrollPane = new JScrollPane(contentPanel);
    scrollPane.setBorder(null);
    add(scrollPane);
}

From source file:edu.harvard.mcz.imagecapture.TemplatePickerDialog.java

protected void init(ICImage image) {
    setBounds(100, 100, 450, 300);/* ww  w. j  a v a2  s. c o m*/
    StringBuffer title = new StringBuffer();
    title.append("Change Template");
    if (image != null) {
        title.append(" for ").append(image.getFilename());
    }
    this.setTitle(title.toString());
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        lblTemplate = new JLabel("Template");
        lblTemplate.setHorizontalAlignment(SwingConstants.CENTER);
        contentPanel.add(lblTemplate, BorderLayout.NORTH);
    }
    {
        comboBoxTemplatePicker = new JComboBox<String>();
        comboBoxTemplatePicker.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                PositionTemplate defaultTemplate;
                try {
                    defaultTemplate = new PositionTemplate((String) comboBoxTemplatePicker.getSelectedItem());

                    File fileToCheck = new File(ImageCaptureProperties
                            .assemblePathWithBase(imageToTemplate.getPath(), imageToTemplate.getFilename()));

                    BufferedImage imagefile = ImageIO.read(fileToCheck);

                    int x = defaultTemplate.getBarcodeULPosition().width;
                    int y = defaultTemplate.getBarcodeULPosition().height;
                    int w = defaultTemplate.getBarcodeSize().width;
                    int h = defaultTemplate.getBarcodeSize().height;
                    setBarcodeImage(imagefile.getSubimage(x, y, w, h));

                } catch (NullPointerException e1) {
                    log.error(e1.getMessage());
                } catch (NoSuchTemplateException e1) {
                    log.error(e1.getMessage());
                } catch (IOException e1) {
                    log.error(e1.getMessage());
                }
            }

        });
        contentPanel.add(comboBoxTemplatePicker, BorderLayout.SOUTH);
    }
    {
        JPanel panel = new JPanel();
        contentPanel.add(panel, BorderLayout.CENTER);
        panel.setLayout(new BorderLayout(0, 0));
        {
            lblFileName = new JLabel("FileName");
            panel.add(lblFileName, BorderLayout.NORTH);
        }
        {
            labelBarcodeImage = new JLabel("Catalog Number Barcode");
            labelBarcodeImage.setIcon(new ImageIcon(TemplatePickerDialog.class
                    .getResource("/edu/harvard/mcz/imagecapture/resources/gnome-mime-image.png")));
            panel.add(labelBarcodeImage, BorderLayout.CENTER);
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.setActionCommand("OK");
            okButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    // TODO Auto-generated method stub
                    ICImageLifeCycle ils = new ICImageLifeCycle();
                    try {
                        String newTemplateID = (String) comboBoxTemplatePicker.getSelectedItem();
                        if (newTemplateID != null) {
                            imageToTemplate.setTemplateId(newTemplateID);
                            ils.attachDirty(imageToTemplate);
                            setVisible(false);
                        }
                    } catch (SaveFailedException e1) {
                        log.error(e1.getMessage(), e1);
                    }
                }

            });
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.setActionCommand("Cancel");
            cancelButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    setVisible(false);
                }

            });
            buttonPane.add(cancelButton);
        }
    }
    if (image != null) {
        try {
            boolean result = setupForImage(image);
        } catch (UnreadableFileException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.base.PreviewParametersDialog.java

private JPanel createButtonsPanel() {
    final JButton okButton = new JButton(confirmAction);
    okButton.setDefaultCapable(true);//from   www  .  j a  va 2s  . c o m

    final JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 5, 5));
    buttonsPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY));
    buttonsPanel.add(okButton);
    buttonsPanel.add(new JButton(new CancelAction()));
    return buttonsPanel;
}

From source file:userinterface.graph.GUIImageExportDialog.java

/** This method is called from within the constructor to
 * initialize the form.//from   w  w w .  j av  a 2 s.c o m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
    allPanel = new javax.swing.JPanel();
    bottomPanel = new javax.swing.JPanel();
    warningLabel = new javax.swing.JLabel();
    buttonPanel = new javax.swing.JPanel();
    okayButton = new javax.swing.JButton();
    cancelButton = new javax.swing.JButton();
    topPanel = new javax.swing.JPanel();
    innerTopPanel = new javax.swing.JPanel();
    widthInputLabel = new javax.swing.JLabel();
    widthInputField = new javax.swing.JTextField();
    heightInputLabel = new javax.swing.JLabel();
    heightInputField = new javax.swing.JTextField();
    imageTypeInputLabel = new javax.swing.JLabel();
    imageTypeInputField = new javax.swing.JComboBox();
    alphaInputLabel = new javax.swing.JLabel();
    alphaInputField = new javax.swing.JCheckBox();

    setMinimumSize(new java.awt.Dimension(550, 350));
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            closeDialog(evt);
        }
    });

    allPanel.setLayout(new java.awt.BorderLayout());

    allPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    bottomPanel.setLayout(new java.awt.BorderLayout());

    warningLabel.setText("Please enter positive integers for width and height.");
    warningLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 0));
    bottomPanel.add(warningLabel, java.awt.BorderLayout.CENTER);
    warningLabel.getAccessibleContext()
            .setAccessibleName("Please enter a positive integer for both width and height.");

    buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));

    okayButton.setText("Okay");
    okayButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            okayButtonActionPerformed(evt);
        }
    });

    buttonPanel.add(okayButton);

    cancelButton.setText("Cancel");
    cancelButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            cancelButtonActionPerformed(evt);
        }
    });

    buttonPanel.add(cancelButton);

    bottomPanel.add(buttonPanel, java.awt.BorderLayout.EAST);

    allPanel.add(bottomPanel, java.awt.BorderLayout.SOUTH);

    topPanel.setLayout(new java.awt.BorderLayout());

    topPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Image properties"));
    topPanel.setMinimumSize(new java.awt.Dimension(400, 200));
    topPanel.setPreferredSize(new java.awt.Dimension(400, 200));
    innerTopPanel.setLayout(new java.awt.GridLayout(4, 2, 5, 5));

    innerTopPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    widthInputLabel.setText("Width:");
    innerTopPanel.add(widthInputLabel);

    innerTopPanel.add(widthInputField);

    heightInputLabel.setText("Height:");
    innerTopPanel.add(heightInputLabel);

    innerTopPanel.add(heightInputField);

    imageTypeInputLabel.setText("Image format:");
    innerTopPanel.add(imageTypeInputLabel);

    imageTypeInputField.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "JPEG", "PNG", "EPS" }));
    imageTypeInputField.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            imageTypeInputFieldActionPerformed(evt);
        }
    });

    innerTopPanel.add(imageTypeInputField);

    alphaInputLabel.setText("Transparent background:");
    innerTopPanel.add(alphaInputLabel);

    alphaInputField.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    alphaInputField.setMargin(new java.awt.Insets(0, 0, 0, 0));
    innerTopPanel.add(alphaInputField);

    topPanel.add(innerTopPanel, java.awt.BorderLayout.NORTH);

    allPanel.add(topPanel, java.awt.BorderLayout.CENTER);

    getContentPane().add(allPanel, java.awt.BorderLayout.CENTER);

}

From source file:org.owasp.jbrofuzz.ui.viewers.WindowViewerFrame.java

/**
 * <p>//from   ww w. ja  va2 s  .  c  o m
 * The window viewer that gets launched for each request within the
 * corresponding panel.
 * </p>
 * 
 * @param parent The parent panel that the frame will belong to
 * @param name The full file name of the file location to be opened
 * 
 * @author subere@uncon.org
 * @version 2.0
 * @since 2.0
 */
public WindowViewerFrame(final AbstractPanel parent, final String name) {

    super("JBroFuzz - File Viewer - " + name);

    setIconImage(ImageCreator.IMG_FRAME.getImage());

    // The container pane
    final Container pane = getContentPane();
    pane.setLayout(new BorderLayout());

    // Define the Panel
    final JPanel listPanel = new JPanel();
    listPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(name),
            BorderFactory.createEmptyBorder(1, 1, 1, 1)));
    listPanel.setLayout(new BorderLayout());

    // Get the preferences for wrapping lines of text
    final boolean wrapText = JBroFuzz.PREFS.getBoolean(JBroFuzzPrefs.FUZZING[3].getId(), false);

    if (wrapText) {

        listTextArea = new JTextPane();

    } else {

        listTextArea = new NonWrappingTextPane();

    }

    // Refine the Text Area
    listTextArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
    listTextArea.setEditable(false);

    // Define the search area
    entry = new JTextField(10);
    status = new JLabel("Enter text to search:");

    // Initialise the highlighter on the text area
    hilit = new DefaultHighlighter();
    painter = new DefaultHighlighter.DefaultHighlightPainter(HILIT_COLOR);
    listTextArea.setHighlighter(hilit);

    entryBg = entry.getBackground();
    entry.getDocument().addDocumentListener(this);

    final InputMap im = entry.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    final ActionMap am = entry.getActionMap();
    im.put(KeyStroke.getKeyStroke("ESCAPE"), CANCEL_ACTION);
    am.put(CANCEL_ACTION, new CancelAction());

    // Right click: Cut, Copy, Paste, Select All
    AbstractPanel.popupText(listTextArea, false, true, false, true);

    // Define the Scroll Pane for the Text Area
    final JScrollPane listTextScrollPane = new JScrollPane(listTextArea);
    listTextScrollPane.setVerticalScrollBarPolicy(20);
    listTextScrollPane.setHorizontalScrollBarPolicy(30);

    // Define the progress bar
    final JProgressBar progressBar = new JProgressBar();
    progressBar.setString("   ");
    progressBar.setStringPainted(true);

    // Define the bottom panel with the progress bar
    final JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 15, 15));
    bottomPanel.add(status);
    bottomPanel.add(entry);
    bottomPanel.add(progressBar);

    listTextArea.setCaretPosition(0);
    // doSyntaxHighlight();
    /*      listTextArea.setEditorKit(new StyledEditorKit() {
            
             private static final long serialVersionUID = -6085642347022880064L;
            
             @Override
             public Document createDefaultDocument() {
    return new TextHighlighter();
             }
            
          });
    */

    listPanel.add(listTextScrollPane);

    // Global Frame Issues
    pane.add(listPanel, BorderLayout.CENTER);
    pane.add(bottomPanel, BorderLayout.SOUTH);

    this.setLocation(parent.getLocationOnScreen().x + 100, parent.getLocationOnScreen().y + 20);
    this.setSize(SIZE_X, SIZE_Y);

    setResizable(true);
    setVisible(true);
    setMinimumSize(new Dimension(SIZE_X, SIZE_Y));
    setDefaultCloseOperation(2);

    listTextArea.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(final KeyEvent ke) {
            if (ke.getKeyCode() == 27) {
                WindowViewerFrame.this.dispose();
            }
            if (ke.getKeyCode() == 10) {
                search();
            }
        }
    });

    entry.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(final KeyEvent ke) {
            if (ke.getKeyCode() == 10) {
                search();
            }
        }
    });

    class FileLoader extends SwingWorker<String, Object> { // NO_UCD

        @Override
        public String doInBackground() {

            progressBar.setIndeterminate(true);

            String dbType = JBroFuzz.PREFS.get(JBroFuzzPrefs.DBSETTINGS[11].getId(), "-1");

            if (dbType.equals("SQLite") || dbType.equals("CouchDB")) {

                String sessionId = parent.getFrame().getJBroFuzz().getWindow().getPanelFuzzing()
                        .getSessionName();

                if (sessionId == null || sessionId.equals("null")) {
                    sessionId = JBroFuzz.PREFS.get("sessionId", "");
                }

                Logger.log("Reading Session: " + sessionId + " with name: " + name, 3);

                MessageContainer mc = parent.getFrame().getJBroFuzz().getStorageHandler()
                        .readFuzzFile(name, sessionId, parent.getFrame().getJBroFuzz().getWindow()).get(0);

                listTextArea.setText("Date: " + mc.getEndDateFull() + "\n" + "FileName: " + mc.getFileName()
                        + "\n" + "URL: " + mc.getTextURL() + "\n" + "Payload: " + mc.getPayload() + "\n"
                        + "EncodedPayload: " + mc.getEncodedPayload() + "\n" + "TextRequest:"
                        + mc.getTextRequest() + "\n" + "Message: " + mc.getMessage() + "\n" + "Status: "
                        + mc.getStatus() + "\n"

                );

            } else {
                Logger.log("Loading data from file", 3);
                final File inputFile = new File(parent.getFrame().getJBroFuzz().getWindow().getPanelFuzzing()
                        .getFrame().getJBroFuzz().getStorageHandler().getLocationURIString(), name + ".html");

                listTextArea.setText(

                        FileHandler.readFile(inputFile)

                );
            }
            return "done";
        }

        @Override
        protected void done() {
            progressBar.setIndeterminate(false);
            progressBar.setValue(100);
            listTextArea.repaint();
        }
    }

    (new FileLoader()).execute();

}

From source file:view.App.java

private void initGUI() {
    try {//from w  ww  .ja  va2s .c  o  m
        {
            jPanel1 = new JPanel();
            BorderLayout jPanel1Layout = new BorderLayout();
            jPanel1.setLayout(jPanel1Layout);
            getContentPane().add(jPanel1, BorderLayout.CENTER);
            jPanel1.setPreferredSize(new java.awt.Dimension(901, 398));
            {
                jPanel2 = new JPanel();
                BoxLayout jPanel2Layout = new BoxLayout(jPanel2, javax.swing.BoxLayout.Y_AXIS);
                jPanel2.setLayout(jPanel2Layout);
                jPanel1.add(jPanel2, BorderLayout.WEST);
                jPanel2.setPreferredSize(new java.awt.Dimension(292, 446));
                {
                    jPanel5 = new JPanel();
                    jPanel2.add(jPanel5);
                    jPanel5.setPreferredSize(new java.awt.Dimension(292, 109));
                    {
                        {
                            jTextArea1 = new JTextArea();
                            jTextArea1.setWrapStyleWord(true);
                            jTextArea1.setLineWrap(true);
                            DefaultCaret caret = (DefaultCaret) jTextArea1.getCaret();
                            caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

                            jTextArea1.addFocusListener(new FocusAdapter() {
                                public void focusGained(FocusEvent evt) {

                                    if (jTable1.getModel().getRowCount() == 0 && !jButton1.isEnabled()) {
                                        jButton1.setEnabled(true);
                                        jTextArea1.setText("");
                                    }

                                }
                            });
                            JScrollPane sp = new JScrollPane();
                            sp.setPreferredSize(new java.awt.Dimension(281, 97));
                            sp.setViewportView(jTextArea1);

                            jPanel5.add(sp, BorderLayout.CENTER);
                        }
                    }

                }
                {
                    jPanel4 = new JPanel();
                    jPanel2.add(jPanel4);
                    FlowLayout jPanel4Layout = new FlowLayout();
                    jPanel4Layout.setAlignment(FlowLayout.RIGHT);
                    jPanel4.setPreferredSize(new java.awt.Dimension(292, 45));
                    jPanel4.setSize(102, 51);
                    jPanel4.setLayout(jPanel4Layout);
                    {
                        jButton1 = new JButton();
                        jPanel4.add(jButton1);
                        jButton1.setText("Get Quotes");
                        jButton1.setSize(100, 50);
                        jButton1.setPreferredSize(new java.awt.Dimension(100, 26));
                        jButton1.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                //   
                                String tickerStr = jTextArea1.getText();
                                if (tickerStr.equals("") || tickerStr.equals(null)
                                        || tickerStr.equals(" ")) {
                                    jTextArea1.setText(" ");
                                    return;
                                }
                                StringTokenizer tokenizer = new StringTokenizer(tickerStr, " ");
                                String[] tickers = new String[tokenizer.countTokens()];
                                int i = 0;
                                while (tokenizer.hasMoreTokens()) {
                                    tickers[i] = tokenizer.nextToken();
                                    i++;
                                }
                                try {
                                    Controller.getQuotes(tickers);
                                } catch (CloneNotSupportedException e) {
                                    JOptionPane.showMessageDialog(jPanel1, "   ");
                                }
                                jButton1.setEnabled(false);
                            }
                        });
                    }
                }
                {
                    jPanel6 = new JPanel();
                    BorderLayout jPanel6Layout = new BorderLayout();
                    jPanel6.setLayout(jPanel6Layout);
                    jPanel2.add(jPanel6);
                    {
                        jScrollPane1 = new JScrollPane();
                        jPanel6.add(jScrollPane1, BorderLayout.CENTER);
                        jScrollPane1.setPreferredSize(new java.awt.Dimension(292, 341));
                        {
                            TableModel jTable1Model = new DefaultTableModel(null,
                                    new String[] { "", "MA Value", "", "MA Value" });
                            jTable1 = new JTable();

                            jScrollPane1.setViewportView(jTable1);
                            jTable1.setModel(jTable1Model);
                            jTable1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

                        }
                    }
                }
            }
            {
                jPanel3 = new JPanel();
                BorderLayout jPanel3Layout = new BorderLayout();
                jPanel3.setLayout(jPanel3Layout);
                jPanel1.add(jPanel3, BorderLayout.CENTER);
                {
                    //                  chart = ChartFactory.createLineChart(" ", "dates", "correlation ratio", null, 
                    //                        PlotOrientation.VERTICAL, true, true, false);
                    //                  ChartPanel chartPanel = new ChartPanel(chart);
                    //                  chartPanel.setPreferredSize( new java.awt.Dimension( 560 , 367 ) );
                    //                  jPanel3.add(chartPanel);
                }
                {

                }
            }
        }
        this.setSize(966, 531);
        {
            jMenuBar1 = new JMenuBar();
            setJMenuBar(jMenuBar1);
            {
                jMenu3 = new JMenu();
                jMenuBar1.add(jMenu3);
                jMenu3.setText("File");
                {
                    //                  newFileMenuItem = new JMenuItem();
                    //                  jMenu3.add(newFileMenuItem);
                    //                  newFileMenuItem.setText("New");
                    //                  newFileMenuItem.addActionListener(new ActionListener() {
                    //                     public void actionPerformed(ActionEvent evt) {
                    ////                        jTextArea1.setText("");
                    ////                        DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
                    ////                        model.setRowCount(0);
                    ////                        Controller.clearPortfolio();
                    //                     }
                    //                  });
                }
                {
                    jSeparator2 = new JSeparator();
                    jMenu3.add(jSeparator2);
                }
                {
                    exitMenuItem = new JMenuItem();
                    jMenu3.add(exitMenuItem);
                    exitMenuItem.setText("Exit");
                    exitMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            int action = JOptionPane.showConfirmDialog(jPanel1,
                                    "     ?", "Confirm Exit",
                                    JOptionPane.OK_CANCEL_OPTION);

                            if (action == JOptionPane.OK_OPTION)
                                System.exit(0);

                        }
                    });
                }
            }
            {
                jMenu4 = new JMenu();
                jMenuBar1.add(jMenu4);
                jMenu4.setText("Edit");
                {
                    cutMenuItem = new JMenuItem();
                    jMenu4.add(cutMenuItem);
                    cutMenuItem.setText("Cut");
                    cutMenuItem.addActionListener(new ActionListener() {

                        @Override
                        public void actionPerformed(ActionEvent e) {
                            String txt = jTextArea1.getText();
                            StringSelection selection = new StringSelection(txt);
                            Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard();
                            clp.setContents(selection, null);
                            jTextArea1.setText("");

                        }
                    });
                }
                {
                    copyMenuItem = new JMenuItem();
                    jMenu4.add(copyMenuItem);
                    copyMenuItem.setText("Copy");
                    copyMenuItem.addActionListener(new ActionListener() {

                        @Override
                        public void actionPerformed(ActionEvent arg0) {
                            String txt = jTextArea1.getText();
                            StringSelection selection = new StringSelection(txt);
                            Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard();
                            clp.setContents(selection, null);

                        }
                    });
                }
                {
                    pasteMenuItem = new JMenuItem();
                    jMenu4.add(pasteMenuItem);
                    pasteMenuItem.setText("Paste");
                    pasteMenuItem.addActionListener(new ActionListener() {

                        @Override
                        public void actionPerformed(ActionEvent e) {
                            Clipboard clp = Toolkit.getDefaultToolkit().getSystemClipboard();
                            try {
                                String data = (String) clp.getData(DataFlavor.stringFlavor);
                                jTextArea1.setText(data);
                            } catch (UnsupportedFlavorException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                            } catch (IOException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                            }
                        }
                    });
                }
            }
            {
                jMenu5 = new JMenu();
                jMenuBar1.add(jMenu5);
                jMenu5.setText("Help");
                {
                    helpMenuItem = new JMenuItem();
                    jMenu5.add(helpMenuItem);
                    helpMenuItem.setText("About");
                    helpMenuItem.addActionListener(new ActionListener() {

                        @Override
                        public void actionPerformed(ActionEvent arg0) {
                            JOptionPane.showMessageDialog(jPanel1,
                                    "    .    r.zhumagulov@gmail.com",
                                    "About", JOptionPane.PLAIN_MESSAGE);

                        }
                    });
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ca.phon.app.session.editor.view.media_player.PlayCustomSegmentDialog.java

private void init() {
    final FormLayout layout = new FormLayout("10dlu, fill:pref:grow",
            "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref");
    final CellConstraints cc = new CellConstraints();
    setLayout(layout);/*  w w w.  j a v a  2s .  c o m*/

    final SessionEditor editor = editorRef.get();
    final Session session = editor.getSession();

    btnGrp = new ButtonGroup();

    currentSegmentBtn = new JRadioButton("Current segment");
    currentSegmentBtn.addActionListener(radioListener);
    currentSegmentBtn.setSelected(true);
    btnGrp.add(currentSegmentBtn);

    contiguousSegmentBtn = new JRadioButton("Speaker turn");
    contiguousSegmentBtn.addActionListener(radioListener);
    btnGrp.add(contiguousSegmentBtn);

    //      periodBtn = new JRadioButton("Adjacency sequence");
    //      periodBtn.addActionListener(radioListener);
    //      btnGrp.add(periodBtn);

    recordRangeBtn = new JRadioButton("Record range");
    recordRangeBtn.addActionListener(radioListener);
    btnGrp.add(recordRangeBtn);
    rangeField = new JTextField();
    rangeField.setText((editor.getCurrentRecordIndex() + 1) + ".." + (editor.getCurrentRecordIndex() + 1));
    rangeField.setInputVerifier(new RangeVerifier());
    rangeField.setEnabled(false);
    rangeField.getDocument().addDocumentListener(rangeListener);

    segmentTimeBtn = new JRadioButton("Time range");
    segmentTimeBtn.addActionListener(radioListener);
    btnGrp.add(segmentTimeBtn);
    segmentField = new MediaSegmentField();
    segmentField.setEnabled(false);
    updateSegmentTimes();

    final DialogHeader header = new DialogHeader("Play Custom Segment", "Play a custom defined segment");

    add(header, cc.xyw(1, 1, 2));
    add(currentSegmentBtn, cc.xyw(1, 2, 2));
    add(contiguousSegmentBtn, cc.xyw(1, 3, 2));
    //      add(periodBtn, cc.xyw(1, 4, 2));
    add(recordRangeBtn, cc.xyw(1, 5, 2));
    add(rangeField, cc.xy(2, 6));
    add(segmentTimeBtn, cc.xyw(1, 7, 2));
    add(segmentField, cc.xy(2, 8));

    final ImageIcon playIcon = IconManager.getInstance().getIcon("actions/media-playback-start",
            IconSize.SMALL);
    final ImageIcon cancelIcon = IconManager.getInstance().getIcon("actions/button_cancel", IconSize.SMALL);

    final PhonUIAction playAct = new PhonUIAction(this, "onPlay");
    playAct.putValue(PhonUIAction.NAME, "Play");
    playAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Play segment");
    playAct.putValue(PhonUIAction.SMALL_ICON, playIcon);
    playBtn = new JButton(playAct);

    final PhonUIAction cancelAct = new PhonUIAction(this, "onCancel");
    cancelAct.putValue(PhonUIAction.NAME, "Close");
    cancelAct.putValue(PhonUIAction.SMALL_ICON, cancelIcon);
    cancelBtn = new JButton(cancelAct);

    final JPanel btnPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    btnPanel.add(cancelBtn);
    btnPanel.add(playBtn);
    add(btnPanel, cc.xyw(1, 9, 2));
}

From source file:com.sshtools.common.ui.SshToolsConnectionPanel.java

/**
 *
 *
 * @param parent/*from   w  w  w.jav a 2s. c o m*/
 * @param profile
 * @param optionalTabs
 *
 * @return
 */
public static SshToolsConnectionProfile showConnectionDialog(Component parent,
        SshToolsConnectionProfile profile, SshToolsConnectionTab[] optionalTabs) {
    //  If no properties are provided, then use the default
    if (profile == null) {
        int port = DEFAULT_PORT;
        String port_S = Integer.toString(DEFAULT_PORT);
        port_S = PreferencesStore.get(SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT, port_S);
        try {
            port = Integer.parseInt(port_S);
        } catch (NumberFormatException e) {
            log.warn("Could not parse the port number from defaults file (property name"
                    + SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT + ", property value= " + port_S + ").");
        }
        profile = new SshToolsConnectionProfile();
        profile.setHost(PreferencesStore.get(SshToolsApplication.PREF_CONNECTION_LAST_HOST, ""));
        profile.setPort(PreferencesStore.getInt(SshToolsApplication.PREF_CONNECTION_LAST_PORT, port));
        profile.setUsername(PreferencesStore.get(SshToolsApplication.PREF_CONNECTION_LAST_USER, ""));

    }

    final SshToolsConnectionPanel conx = new SshToolsConnectionPanel(true);

    if (optionalTabs != null) {
        for (int i = 0; i < optionalTabs.length; i++) {
            conx.addTab(optionalTabs[i]);
        }
    }

    conx.setConnectionProfile(profile);

    JDialog d = null;
    Window w = (Window) SwingUtilities.getAncestorOfClass(Window.class, parent);

    if (w instanceof JDialog) {
        d = new JDialog((JDialog) w, "Connection Profile", true);
    } else if (w instanceof JFrame) {
        d = new JDialog((JFrame) w, "Connection Profile", true);
    } else {
        d = new JDialog((JFrame) null, "Connection Profile", true);
    }

    final JDialog dialog = d;

    class UserAction {
        boolean connect;
    }

    final UserAction userAction = new UserAction();

    //  Create the bottom button panel
    final JButton cancel = new JButton("Cancel");
    cancel.setMnemonic('c');
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            userAction.connect = false;
            dialog.setVisible(false);
        }
    });

    final JButton connect = new JButton("Connect");
    connect.setMnemonic('t');
    connect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            if (conx.validateTabs()) {
                userAction.connect = true;
                dialog.setVisible(false);
            }
        }
    });
    dialog.getRootPane().setDefaultButton(connect);

    JPanel buttonPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(6, 6, 0, 0);
    gbc.weighty = 1.0;
    UIUtil.jGridBagAdd(buttonPanel, connect, gbc, GridBagConstraints.RELATIVE);
    UIUtil.jGridBagAdd(buttonPanel, cancel, gbc, GridBagConstraints.REMAINDER);

    JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
    southPanel.add(buttonPanel);

    //
    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    mainPanel.add(conx, BorderLayout.CENTER);
    mainPanel.add(southPanel, BorderLayout.SOUTH);

    // Show the dialog
    dialog.getContentPane().setLayout(new GridLayout(1, 1));
    dialog.getContentPane().add(mainPanel);
    dialog.pack();
    dialog.setResizable(false);
    UIUtil.positionComponent(SwingConstants.CENTER, dialog);

    //show the simple box and act on the answer.
    SshToolsSimpleConnectionPrompt stscp = SshToolsSimpleConnectionPrompt.getInstance();
    StringBuffer sb = new StringBuffer();
    userAction.connect = !stscp.getHostname(sb, profile.getHost());

    boolean advanced = stscp.getAdvanced();

    if (advanced) {
        userAction.connect = false;
        profile.setHost(sb.toString());
        conx.hosttab.setConnectionProfile(profile);
        dialog.setVisible(true);
    }

    // Make sure we didn't cancel
    if (!userAction.connect) {
        return null;
    }

    conx.applyTabs();
    if (!advanced)
        profile.setHost(sb.toString());
    if (!advanced) {
        int port = DEFAULT_PORT;
        String port_S = Integer.toString(DEFAULT_PORT);
        port_S = PreferencesStore.get(SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT, port_S);
        try {
            port = Integer.parseInt(port_S);
        } catch (NumberFormatException e) {
            log.warn("Could not parse the port number from defaults file (property name"
                    + SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT + ", property value= " + port_S + ").");
        }
        profile.setPort(port);
    }
    if (!advanced)
        profile.setUsername("");

    PreferencesStore.put(SshToolsApplication.PREF_CONNECTION_LAST_HOST, profile.getHost());
    // only save user inputed configuration
    if (advanced) {
        PreferencesStore.put(SshToolsApplication.PREF_CONNECTION_LAST_USER, profile.getUsername());
        PreferencesStore.putInt(SshToolsApplication.PREF_CONNECTION_LAST_PORT, profile.getPort());
    }
    // Return the connection properties
    return profile;
}

From source file:org.diyefi.openlogviewer.propertypanel.PropertiesPane.java

private JPanel createAcceptPanel() {
    final JPanel aPanel = new JPanel();
    aPanel.setPreferredSize(new Dimension(500, 32));
    aPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 2, 2));

    final JButton ok = new JButton(labels.getString(Text.OK_BUTTON));
    final JButton cancel = new JButton(labels.getString(Text.CANCEL_BUTTON));

    ok.addActionListener(new ActionListener() {

        @Override/*  ww w .j a v a  2  s.co m*/
        public void actionPerformed(final ActionEvent e) {
            OpenLogViewer.getInstance().getPropertyPane().save();
            OpenLogViewer.getInstance().getPropertyPane().setVisible(false);
        }
    });

    cancel.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {

            OpenLogViewer.getInstance().getPropertyPane().resetProperties();
            OpenLogViewer.getInstance().getPropertyPane().setVisible(false);
        }
    });

    aPanel.add(cancel);
    aPanel.add(ok);

    return aPanel;
}

From source file:org.eclim.installer.step.EclipsePluginsStep.java

@Override
public void displayed() {
    setBusy(true);//from w w w . j  a va  2  s .co  m
    setPreviousEnabled(false);

    try {
        overallLabel.setText("");
        overallProgress.setValue(0);
        taskLabel.setText("");
        taskProgress.setValue(0);
        taskProgress.setIndeterminate(true);

        // handle step re-entry.
        if (featuresPanel != null) {
            stepPanel.remove(featuresPanel);
        }

        EclipseInfo info = (EclipseInfo) Installer.getContext().getValue("eclipse.info");

        // find chosen features dependencies which need to be installed/upgraded.
        dependencies = unsatisfiedDependencies(info);

        if (dependencies.size() == 0) {
            overallProgress.setMaximum(1);
            overallProgress.setValue(1);
            overallLabel.setText("All third party plugins are up to date.");
            taskProgress.setMaximum(1);
            taskProgress.setValue(1);
            taskLabel.setText("");
        } else {
            tableModel = new DefaultTableModel();
            tableModel.addColumn("Feature");
            tableModel.addColumn("Version");
            tableModel.addColumn("Install / Upgrade");
            JTable table = new JTable(tableModel);
            table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            table.setDefaultRenderer(Object.class, new DependencyCellRenderer());
            table.getSelectionModel().addListSelectionListener(new DependencySelectionListener());

            featuresPanel = new JPanel(new BorderLayout());
            featuresPanel.setAlignmentX(0.0f);

            JPanel container = new JPanel(new BorderLayout());
            container.add(table, BorderLayout.CENTER);

            JScrollPane scrollPane = new JScrollPane(container);
            scrollPane.setAlignmentX(0.0f);

            availableFeatures = loadAvailableFeatures();
            for (Dependency dependency : dependencies) {
                String version = availableFeatures.get(dependency.getId());
                String manual = "";
                if (version == null) {
                    manual = " (Manual)";
                    version = dependency.getRequiredVersion();
                }
                tableModel.addRow(new Object[] { dependency.getId(), version,
                        (dependency.isUpgrade() ? "Upgrade" : "Install") + manual, });
            }

            JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
            buttons.setAlignmentX(0.0f);

            JButton skipButton = new JButton(new SkipPluginsAction());
            JButton installButton = new JButton(new InstallPluginsAction(skipButton));

            buttons.add(installButton);
            buttons.add(skipButton);

            featuresPanel.add(scrollPane, BorderLayout.CENTER);
            featuresPanel.add(buttons, BorderLayout.SOUTH);

            stepPanel.add(featuresPanel);
            overallProgress.setValue(0);
            overallLabel.setText("");
            taskProgress.setValue(0);
            taskLabel.setText("");
        }
    } catch (Exception e) {
        setError(e);
    } finally {
        setValid(dependencies != null && dependencies.size() == 0);
        setBusy(false);
        setPreviousEnabled(true);
        taskProgress.setIndeterminate(false);
    }
}