Example usage for java.awt FlowLayout FlowLayout

List of usage examples for java.awt FlowLayout FlowLayout

Introduction

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

Prototype

public FlowLayout(int align) 

Source Link

Document

Constructs a new FlowLayout with the specified alignment and a default 5-unit horizontal and vertical gap.

Usage

From source file:es.emergya.ui.gis.popups.GPSDialog.java

public GPSDialog(Recurso r) {
    super();/* w  ww .j  a  v a 2 s .  com*/
    setAlwaysOnTop(true);
    setResizable(false);
    iconTransparente = LogicConstants.getIcon("48x48_transparente");
    iconEnviando = LogicConstants.getIcon("anim_actualizando");
    target = r;
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setPreferredSize(new Dimension(400, 150));
    setTitle(i18n.getString("window.gps.titleBar") + " " + target.getIdentificador());
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }

    JPanel base = new JPanel();

    base.setBackground(Color.WHITE);
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

    // Icono del titulo
    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));
    final JLabel titleLabel = new JLabel(i18n.getString("window.gps.title"),
            LogicConstants.getIcon("tittleventana_icon_actualizargps"), JLabel.LEFT);

    titleLabel.setFont(LogicConstants.deriveBoldFont(12f));
    title.add(titleLabel);
    title.setOpaque(false);
    base.add(title);

    // Area para mensajes
    JPanel notificationArea = new JPanel();

    notificationArea.setOpaque(false);
    notification = new JLabel("PLACEHOLDER");
    notification.setForeground(Color.WHITE);
    notificationArea.add(notification);
    base.add(notificationArea);

    JPanel buttons = new JPanel();

    buttons.setOpaque(false);
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
    actualizar = new JButton(i18n.getString("window.gps.button.actualizar"),
            LogicConstants.getIcon("ventanacontextual_button_solicitargps"));
    actualizar.addActionListener(this);
    buttons.add(actualizar);
    buttons.add(Box.createHorizontalGlue());
    progressIcon = new JLabel(iconTransparente);
    buttons.add(progressIcon);
    buttons.add(Box.createHorizontalGlue());

    JButton cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel"));

    cancel.addActionListener(this);
    buttons.add(cancel);
    base.add(buttons);
    getContentPane().add(base);
    pack();

    int x;
    int y;
    Container myParent;
    try {
        myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getContentPane();
        java.awt.Point topLeft = myParent.getLocationOnScreen();
        Dimension parentSize = myParent.getSize();

        Dimension mySize = getSize();

        if (parentSize.width > mySize.width)
            x = ((parentSize.width - mySize.width) / 2) + topLeft.x;
        else
            x = topLeft.x;

        if (parentSize.height > mySize.height)
            y = ((parentSize.height - mySize.height) / 2) + topLeft.y;
        else
            y = topLeft.y;

        setLocation(x, y);
    } catch (Throwable e1) {
        LOG.error("There is no basic window!", e1);
    }
    this.addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent arg0) {
            deleteErrorMessage();
        }

        @Override
        public void windowClosed(WindowEvent arg0) {
            deleteErrorMessage();
        }

        @Override
        public void windowClosing(WindowEvent arg0) {
            deleteErrorMessage();
        }

        private void deleteErrorMessage() {
            SwingWorker<Object, Object> sw = new SwingWorker<Object, Object>() {
                @Override
                protected Object doInBackground() throws Exception {
                    if (last_bandejaSalida != null) {
                        MessageGenerator.remove(last_bandejaSalida.getId());
                    }

                    return null;
                }

                @Override
                protected void done() {
                    super.done();
                    GPSDialog.this.progressIcon.setIcon(iconTransparente);
                    GPSDialog.this.progressIcon.repaint();
                    last_bandejaSalida = null;
                    GPSDialog.this.notification.setText("");
                    GPSDialog.this.notification.repaint();
                }
            };

            sw.execute();
        }
    });
}

From source file:captureplugin.drivers.defaultdriver.AdditionalParams.java

/**
 *  Create GUI/*from w  ww.ja  va  2  s  . c om*/
 */
private void createGUI() {
    setTitle(mLocalizer.msg("Additional", "Additional Commands"));

    UiUtilities.registerForClosing(this);

    JPanel content = (JPanel) getContentPane();
    content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    content.setLayout(new BorderLayout());

    content.add(createListPanel(), BorderLayout.WEST);

    content.add(createDetailsPanel(), BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));

    ok.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            okPressed();
        }

    });

    cancel.addActionListener(new ActionListener() {

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

    });

    buttonPanel.add(ok);
    buttonPanel.add(cancel);

    content.add(buttonPanel, BorderLayout.SOUTH);

    mList.setSelectedIndex(0);

    mList.setCellRenderer(new ParamEntryCellRenderer());

    CapturePlugin.getInstance().layoutWindow("additionalParams", this, new Dimension(400, 300));
}

From source file:org.uncommons.watchmaker.swing.evolutionmonitor.JVMView.java

/**
 * Creates the GUI controls for toggling graph display options.
 * @return A component that can be added to the main panel.
 *//*from w  w  w.  jav a  2 s  .c o m*/
private JComponent createControls() {
    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton gcButton = new JButton("Request GC");
    gcButton.setToolTipText("Perform garbage collection (the JVM may ignore this request).");
    gcButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            memoryBean.gc();
        }
    });
    controls.add(gcButton);
    return controls;
}

From source file:net.mitnet.tools.pdf.book.publisher.ui.gui.BookPublisherGUI2.java

/**
 * Initialise widgets.//from   www . j  ava2  s.  c o  m
 */
protected void initComponents() {

    // frame
    this.frame = new JFrame();
    this.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    this.frame.setTitle(FRAME_TITLE);

    // input dir panel

    inputDirLabel = new JLabel();
    inputDirLabel.setText("Input Folder:");

    inputDirField = new JTextField();
    inputDirField.setColumns(FILE_TEXTFIELD_WIDTH);

    inputDirButton = new JButton();
    inputDirButton.setText("Browse ...");
    inputDirButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            inputDirButtonActionHandler(event);
        }
    });

    JPanel inputDirPanel = new JPanel();
    // inputDirPanel.setLayout( new BoxLayout( inputDirPanel, BoxLayout.X_AXIS ) );
    inputDirPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    inputDirPanel.add(inputDirLabel);
    inputDirPanel.add(inputDirField);
    inputDirPanel.add(inputDirButton);

    // output dir panel

    outputDirLabel = new JLabel();
    outputDirLabel.setText("Output Folder:");

    outputDirField = new JTextField();
    outputDirField.setColumns(FILE_TEXTFIELD_WIDTH);

    outputDirButton = new JButton();
    outputDirButton.setText("Browse ...");
    outputDirButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            outputDirButtonActionHandler(event);
        }
    });

    JPanel outputDirPanel = new JPanel();
    // outputDirPanel.setLayout( new BoxLayout( outputDirPanel, BoxLayout.X_AXIS ) );
    outputDirPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    outputDirPanel.add(outputDirLabel);
    outputDirPanel.add(outputDirField);
    outputDirPanel.add(outputDirButton);

    // document control panel
    docControlPanel = new JPanel();
    docControlPanel.setLayout(new BoxLayout(docControlPanel, BoxLayout.Y_AXIS));
    docControlPanel.add(inputDirPanel);
    docControlPanel.add(outputDirPanel);
    // Border docControlPanelBorder = BorderFactory.createTitledBorder("Documents");
    Border docControlPanelBorder = BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("Documents"), BorderFactory.createEmptyBorder(5, 5, 5, 5));
    docControlPanel.setBorder(docControlPanelBorder);

    // publish button
    publishButton = new JButton();
    publishButton.setText("Publish");
    publishButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            publishButtonActionHandler(event);
        }
    });

    // status message label
    statusMessageLabel = new JLabel();
    // String statusMessageText = "Press " + publishButton.getText() + " to start.";
    String statusMessageText = "";
    statusMessageLabel.setText(statusMessageText);
    // statusMessageLabel.setVisible(false);

    // progress bar
    progressBar = new JProgressBar();

    // exit button
    exitButton = new JButton();
    exitButton.setText("Exit");
    exitButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            exitButtonActionHandler(event);
        }
    });

    // build main panel
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(docControlPanel);
    // mainPanel.add(new Spacer());
    mainPanel.add(publishButton);
    // mainPanel.add(new Spacer());
    mainPanel.add(progressBar);
    // mainPanel.add(new Spacer());
    mainPanel.add(statusMessageLabel);
    // mainPanel.add(new Spacer());
    mainPanel.add(exitButton);

    // add main panel to frame
    this.frame.getContentPane().setLayout(new BoxLayout(this.frame.getContentPane(), BoxLayout.Y_AXIS));
    this.frame.getContentPane().add(mainPanel);
    // this.frame.setSize(800,600);
    this.frame.pack();

}

From source file:GCWrapper.java

/**
 * Creates and lays out components in the container. See the comments below
 * for an organizational overview by panel.
 *///w w w .  j  av  a 2  s. com
private void initComponents(Container c) {
    c.setLayout(new BorderLayout());
    // Graphics Config
    JPanel gcPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    c.add(gcPanel, BorderLayout.NORTH);
    gcSelection.setPreferredSize(new Dimension(400, 30));
    gcPanel.add(gcSelection);
    // Capabilities
    JPanel capsPanel = new JPanel(new BorderLayout());
    c.add(capsPanel, BorderLayout.CENTER);
    // Image Capabilities
    JPanel imageCapsPanel = new JPanel(new GridLayout(2, 1));
    capsPanel.add(imageCapsPanel, BorderLayout.NORTH);
    imageCapsPanel.setBorder(BorderFactory.createTitledBorder("Image Capabilities"));
    imageAccelerated.setEnabled(false);
    imageCapsPanel.add(imageAccelerated);
    imageTrueVolatile.setEnabled(false);
    imageCapsPanel.add(imageTrueVolatile);
    // Buffer Capabilities
    JPanel bufferCapsPanel = new JPanel(new BorderLayout());
    capsPanel.add(bufferCapsPanel, BorderLayout.CENTER);
    bufferCapsPanel.setBorder(BorderFactory.createTitledBorder("Buffer Capabilities"));
    // Buffer Access
    JPanel bufferAccessCapsPanel = new JPanel(new GridLayout(3, 1));
    bufferAccessCapsPanel.setPreferredSize(new Dimension(300, 88));
    bufferCapsPanel.add(bufferAccessCapsPanel, BorderLayout.NORTH);
    // Flipping
    JPanel flippingPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    bufferAccessCapsPanel.add(flippingPanel);
    flippingPanel.add(flipping);
    flipping.setEnabled(false);
    flippingPanel.add(flippingMethod);
    // Full-screen
    JPanel fsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    bufferAccessCapsPanel.add(fsPanel);
    JPanel indentPanel = new JPanel();
    indentPanel.setPreferredSize(new Dimension(30, 30));
    fsPanel.add(indentPanel);
    fsPanel.add(fullScreen);
    fullScreen.setEnabled(false);
    // Multi-buffering
    JPanel mbPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    bufferAccessCapsPanel.add(mbPanel);
    indentPanel = new JPanel();
    indentPanel.setPreferredSize(new Dimension(30, 30));
    mbPanel.add(indentPanel);
    mbPanel.add(multiBuffer);
    multiBuffer.setEnabled(false);
    // Front and Back Buffer Capabilities
    JPanel buffersPanel = new JPanel(new GridLayout(1, 2));
    bufferCapsPanel.add(buffersPanel, BorderLayout.CENTER);
    // Front Buffer
    JPanel fbPanel = new JPanel(new GridLayout(2, 1));
    fbPanel.setBorder(BorderFactory.createTitledBorder("Front Buffer"));
    buffersPanel.add(fbPanel);
    fbPanel.add(fbAccelerated);
    fbAccelerated.setEnabled(false);
    fbPanel.add(fbTrueVolatile);
    fbTrueVolatile.setEnabled(false);
    // Back Buffer
    JPanel bbPanel = new JPanel(new GridLayout(2, 1));
    bbPanel.setPreferredSize(new Dimension(250, 80));
    bbPanel.setBorder(BorderFactory.createTitledBorder("Back and Intermediate Buffers"));
    buffersPanel.add(bbPanel);
    bbPanel.add(bbAccelerated);
    bbAccelerated.setEnabled(false);
    bbPanel.add(bbTrueVolatile);
    bbTrueVolatile.setEnabled(false);
}

From source file:es.emergya.ui.gis.popups.GenericDialog.java

public GenericDialog(T i, final String titulo, final String icon) {
    super();/*from   ww  w.  java 2 s  .c om*/
    log.trace("GenericDialog(" + i + ")");
    setAlwaysOnTop(true);
    setResizable(false);
    setBackground(Color.WHITE);
    setPreferredSize(new Dimension(500, 500));
    setTitle(titulo);
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }
    JPanel base = new JPanel();
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));
    base.setBackground(Color.WHITE);

    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));

    final JLabel labelTitle = new JLabel(titulo, LogicConstants.getIcon(icon), JLabel.LEFT);
    labelTitle.setFont(LogicConstants.deriveBoldFont(12f));

    title.setBackground(Color.WHITE);

    title.add(labelTitle);

    base.add(title);

    mid = new JPanel(new SpringLayout());
    mid.setBackground(Color.WHITE);

    loadDialog(i);

    SpringUtilities.makeCompactGrid(mid, rows, cols, initialX, initialY, xPad, yPad);
    base.add(mid);

    JPanel buttons = new JPanel();

    buttons.setBackground(Color.WHITE);
    JButton accept = new JButton(i18n.getString("Buttons.ok"), LogicConstants.getIcon("button_accept"));
    accept.addActionListener(closeListener);
    accept.addActionListener(saveListener);
    buttons.add(accept);

    JButton cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel"));
    cancel.addActionListener(closeListener);
    buttons.add(cancel);

    base.add(buttons);

    getContentPane().add(base);
    pack();

    int x;
    int y;

    Container myParent;
    try {
        myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getContentPane();
        java.awt.Point topLeft = myParent.getLocationOnScreen();
        Dimension parentSize = myParent.getSize();

        Dimension mySize = getSize();

        if (parentSize.width > mySize.width)
            x = ((parentSize.width - mySize.width) / 2) + topLeft.x;
        else
            x = topLeft.x;

        if (parentSize.height > mySize.height)
            y = ((parentSize.height - mySize.height) / 2) + topLeft.y;
        else
            y = topLeft.y;

        setLocation(x, y);
    } catch (Throwable e1) {
        LOG.error("There is no basic window!", e1);
    }
}

From source file:AtomPanel.java

private void commonInit() {
    //initial time series plots
    initJFreeChart();/*ww  w.ja  va  2 s.  c o m*/
    startFlag = false;

    //create control panel
    //        JPanel panel=new JPanel(new GridLayout(1,2));
    //add control buttons to control panel
    /*
    startButton=new JButton("Start");
    startButton.addActionListener(this);
    pauseButton=new JButton("Pause");
    pauseButton.addActionListener(this);
    stopButton=new JButton("Stop");
    stopButton.addActionListener(this);
    panel.add(startButton);
    panel.add(pauseButton);
    panel.add(stopButton);
    */
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    //Create the slider
    JSlider faRateSlider = new JSlider(JSlider.HORIZONTAL, L_MIN, L_MAX, L_INIT);
    faRateSlider.setName("faRate");
    faRateSlider.addChangeListener(this);
    faRateSlider.setMajorTickSpacing(30);
    faRateSlider.setPaintTicks(true);

    //Create the label table
    Hashtable labelTable = new Hashtable();
    labelTable.put(new Integer(L_MIN), new JLabel("0.1%"));
    labelTable.put(new Integer((L_MIN + L_MAX) / 2), new JLabel("   False Alarm Rate"));
    labelTable.put(new Integer(L_MAX), new JLabel("1%"));
    faRateSlider.setLabelTable(labelTable);

    faRateSlider.setPaintLabels(true);
    panel.add(faRateSlider);
    // window size slider
    JSlider wdSzSlider = new JSlider(JSlider.HORIZONTAL, L_MIN, L_MAX, WDL_INIT);
    wdSzSlider.setName("wdSz");
    wdSzSlider.addChangeListener(this);
    wdSzSlider.setMajorTickSpacing(30);
    wdSzSlider.setPaintTicks(true);

    //Create the label table
    Hashtable wdTable = new Hashtable();
    wdTable.put(new Integer(L_MIN), new JLabel("20"));
    wdTable.put(new Integer((L_MIN + L_MAX) / 2), new JLabel("   Window Size"));
    wdTable.put(new Integer(L_MAX), new JLabel("200"));
    wdSzSlider.setLabelTable(wdTable);

    wdSzSlider.setPaintLabels(true);
    panel.add(wdSzSlider);
    if (AtomUtils.PCAType.pcaTrack == this.pcaType) { // new: tracking delta bar
        JSlider deltaSlider = new JSlider(JSlider.HORIZONTAL, L_MIN, L_MAX, L_INIT);
        deltaSlider.setName("delta");
        deltaSlider.addChangeListener(this);
        deltaSlider.setMajorTickSpacing(30);
        deltaSlider.setPaintTicks(true);

        //Create the label table
        labelTable = new Hashtable();
        labelTable.put(new Integer(L_MIN), new JLabel("0%"));
        labelTable.put(new Integer((L_MIN + L_MAX) / 2), new JLabel("   Tracking Threshold"));
        labelTable.put(new Integer(L_MAX), new JLabel("20%"));
        deltaSlider.setLabelTable(labelTable);

        deltaSlider.setPaintLabels(true);
        panel.add(deltaSlider);

        // tracking saving label
        trackSaveLabel = new JLabel();
        trackSaveLabel.setText("Saved/Total:0/0");
        panel.add(trackSaveLabel);
    }
    if (AtomUtils.PCAType.pcaTrackAdjust == this.pcaType) {
        JSlider devSlider = new JSlider(JSlider.HORIZONTAL, L_MIN, L_MAX, L_INIT);
        devSlider.setName("devbnd");
        devSlider.addChangeListener(this);
        devSlider.setMajorTickSpacing(30);
        devSlider.setPaintTicks(true);

        //Create the label table
        labelTable = new Hashtable();
        labelTable.put(new Integer(L_MIN), new JLabel("0%"));
        labelTable.put(new Integer((L_MIN + L_MAX) / 2), new JLabel("   Deviation Bound"));
        labelTable.put(new Integer(L_MAX), new JLabel("1%"));
        devSlider.setLabelTable(labelTable);

        devSlider.setPaintLabels(true);
        panel.add(devSlider);

        // tracking saving label
        trackSaveLabel = new JLabel();
        trackSaveLabel.setText("Saved/Total:0/0");
        panel.add(trackSaveLabel);
    }
    add(panel, BorderLayout.SOUTH);

}

From source file:net.pandoragames.far.ui.swing.dialog.SaveFormDialog.java

private void init(SwingConfig config) {
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    JPanel basePanel = new JPanel();
    basePanel.setBorder(BorderFactory.createEmptyBorder(SwingConfig.PADDING * 2, SwingConfig.PADDING,
            SwingConfig.PADDING, SwingConfig.PADDING));
    basePanel.setLayout(new BorderLayout());
    registerCloseWindowKeyListener(basePanel);
    this.add(basePanel);

    MessageLabel errorLabel = new MessageLabel();
    basePanel.add(errorLabel, BorderLayout.NORTH);
    messageBox = errorLabel;/*from www  .  j av  a 2  s  .com*/

    JPanel centerPanel = new JPanel();
    centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.Y_AXIS));
    JLabel titleLabel = new JLabel(localizer.localize("label.name"));
    titleLabel.setAlignmentX(0);
    centerPanel.add(titleLabel);
    textbox = new JTextField();
    textbox.setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH, config.getStandardComponentHight()));
    textbox.setAlignmentX(0);
    registerEnterKeyListener(textbox, saveAction);
    centerPanel.add(textbox);
    basePanel.add(centerPanel, BorderLayout.CENTER);

    JPanel buttonPannel = new JPanel();
    buttonPannel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    JButton okButton = new JButton(localizer.localize("button.save"));
    okButton.addActionListener(saveAction);
    JButton cancelButton = new JButton(localizer.localize("button.cancel"));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent eve) {
            SaveFormDialog.this.dispose();
        }
    });
    buttonPannel.add(okButton);
    buttonPannel.add(cancelButton);
    registerCloseWindowKeyListener(buttonPannel);
    this.add(buttonPannel, BorderLayout.SOUTH);
}

From source file:be.fedict.eid.tsl.tool.TslInternalFrame.java

private void addSignatureTab(JTabbedPane tabbedPane) {
    GridBagLayout gridBagLayout = new GridBagLayout();
    JPanel dataPanel = new JPanel(gridBagLayout);
    JPanel signaturePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tabbedPane.add("Signature", new JScrollPane(signaturePanel));
    signaturePanel.add(dataPanel);//from w ww .ja v a2  s  . c  om

    GridBagConstraints constraints = new GridBagConstraints();

    JLabel signerLabel = new JLabel("Signer");
    constraints.anchor = GridBagConstraints.FIRST_LINE_START;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.ipadx = 10;
    dataPanel.add(signerLabel, constraints);
    this.signer = new JLabel();
    constraints.gridx++;
    dataPanel.add(this.signer, constraints);

    JLabel signerSha1FingerprintLabel = new JLabel("Public key SHA1 fingerprint:");
    constraints.gridx = 0;
    constraints.gridy++;
    dataPanel.add(signerSha1FingerprintLabel, constraints);
    this.signerSha1Fingerprint = new JLabel();
    constraints.gridx++;
    dataPanel.add(this.signerSha1Fingerprint, constraints);

    JLabel signerSha256FingerprintLabel = new JLabel("Public key SHA256 fingerprint:");
    constraints.gridx = 0;
    constraints.gridy++;
    dataPanel.add(signerSha256FingerprintLabel, constraints);
    this.signerSha256Fingerprint = new JLabel();
    constraints.gridx++;
    dataPanel.add(this.signerSha256Fingerprint, constraints);

    this.saveSignerCertificateButton = new JButton("Save Certificate...");
    constraints.gridx = 0;
    constraints.gridy++;
    dataPanel.add(this.saveSignerCertificateButton, constraints);
    this.saveSignerCertificateButton.addActionListener(this);
    this.saveSignerCertificateButton.setEnabled(false);

    updateView();
}

From source file:com.egangotri.transliteratorAsSwing.TransliteratorJFrame.java

public TransliteratorJFrame() {
    super("eGangotri Indic Transliterator");

    PrintWriter pw = new PrintWriter(System.out, true);
    setSize(650, 650);// w ww . j a  v  a2s .co m

    // menubar
    menubar = new JMenuBar();

    // menus
    file = new JMenu("File");
    help = new JMenu("Help");

    // JMenuItem
    save_1 = new JMenuItem("Save Input");
    save_1.setActionCommand("save_1");
    save_1.addActionListener(this);

    save_2 = new JMenuItem("Save Output-1");
    save_2.setActionCommand("save_2");
    save_2.addActionListener(this);

    save_3 = new JMenuItem("Save Output-2");
    save_3.setActionCommand("save_3");
    save_3.addActionListener(this);

    open_1 = new JMenuItem("Open File for Input");
    open_1.setActionCommand("open_1");
    open_1.addActionListener(this);

    exitItem = new JMenuItem("Exit");
    exitItem.setActionCommand("Exit");
    exitItem.addActionListener(this);

    aboutItem = new JMenuItem("About");
    aboutItem.setActionCommand("about_item");
    aboutItem.addActionListener(this);

    itransItem = new JMenuItem("ITRANS " + Constants.ENCODING_SCHEME);
    itransItem.setActionCommand("itrans_encoding");
    itransItem.addActionListener(this);

    slpItem = new JMenuItem("SLP " + Constants.ENCODING_SCHEME);
    slpItem.setActionCommand("slp_encoding");
    slpItem.addActionListener(this);

    hkItem = new JMenuItem("Harvard Kyoto " + Constants.ENCODING_SCHEME);
    hkItem.setActionCommand("hk_encoding");
    hkItem.addActionListener(this);

    velthuisItem = new JMenuItem("Velthuis " + Constants.ENCODING_SCHEME);
    velthuisItem.setActionCommand("velthuis_encoding");
    velthuisItem.addActionListener(this);

    dvnItem = new JMenuItem("Devanagari " + Constants.ENCODING_SCHEME);
    dvnItem.setActionCommand("devanagari_encoding");
    dvnItem.addActionListener(this);

    iastItem = new JMenuItem("IAST " + Constants.ENCODING_SCHEME);
    iastItem.setActionCommand("iast_encoding");
    iastItem.addActionListener(this);

    // add menuitems to menu
    file.add(open_1);
    file.add(save_1);
    file.add(save_2);
    file.add(save_3);
    file.add(exitItem);

    help.add(aboutItem);
    help.add(itransItem);
    help.add(slpItem);
    help.add(hkItem);
    help.add(velthuisItem);
    help.add(dvnItem);
    help.add(iastItem);

    // add menus to menubar
    menubar.add(file);
    menubar.add(help);
    // menus end

    // JPanel Initilization
    p1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p1a = new JPanel(new BorderLayout());
    p2 = new JPanel();
    p3 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p3a = new JPanel(new BorderLayout());

    p4 = new JPanel();
    p5 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    p5a = new JPanel(new BorderLayout());

    p6 = new JPanel();
    p6a = new JPanel();
    p7 = new JPanel();

    // JLabel Initialization
    label1 = new JLabel("Input:");
    label2 = new JLabel("Output-1");
    label3 = new JLabel("Output-2");

    capitalize = new JCheckBox("Capitalize Extended Latin");
    capitalize.setSelected(capitalizeIAST);
    capitalize.setActionCommand("capitalize");
    capitalize.addActionListener(this);

    // Buttons
    clearButton = new JButton("Clear");
    clearButton.setActionCommand("clear");
    clearButton.setToolTipText("Clear all Fields");

    refreshButton = new JButton("Refresh");
    refreshButton.setActionCommand("refresh");
    refreshButton.setToolTipText("Refesh the View");

    exitButton = new JButton("Exit");
    exitButton.setActionCommand("Exit");
    exitButton.setToolTipText("Quit the Application.");

    clipboardButton1 = new JButton("Clipboard");
    clipboardButton1.setActionCommand("clipboard-1");
    clipboardButton1.setToolTipText("Clipboard Input");

    clipboardButton2 = new JButton("Clipboard");
    clipboardButton2.setActionCommand("clipboard-2");
    clipboardButton2.setToolTipText("Clipboard Output-1");

    clipboardButton3 = new JButton("Clipboard");
    clipboardButton3.setActionCommand("clipboard-3");
    clipboardButton3.setToolTipText("Clipboard Output-2");

    clearButton.addActionListener(this);
    refreshButton.addActionListener(this);
    exitButton.addActionListener(this);

    clipboardButton1.addActionListener(this);
    clipboardButton2.addActionListener(this);
    clipboardButton3.addActionListener(this);

    Container contentPane = getContentPane();

    // JTextBox
    tb1 = new JTextArea(new PlainDocument(), null, 6, 45);
    tb1.setLineWrap(true);
    tb1.setWrapStyleWord(true);
    tb1.addKeyListener(this);

    tb2 = new JTextArea(new PlainDocument(), null, 6, 45);
    tb2.setLineWrap(true);
    tb2.setWrapStyleWord(true);
    tb2.addKeyListener(this);

    tb3 = new JTextArea(new PlainDocument(), null, 6, 45);
    tb3.setLineWrap(true);
    tb3.setWrapStyleWord(true);
    tb3.addKeyListener(this);

    // Setting Fonts
    Font unicodeFont = new Font(Constants.ARIAL_UNICODE_MS, Font.PLAIN, Constants.FONT_SIZE);
    tb1.setFont(unicodeFont);
    tb2.setFont(unicodeFont);
    tb3.setFont(unicodeFont);

    comboBox1 = new JComboBox(Constants.ENCODINGS.toArray());
    comboBox1.setActionCommand("comboBox1");
    comboBox1.setSelectedItem(Constants.ITRANS);
    comboBox1.addActionListener(this);

    comboBox2 = new JComboBox(Constants.ENCODINGS.toArray());
    comboBox2.setActionCommand("comboBox2");
    comboBox2.setSelectedItem(Constants.UNICODE_DVN);
    comboBox2.addActionListener(this);

    comboBox3 = new JComboBox(Constants.ENCODINGS.toArray());
    comboBox3.setActionCommand("comboBox3");
    comboBox3.setSelectedItem(Constants.IAST);
    comboBox3.addActionListener(this);

    /** *EXPERIMENT*** */
    textPane = new JTextPane();
    RTFEditorKit rtfkit = new RTFEditorKit();
    // HTMLEditorKit htmlkit = new HTMLEditorKit();
    textPane.setEditorKit(rtfkit); // set Kit which will read RTF Doc
    // textPane.setEditorKit(htmlkit);
    textPane.setEditable(false); // make uneditable
    textPane.setPreferredSize(new Dimension(200, 200));
    textPane.setText(""); // set

    p1.add(label1);
    p1a.add(comboBox1, BorderLayout.LINE_END);
    p1a.add(clipboardButton1, BorderLayout.LINE_START);

    p2.add(new JScrollPane(tb1));

    p3.add(label2);
    p3a.add(comboBox2, BorderLayout.LINE_END);
    p3a.add(clipboardButton2, BorderLayout.LINE_START);

    p4.add(new JScrollPane(tb2));

    p5.add(label3);
    p5a.add(comboBox3, BorderLayout.LINE_END);
    p5a.add(clipboardButton3, BorderLayout.LINE_START);

    p6.add(new JScrollPane(tb3));

    p6a.add(capitalize);
    p7.add(clearButton);
    p7.add(refreshButton);
    p7.add(exitButton);
    this.setJMenuBar(menubar);

    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));

    contentPane.add(p1);
    contentPane.add(p1a);
    contentPane.add(p2);
    contentPane.add(p3);
    contentPane.add(p3a);
    contentPane.add(p4);
    contentPane.add(p5);
    contentPane.add(p5a);
    contentPane.add(p6);
    contentPane.add(p6a);
    contentPane.add(p7);

}