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:userinterface.graph.GraphOptions.java

/** Creates a new instance of MultiGraphOptions */
public GraphOptions(GUIPlugin plugin, JPanel theModel, JFrame gui, String title) {
    super(gui, title);

    gop = new GraphOptionsPanel(plugin, gui, theModel);

    gop.setPreferredSize(new Dimension(400, 650));

    this.getContentPane().add(gop);

    JPanel p = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    this.getContentPane().add(p, BorderLayout.SOUTH);

    this.getContentPane().setSize(400, 650);

    JButton jb = new JButton("Close");

    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            gop.stopEditors();/*from w  w  w  .  ja  va 2 s.  c  om*/
            setVisible(false);
        }
    });

    jb.addFocusListener(new FocusListener() {
        /**
         * Invoked when a component gains the keyboard focus.
         */
        public void focusGained(FocusEvent e) {
        }

        /**
         * Invoked when a component loses the keyboard focus.
         */
        public void focusLost(FocusEvent e) {
            //gop.stopEditors();
        }

    });

    p.add(jb);

    pack();
    setLocationRelativeTo(getParent()); // centre
    //show();
    setDefaultCloseOperation(javax.swing.JFrame.DISPOSE_ON_CLOSE);
}

From source file:com.thoughtworks.go.agent.bootstrapper.osx.MacPreferencesPane.java

public MacPreferencesPane(final AgentMacWindow agentMacWindow) {
    super();/*from  w  w  w. j  a va2  s  .  c o  m*/

    getContentPane().setLayout(new BorderLayout(10, 10));
    JLabel prefsText = new JLabel("Go Server Hostname or IP");

    serverTextField = new JTextField("");
    serverTextField.setColumns(15);
    serverTextField.selectAll();

    JPanel textPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));
    textPanel.add(prefsText);
    textPanel.add(serverTextField);

    getContentPane().add(textPanel, BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));

    JButton okButton = new JButton("OK");
    buttonPanel.add(okButton);
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent newEvent) {
            String newHost = serverTextField.getText();
            if (!originalHost.equals(newHost)) {
                LOG.info("Server changed to " + newHost);
                agentMacWindow.setHost(newHost);
            } else {
                LOG.info("Server is still " + originalHost);
            }

            setVisible(false);
        }
    });
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);

    setSize(getPreferredSize());
    setLocation(20, 40);
    setResizable(false);
}

From source file:freemrs.ChartPanelDraw.java

public ChartPanelDraw(java.util.List<Vitals> result, String type) {
    this.type = type;
    this.result = result;
    dataset = createTimeDataset();//from w w  w. j  a  va  2 s  .c  o  m
    chartPanel = createChart(dataset, type);

    JFrame f = new JFrame("Vital Plot"); //Jframe to draw the graph
    f.setTitle("Vital Plot");
    f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    f.setLayout(new BorderLayout(0, 5));
    f.add(chartPanel, BorderLayout.CENTER);
    f.setIconImage(new ImageIcon(getClass().getResource("/images/icon_transparent.png")).getImage());

    chartPanel.setHorizontalAxisTrace(true); //set properties of the graph 
    chartPanel.setVerticalAxisTrace(true);
    chartPanel.setMouseWheelEnabled(true);

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    panel.add(createTrace()); //Add components to panel
    panel.add(createDate());
    panel.add(createZoom());
    f.add(panel, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:EHRAppointment.ChartPanelDraw.java

/**
 *
 * @param result//from   w  w w .  j  a va2  s  .co m
 * @param type
 */
public ChartPanelDraw(java.util.List<Vitals> result, String type) {
    this.type = type;
    this.result = result;
    dataset = createTimeDataset();
    chartPanel = createChart(dataset, type);

    JFrame f = new JFrame("Vital Plot"); //Jframe to draw the graph
    f.setTitle("Vital Plot");
    f.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    f.setLayout(new BorderLayout(0, 5));
    f.add(chartPanel, BorderLayout.CENTER);
    f.setIconImage(new ImageIcon(getClass().getResource("/images/icon_transparent.png")).getImage());

    chartPanel.setHorizontalAxisTrace(true); //set properties of the graph 
    chartPanel.setVerticalAxisTrace(true);
    chartPanel.setMouseWheelEnabled(true);

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    panel.add(createTrace()); //Add components to panel
    panel.add(createDate());
    panel.add(createZoom());
    f.add(panel, BorderLayout.SOUTH);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
}

From source file:org.pgptool.gui.ui.importkey.KeyImporterView.java

private JPanel buildPanelButtons() {
    JPanel ret = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
    ret.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
    ret.add(btnImport = new JButton());
    ret.add(btnCancel = new JButton());
    return ret;//from  w  w w  .j  a v  a2 s  .co m
}

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

/**
 * Constructor./*from   w w  w. j  a  v  a 2  s.c o m*/
 */
public AddLinkToConceptJDialog() {
    super("Add Link To Note");

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

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

    predicateNs = new JTextField(38);
    predicateNs.setText("http://" + MindRaider.profile.getHostname() + "/e-mentality/conceptLink/custom#");
    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.LEFT));
    p.add(new JLabel(" Note: "));

    objectNs = new JTextField(38);
    objectNs.setText("");
    objectNs.selectAll();
    p.add(objectNs);

    findConceptButton = new JButton("Find Note");
    findConceptButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            OpenNoteJDialog.NoteToOpen conceptToOpen = new OpenNoteJDialog.NoteToOpen();
            new OpenNoteJDialog("OpenNoteJDialog.titleLink", "OpenNoteJDialog.selectConceptToLink",
                    "OpenNoteJDialog.link", null, conceptToOpen);
            if (conceptToOpen.conceptLabel != null) {
                objectNs.setText(conceptToOpen.conceptUri);
            }
        }

    });
    p.add(findConceptButton);
    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) {
            AddLinkToConceptJDialog.this.dispose();
        }
    });
    framePanel.add(p);

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

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

From source file:FileViewer.java

/**
 * The real constructor. Create a FileViewer object to display the specified
 * file from the specified directory/*from  www . j  a  va2  s . com*/
 */
public FileViewer(String directory, String filename) {
    super(); // Create the frame

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

    // Create a TextArea to display the contents of the file in
    textarea = new TextArea("", 24, 80);
    textarea.setFont(new Font("MonoSpaced", Font.PLAIN, 12));
    textarea.setEditable(false);
    this.add("Center", textarea);

    // Create a bottom panel to hold a couple of buttons in
    Panel p = new Panel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 5));
    this.add(p, "South");

    // Create the buttons and arrange to handle button clicks
    Font font = new Font("SansSerif", Font.BOLD, 14);
    Button openfile = new Button("Open File");
    Button close = new Button("Close");
    openfile.addActionListener(this);
    openfile.setActionCommand("open");
    openfile.setFont(font);
    close.addActionListener(this);
    close.setActionCommand("close");
    close.setFont(font);
    p.add(openfile);
    p.add(close);

    this.pack();

    // Figure out the directory, from filename or current dir, if necessary
    if (directory == null) {
        File f;
        if ((filename != null) && (f = new File(filename)).isAbsolute()) {
            directory = f.getParent();
            filename = f.getName();
        } else
            directory = System.getProperty("user.dir");
    }

    this.directory = directory; // Remember the directory, for FileDialog
    setFile(directory, filename); // Now load and display the file
}

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

/**
 * Constructor./*  w ww  .j  av a  2s.co  m*/
 */
public NewRdfModelJDialog() {

    super(Messages.getString("NewRdfModelJDialog.title"));

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

    JPanel p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.RIGHT));
    p.add(new JLabel(Messages.getString("NewRdfModelJDialog.subject")));

    subjectNs = new JTextField(30);
    subjectNs.setText(MindRaiderConstants.MR_RDF_PREDICATE_NS);
    p.add(subjectNs);
    p.add(new JLabel("#"));

    subjectLocalName = new JTextField(15);
    p.add(subjectLocalName);
    framePanel.add(p);

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

    p = new JPanel();
    p.setLayout(new FlowLayout(FlowLayout.CENTER));
    JButton addButton = new JButton(Messages.getString("NewRdfModelJDialog.create"));
    p.add(addButton);
    addButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            createModel(literalCheckBox);
        }
    });

    JButton cancelButton = new JButton(Messages.getString("NewRdfModelJDialog.cancel"));
    p.add(cancelButton);
    cancelButton.addActionListener(new ActionListener() {

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

    subjectLocalName.addKeyListener(new KeyListener() {

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

        public void keyReleased(KeyEvent keyEvent) {
        }

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

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

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

    addWindowListener(new WindowAdapter() {

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

From source file:View.SavedView.java

public SavedView(SavedController controller) throws IOException {
    this.frame = new JFrame();
    this.topPane = new JPanel();
    this.container = frame.getContentPane();
    this.controller = controller;

    frame.setTitle("Lista de Emails Salvas no Banco de Datos");

    container.setLayout(new BorderLayout(20, 20));

    tabela = new TableView();

    listPane = new JScrollPane(tabela.getTable());

    JButton btnOpen = new JButton("Abrir");
    btnOpen.addActionListener((ActionEvent e) -> {
        int row = tabela.getSelectedRow();
        int id = Integer.parseInt(tabela.getModel().getValueAt(row, 0).toString());

        try {/*w  w  w .  java  2 s  . c om*/
            ReadController readController = new ReadController();
            readController.setEmailFromDB(id);
        } catch (IOException ex) {
            Logger.getLogger(MainView.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException | SQLException ex) {
            Logger.getLogger(SavedView.class.getName()).log(Level.SEVERE, null, ex);
        }

    });

    topPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    topPane.add(btnOpen);

    container.add(BorderLayout.NORTH, topPane);
    container.add(BorderLayout.CENTER, listPane);

    frame.pack();

    frame.setResizable(false);
    frame.setLocationRelativeTo(null);
    frame.setSize(600, 600);

    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation(dim.width / 2 - frame.getSize().width / 2, dim.height / 2 - frame.getSize().height / 2);

    frame.setVisible(true);
}

From source file:org.madeirahs.editor.ui.SubviewUI.java

/**
 * Constructs a new Submissions viewing UI. It is recommended that you call
 * this from the UI thread.//from   ww w  .  j a  va 2  s.  com
 * 
 * @param owner
 * @param prov
 */
public SubviewUI(MainUI owner, final FTPProvider prov) {
    super(owner, "Database Submissions");
    parent = owner;
    this.prov = prov;
    final SubviewUI inst = this;
    list = new JList();
    list.setBorder(new EmptyBorder(5, 5, 5, 5));
    btns = new JPanel();
    ((FlowLayout) btns.getLayout()).setAlignment(FlowLayout.RIGHT);
    load = new JButton("Load");
    load.addActionListener(new LoadListener());
    accept = new JButton("Accept");
    accept.addActionListener(new AcceptListener());
    remove = new JButton("Remove");
    remove.addActionListener(new RemoveListener());
    btns.add(load);
    btns.add(accept);
    btns.add(remove);
    add(BorderLayout.CENTER, list);
    add(BorderLayout.SOUTH, btns);
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new OnCloseDialog());
    setSize(300, 300);
    setLocationRelativeTo(parent);
    new Thread(new Runnable() {

        @Override
        public void run() {
            try {
                ProgressMonitor prog = new ProgressMonitor(inst, "Retrieving Database", "", 0, 101);
                prog.setMillisToDecideToPopup(0);
                prog.setMillisToPopup(0);
                dbi = Database.getInstance(ServerFTP.dbDir, prov, prog);
                prog.close();

                try {
                    loadListData();
                } catch (IllegalServerStateException e) {
                    e.printStackTrace();
                    JOptionPane.showMessageDialog(null,
                            "Server communication error.  Please contact server admin.\n" + e.toString(),
                            "Bad Response", JOptionPane.ERROR_MESSAGE);
                }

                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        list.validate();
                    }

                });
            } catch (ClassCastException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
                JOptionPane.showMessageDialog(parent, "Error downloading database:\n" + e.toString(),
                        "I/O Error", JOptionPane.ERROR_MESSAGE);
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
        }

    }).start();
}