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:pcgen.gui2.dialog.RandomNameDialog.java

private void initUserInterface() {
    getContentPane().setLayout(new BorderLayout());

    getContentPane().add(nameGenPanel, BorderLayout.CENTER);

    // Build the control panel (OK/Cancel buttons)
    JPanel controlPanel = new JPanel();
    controlPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    JButton okButton = new JButton(LanguageBundle.getString("in_ok")); //$NON-NLS-1$
    okButton.setMnemonic(LanguageBundle.getMnemonic("in_mn_ok")); //$NON-NLS-1$
    controlPanel.add(okButton);//from ww w .j a  va2  s .co  m
    okButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            okButtonActionPerformed();
        }
    });

    JButton cancelButton = new JButton(LanguageBundle.getString("in_cancel")); //$NON-NLS-1$
    cancelButton.setMnemonic(LanguageBundle.getMnemonic("in_mn_cancel")); //$NON-NLS-1$
    controlPanel.add(cancelButton);
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelButtonActionPerformed();
        }
    });
    getContentPane().add(controlPanel, BorderLayout.SOUTH);
}

From source file:com.emental.mindraider.ui.dialogs.AddTripletJDialog.java

/**
 * Constructor./*from  w ww .  ja  va2 s .c  o  m*/
 */
public AddTripletJDialog() {
    super("Add Triplet");

    JPanel framePanel = new JPanel();
    framePanel.setLayout(new GridLayout(4, 1));

    JPanel p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p.add(new JLabel(" Predicate: "));

    predicateNs = new JTextField(30);
    predicateNs.setText(MindRaiderConstants.MR_RDF_PREDICATE_NS);
    predicateNs.selectAll();
    p.add(predicateNs);
    p.add(new JLabel("#"));
    predicateLocalName = new JTextField(15);
    p.add(predicateLocalName);
    framePanel.add(p);

    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p.add(new JLabel(" Object: "));

    objectNs = new JTextField(30);
    objectNs.setText(MindRaiderConstants.MR_RDF_PREDICATE_NS);
    objectNs.selectAll();
    p.add(objectNs);
    p.add(new JLabel("#"));
    objectLocalName = new JTextField(15);
    objectLocalName.grabFocus();
    objectLocalName.selectAll();
    objectLocalName.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent keyEvent) {
            if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) {
                createTriplet();
            }
        }

        public void keyReleased(KeyEvent keyEvent) {
        }

        public void keyTyped(KeyEvent keyEvent) {
        }
    });

    p.add(objectLocalName);
    framePanel.add(p);

    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT));
    literalCheckBox = new JCheckBox("literal", false);
    p.add(literalCheckBox);
    framePanel.add(p);

    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER));
    JButton addButton = new JButton("Add");
    p.add(addButton);
    addButton.addActionListener(new ActionListener() {

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

    JButton cancelButton = new JButton("Cancel");
    p.add(cancelButton);
    cancelButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            AddTripletJDialog.this.dispose();
        }
    });
    framePanel.add(p);

    getContentPane().add(framePanel, BorderLayout.CENTER);

    // show
    pack();
    Gfx.centerAndShowWindow(this);

    addWindowListener(new WindowAdapter() {

        public void windowActivated(WindowEvent e) {
            getObjectLocalName().requestFocusInWindow();
        }
    });
}

From source file:org.openpnp.gui.AboutDialog.java

public AboutDialog(Frame frame) {
    super(frame, true);
    setTitle("About OpenPnP");
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 347, 360);//w  ww  . j  a  v  a  2 s  .  co  m
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
    JLabel lblOpenpnp = new JLabel("OpenPnP");
    lblOpenpnp.setAlignmentX(Component.CENTER_ALIGNMENT);
    lblOpenpnp.setFont(new Font("Lucida Grande", Font.BOLD, 32));
    contentPanel.add(lblOpenpnp);
    JLabel lblCopyright = new JLabel("Copyright  2011 - 2016 Jason von Nieda");
    lblCopyright.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
    lblCopyright.setAlignmentX(Component.CENTER_ALIGNMENT);
    contentPanel.add(lblCopyright);
    JLabel lblVersion = new JLabel("Version: " + Main.getVersion());
    lblVersion.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
    lblVersion.setAlignmentX(Component.CENTER_ALIGNMENT);
    contentPanel.add(lblVersion);

    textPane = new JTextPane();
    textPane.setEditable(false);
    contentPanel.add(new JScrollPane(textPane));
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    getContentPane().add(buttonPane, BorderLayout.SOUTH);
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            setVisible(false);
        }
    });
    okButton.setActionCommand("OK");
    buttonPane.add(okButton);
    getRootPane().setDefaultButton(okButton);

    try {
        String s = FileUtils.readFileToString(new File("CHANGES.md"));
        textPane.setText(s);
        textPane.setCaretPosition(0);
    } catch (Exception e) {

    }
}

From source file:net.chunkyhosting.Roe.computer.CHGManager.gui.dialogs.DownloadNotice.java

public DownloadNotice(HashMap<JSONObject, URL> downloads) {

    this.setDownloads(downloads);
    JPanel basic = new JPanel();
    basic.setLayout(new BoxLayout(basic, BoxLayout.Y_AXIS));
    add(basic);//w  w  w . jav  a 2  s  . c  om

    JPanel topPanel = new JPanel(new BorderLayout(0, 0));
    topPanel.setMaximumSize(new Dimension(450, 0));
    JLabel hint = new JLabel("CHGManager Download Manager");
    hint.setBorder(BorderFactory.createEmptyBorder(0, 25, 0, 0));
    topPanel.add(hint);

    JSeparator separator = new JSeparator();
    separator.setForeground(Color.gray);

    topPanel.add(separator, BorderLayout.SOUTH);

    basic.add(topPanel);

    JPanel textPanel = new JPanel(new BorderLayout());
    textPanel.setBorder(BorderFactory.createEmptyBorder(15, 25, 15, 25));
    this.setTextPanel(new JTextPane());

    this.getTextPanel().setContentType("text/html");
    String text = "<p><b>Some files are missing from your CHGManager install. Don't worry. We're trying to download them. Please don't close this panel!</b></p>";
    this.getText().add(text);
    this.getTextPanel().setText(text);
    this.getTextPanel().setEditable(false);
    JScrollPane sp = new JScrollPane();
    sp.setSize(this.getTextPanel().getSize());
    basic.add(sp);

    //basic.add(textPanel);

    JPanel boxPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 20, 0));
    basic.add(boxPanel);

    JPanel bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    JButton close = new JButton("Close");

    bottom.add(close);
    basic.add(bottom);

    bottom.setMaximumSize(new Dimension(450, 0));

    this.setTitle("CHGManager Download Manager");
    this.setResizable(false);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
    try {

        Thread.sleep(2000);

    } catch (InterruptedException e) {

    }

    this.startDownload();

}

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

/**
 * Create the dialog./*from  w w w . j av  a  2  s .c om*/
 */
public VerbatimToTranscribeDialog() {
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setBounds(100, 100, 726, 557);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    {
        table = new JTable();
        SpecimenLifeCycle sls = new SpecimenLifeCycle();
        GenusSpeciesCountTableModel model = new GenusSpeciesCountTableModel(sls.countSpecimensForVerbatim());
        table.setModel(model);
        table.setDefaultRenderer(GenusSpeciesCount.class, new ButtonRenderer("Transcribe"));
        table.setDefaultEditor(GenusSpeciesCount.class,
                new ButtonEditor(ButtonEditor.OPEN_SPECIMEN_VERBATIM, this));
        contentPanel.add(table, BorderLayout.CENTER);
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton cancelButton = new JButton("Close");
            cancelButton.setActionCommand("Close");
            cancelButton.addActionListener(new ActionListener() {

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

            });
            buttonPane.add(cancelButton);
        }
    }
}

From source file:savant.view.dialog.PluginRepositoryDialog.java

/**
 * Instantiate a plugin repository browser and let the user select from it.
 * Typically this is invoked from the PluginManagerDialog.
 *
 * @param parent parent window//from   w w  w  .  j a  va  2 s. co m
 * @param title window title
 * @param buttonText text of button (typically "Install")
 * @param xmlFile plugin.xml file which defines repository entries
 */
public PluginRepositoryDialog(Window parent, String title, String buttonText, File xmlFile)
        throws JDOMException, IOException {
    super(parent, title, Dialog.ModalityType.APPLICATION_MODAL);

    setResizable(true);
    setLayout(new BorderLayout());
    add(getCenterPanel(getDownloadTreeRows(xmlFile)), BorderLayout.CENTER);

    JPanel bottomBar = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));

    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });
    bottomBar.add(cancelButton);

    JButton installButton = new JButton(buttonText);
    installButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            downloadSelectedItem(false);
        }
    });
    bottomBar.add(installButton);

    add(bottomBar, BorderLayout.SOUTH);

    setPreferredSize(new Dimension(1000, 500));
    pack();

    getRootPane().setDefaultButton(installButton);
    MiscUtils.registerCancelButton(cancelButton);
    setLocationRelativeTo(parent);
}

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

protected void init() {
    setTitle("Verbatim Transcriptions to parse into fields");
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    setBounds(100, 100, 1000, 600);//from  w ww . j  a v a 2  s . co m
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BorderLayout(0, 0));
    SpecimenLifeCycle sls = new SpecimenLifeCycle();
    table = new JTable(new VerbatimCountTableModel(sls.countDistinctVerbatimValues()));
    table.setDefaultRenderer(VerbatimCount.class, new ButtonRenderer("Edit"));
    table.setDefaultEditor(VerbatimCount.class, new ButtonEditor(ButtonEditor.OPEN_VERBATIM_CLASSIFY, this));
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setViewportView(table);
    contentPanel.add(scrollPane, BorderLayout.CENTER);
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton cancelButton = new JButton("Close");
            cancelButton.setActionCommand("Close");
            cancelButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    setVisible(false);
                }

            });
            buttonPane.add(cancelButton);
        }
    }
}

From source file:org.ut.biolab.medsavant.client.plugin.PluginRepositoryDialog.java

/**
 * Instantiate a plugin repository browser and let the user select from it.
 * Typically this is invoked from the PluginManagerDialog.
 *
 * @param parent parent window//w  ww.ja  v  a  2  s  .  c  o  m
 * @param title window title
 * @param buttonText text of button (typically "Install")
 * @param xmlFile plugin.xml file which defines repository entries
 */
PluginRepositoryDialog(Window parent, String title, String buttonText, File xmlFile)
        throws JDOMException, IOException {
    super(parent, title, Dialog.ModalityType.APPLICATION_MODAL);

    setResizable(true);
    setLayout(new BorderLayout());
    add(getCenterPanel(getDownloadTreeRows(xmlFile)), BorderLayout.CENTER);

    JPanel bottomBar = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));

    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
        }
    });
    bottomBar.add(cancelButton);

    JButton installButton = new JButton(buttonText);
    installButton.putClientProperty("JButton.buttonType", "default");
    installButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            downloadSelectedItem(false);
        }
    });
    bottomBar.add(installButton);

    add(bottomBar, BorderLayout.SOUTH);

    setPreferredSize(new Dimension(800, 500));
    pack();

    setLocationRelativeTo(parent);
    ClientMiscUtils.registerCancelButton(cancelButton);
}

From source file:FileLister.java

/**
 * Constructor: create the GUI, and list the initial directory.
 *//*from   w  ww . j a  va  2s .c  o m*/
public FileLister(String directory, FilenameFilter filter) {
    super("File Lister"); // Create the window
    this.filter = filter; // Save the filter, if any

    // Destroy the window when the user requests it
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            dispose();
        }
    });

    list = new List(12, false); // Set up the list
    list.setFont(new Font("MonoSpaced", Font.PLAIN, 14));
    list.addActionListener(this);
    list.addItemListener(this);

    details = new TextField(); // Set up the details area
    details.setFont(new Font("MonoSpaced", Font.PLAIN, 12));
    details.setEditable(false);

    buttons = new Panel(); // Set up the button box
    buttons.setLayout(new FlowLayout(FlowLayout.RIGHT, 15, 5));
    buttons.setFont(new Font("SansSerif", Font.BOLD, 14));

    up = new Button("Up a Directory"); // Set up the two buttons
    close = new Button("Close");
    up.addActionListener(this);
    close.addActionListener(this);

    buttons.add(up); // Add buttons to button box
    buttons.add(close);

    this.add(list, "Center"); // Add stuff to the window
    this.add(details, "North");
    this.add(buttons, "South");
    this.setSize(500, 350);

    listDirectory(directory); // And now list initial directory.
}

From source file:com.orthancserver.OrthancConfigurationDialog.java

public OrthancConfigurationDialog() {
    final JPanel contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(20, 5, 5, 5));
    contentPanel.setLayout(new GridLayout2(0, 2, 20, 5));

    JLabel label = new JLabel("Name:");
    label.setHorizontalAlignment(JLabel.RIGHT);
    contentPanel.add(label);/*  w w  w. j av a 2s.  c  o  m*/
    contentPanel.add(name_);

    label = new JLabel("URL:");
    label.setHorizontalAlignment(JLabel.RIGHT);
    contentPanel.add(label);
    contentPanel.add(url_);

    label = new JLabel("Username:");
    label.setHorizontalAlignment(JLabel.RIGHT);
    contentPanel.add(label);
    contentPanel.add(username_);

    label = new JLabel("Password:");
    label.setHorizontalAlignment(JLabel.RIGHT);
    contentPanel.add(label);
    contentPanel.add(password_);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(contentPanel, BorderLayout.NORTH);

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    getContentPane().add(buttonPane, BorderLayout.SOUTH);
    {
        {
            JButton test = new JButton("Test connection");
            test.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    OrthancConnection orthanc = CreateConnection();
                    try {
                        JSONObject system = (JSONObject) orthanc.ReadJson("system");
                        JOptionPane.showMessageDialog(null,
                                "Successfully connected to this Orthanc server " + "(version: "
                                        + (String) system.get("Version") + ")!",
                                "Success", JOptionPane.INFORMATION_MESSAGE);
                    } catch (IOException e) {
                        JOptionPane.showMessageDialog(null, "Cannot connect to this Orthanc server!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                }
            });
            buttonPane.add(test);
        }
        {
            JButton okButton = new JButton("Add");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    isSuccess_ = true;
                    setVisible(false);
                }
            });
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg) {
                    setVisible(false);
                }
            });
            buttonPane.add(cancelButton);
        }
    }

    setUndecorated(false);
    setSize(500, 500);
    setTitle("Add new server");
    setModal(true);
}