List of usage examples for java.awt FlowLayout RIGHT
int RIGHT
To view the source code for java.awt FlowLayout RIGHT.
Click Source Link
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);//from w w w . java2s. co m add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); System.out.println(flowLayout.getAlignOnBaseline()); }
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);// w ww. j av a2s. co m add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); System.out.println(flowLayout.minimumLayoutSize(this)); }
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);/*from ww w . j ava 2s . c om*/ add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); flowLayout.setAlignOnBaseline(false); }
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);// w ww . j a v a2 s . c om add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); flowLayout.setAlignment(FlowLayout.CENTER); }
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);/*from w w w .ja v a2 s. co m*/ add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); System.out.println(flowLayout.toString()); }
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);/*from w ww .j a v a2 s. c o m*/ add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); System.out.println(flowLayout.preferredLayoutSize(this)); }
From source file:Main.java
public Main() { FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT, 10, 3); setLayout(flowLayout);/*from w w w . j a va 2 s . c o m*/ add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); flowLayout.setHgap(10); flowLayout.setVgap(12); }
From source file:MainClass.java
public MainClass() { super(new FlowLayout(FlowLayout.RIGHT, 10, 3)); add(new JButton("w w w.j a v a 2 s . c o m")); add(new JButton("w w w.j a v a 2 s . com")); add(new JButton("w w w.java2s.com")); add(new JButton("www.j ava 2 s . c o m")); }
From source file:Main.java
public static boolean showModalDialogOnEDT(JComponent contents, String title, String okButtonMessage, String cancelButtonMessage, ModalityType modalityType, final boolean systemExitOnDisposed) { class Result { boolean OK = false; }/* www . j av a2s . c o m*/ final Result result = new Result(); final JDialog dialog = new JDialog((Frame) null, title, true) { @Override public void dispose() { super.dispose(); if (systemExitOnDisposed) { System.exit(0); } } }; // ensure it doesn't block other dialogs if (modalityType != null) { dialog.setModalityType(modalityType); } // See http://stackoverflow.com/questions/1343542/how-do-i-close-a-jdialog-and-have-the-window-event-listeners-be-notified dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); if (okButtonMessage != null) { buttonPane.add(new JButton(new AbstractAction(okButtonMessage) { @Override public void actionPerformed(ActionEvent e) { result.OK = true; dialog.dispose(); } })); } if (cancelButtonMessage != null) { buttonPane.add(new JButton(new AbstractAction(cancelButtonMessage) { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); } })); } JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel.setLayout(new BorderLayout()); panel.add(contents, BorderLayout.CENTER); panel.add(buttonPane, BorderLayout.SOUTH); // startup frame dialog.getContentPane().add(panel); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.pack(); // This hopefully centres the dialog even though the parameter is null // see http://stackoverflow.com/questions/213266/how-do-i-center-a-jdialog-on-screen dialog.setLocationRelativeTo(null); dialog.setVisible(true); return result.OK; }
From source file:Main.java
public Main() { dialog.setLayout(new GridLayout()); yes.addActionListener(this); no.addActionListener(this); JPanel btnPanel = new JPanel(); btnPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); btnPanel.add(yes);/*from ww w . ja v a 2 s . c o m*/ btnPanel.add(no); dialog.add(message, "Center"); dialog.add(btnPanel, "South"); dialog.pack(); dialog.setVisible(true); dialog.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); new Thread(this).start(); }