List of usage examples for java.awt FlowLayout FlowLayout
public FlowLayout(int align)
From source file:edu.harvard.mcz.imagecapture.VerbatimToTranscribeDialog.java
/** * Create the dialog.//from w w w . ja va 2 s. c o m */ 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:net.sf.firemox.ui.wizard.About.java
/** * Creates a new instance of About <br> * //from w ww . jav a 2 s . c om * @param parent */ public About(JFrame parent) { super(LanguageManager.getString("wiz_about.title"), LanguageManager.getString("wiz_about.description"), "mp64.gif", LanguageManager.getString("close"), 420, 620); JPanel thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setMaximumSize(new Dimension(32767, 26)); thanksPanel.setOpaque(false); JLabel jLabel5 = new JLabel(LanguageManager.getString("version") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLabel(IdConst.VERSION); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); JPanel thanksPanelLeft = new JPanel(new FlowLayout(FlowLayout.LEADING)); thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS)); thanksPanelLeft.setMaximumSize(new Dimension(100, 2000)); thanksPanelLeft.setMinimumSize(new Dimension(100, 16)); jLabel5 = new JLabel(LanguageManager.getString("thanks") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanelLeft.add(jLabel5); thanksPanel.add(thanksPanelLeft); thanksPanelLeft = new JPanel(); thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS)); StringBuilder contributors = new StringBuilder(); addContributor(contributors, "Fabrice Daugan", "developper", "france"); addContributor(contributors, "Hoani Cross", "developper", "frenchpolynesia"); addContributor(contributors, "nico100", "graphist", "france"); addContributor(contributors, "seingalt_tm", "graphist", "france"); addContributor(contributors, "surtur2", "tester", null); addContributor(contributors, "Jan Blaha", "developper", "cz"); addContributor(contributors, "Tureba", "developper", "brazil"); addContributor(contributors, "hakvf", "tester", "france"); addContributor(contributors, "Stefano \"Kismet\" Lenzi", "developper", "italian"); jLabel5 = new JLabel(contributors.toString()); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.LEFT); thanksPanelLeft.add(jLabel5); jLabel5 = new JLink("http://obsidiurne.free.fr", "morgil has designed the splash screen"); jLabel5.setFont(MToolKit.defaultFont); thanksPanelLeft.add(jLabel5); thanksPanel.add(thanksPanelLeft); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setMaximumSize(new Dimension(32767, 26)); thanksPanel.setOpaque(false); JLabel blanklbl = new JLabel(); blanklbl.setHorizontalAlignment(SwingConstants.RIGHT); blanklbl.setMaximumSize(new Dimension(100, 16)); blanklbl.setMinimumSize(new Dimension(100, 16)); blanklbl.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(blanklbl); jLabel5 = new JLink( "http://sourceforge.net/tracker/?func=add&group_id=" + IdConst.PROJECT_ID + "&atid=601043", LanguageManager.getString("joindev")); jLabel5.setFont(MToolKit.defaultFont); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); jLabel5 = new JLabel(LanguageManager.getString("projecthome") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLink(IdConst.MAIN_PAGE, IdConst.MAIN_PAGE); jLabel5.setFont(MToolKit.defaultFont); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); // forum francais thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); jLabel5 = new JLabel(LanguageManager.getString("othersites") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLink("http://www.Firemox.fr.st", UIHelper.getIcon("mpfrsml.gif"), SwingConstants.LEFT); jLabel5.setToolTipText(LanguageManager.getString("frenchforum.tooltip")); thanksPanel.add(jLabel5); jLabel5 = new JLabel(); jLabel5.setMaximumSize(new Dimension(1000, 16)); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); JTextArea disclaimer = new JTextArea(); disclaimer.setEditable(false); disclaimer.setLineWrap(true); disclaimer.setWrapStyleWord(true); disclaimer.setAutoscrolls(true); disclaimer.setTabSize(2); disclaimer.setFont(new Font("Arial", 0, 10)); // Then try and read it locally BufferedReader inGPL = null; try { inGPL = new BufferedReader(new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_LICENSE))); disclaimer.read(inGPL, ""); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(inGPL); } JScrollPane disclaimerSPanel = new JScrollPane(); disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); MToolKit.addOverlay(disclaimerSPanel); disclaimerSPanel.setViewportView(disclaimer); gameParamPanel.add(disclaimerSPanel); }
From source file:trendgraph.XYLineChart_AWT.java
public XYLineChart_AWT(int yearStart, int yearEnd, String[] creditUnionName, String columnName) throws SQLException { super("Graph"); super.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.yearStart = yearStart; this.yearEnd = yearEnd; this.creditUnionName = creditUnionName; this.columnName = columnName; saveGraphButton = new JButton("Save Graph"); saveGraphButton.setBorderPainted(false); saveGraphButton.setFocusPainted(false); JFreeChart xylineChart = ChartFactory.createXYLineChart("CU Report", "Year (YYYY)", //X-axis columnName, //Y-axis (replace with columnName createDataset(), PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(xylineChart); chartPanel.setPreferredSize(new java.awt.Dimension(1000, 800)); //(x, y) final XYPlot plot = xylineChart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.RED); //can be GREEN, YELLOW, ETC. renderer.setSeriesStroke(0, new BasicStroke(3.0f)); //Font size renderer.setSeriesPaint(1, Color.BLUE); //can be GREEN, YELLOW, ETC. renderer.setSeriesStroke(1, new BasicStroke(3.0f)); //Font size renderer.setSeriesPaint(2, Color.GREEN); //can be GREEN, YELLOW, ETC. renderer.setSeriesStroke(2, new BasicStroke(3.0f)); //Font size renderer.setSeriesPaint(3, Color.yellow); //can be GREEN, YELLOW, ETC. renderer.setSeriesStroke(3, new BasicStroke(3.0f)); //Font size plot.setRenderer(renderer);/* w w w. j a v a2 s . co m*/ chartPanel.setLayout(new FlowLayout(FlowLayout.TRAILING)); chartPanel.add(saveGraphButton); setContentPane(chartPanel); pack(); RefineryUtilities.centerFrameOnScreen(this); setVisible(true); saveGraphButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Rectangle rect = chartPanel.getBounds(); FileChooser chooser = new FileChooser(); //get chosen path and save the variable String path = chooser.getPath(); path = path.replace("\\", "/"); String format = "png"; String fileName = path + "." + format; BufferedImage captureImage = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_INT_ARGB); chartPanel.paint(captureImage.getGraphics()); File file = new File(fileName); try { ImageIO.write(captureImage, format, file); //write data to file } catch (IOException ex) { Logger.getLogger(XYLineChart_AWT.class.getName()).log(Level.SEVERE, null, ex); } } }); }
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);/* ww w. j a va 2 s . c o 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:be.vds.jtbdive.client.view.core.stats.StatPanel.java
private Component createHeader() { statWizardButton = new JButton(new AbstractAction() { private static final long serialVersionUID = -5345284505247399133L; @Override/*www .j a v a2 s .c om*/ public void actionPerformed(ActionEvent e) { StatWizard wizard = new StatWizard(logBookManagerFacade); statQueryObject = wizard.launchWizard(); displayStatQueryObjectResult(); } }); statWizardButton.setIcon(UIAgent.getInstance().getIcon(UIAgent.ICON_STATISTICS_16)); statWizardButton.setEnabled(false); JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT)); p.setOpaque(false); p.add(statWizardButton); return p; }
From source file:net.pandoragames.far.ui.swing.component.ButtonPanel.java
/** * Initialises the BUTTON panel.// w w w. j a va 2s. c o m * @param config configuration properties * @param componentRepository repository for shared components */ private JPanel initButtonPannel(SwingConfig config, ComponentRepository componentRepository) { JPanel buttonPannel = new JPanel(); buttonPannel.setAlignmentX(Component.LEFT_ALIGNMENT); buttonPannel.setLayout(new FlowLayout(FlowLayout.TRAILING)); // FIND if (operationType == OperationType.FIND) { JButton findButton = new JButton(localizer.localize("button.find")); componentRepository.getOperationCallBackListener().addComponentStartDisabled(findButton, OperationType.FIND); componentRepository.getOperationCallBackListener().addComponentTerminationEnabled(findButton, OperationType.FIND); findButton.addActionListener(componentRepository.getFindCommand()); findButton.addActionListener(new ReorderFilePatternListListener(componentRepository.getFindForm(), config.getFileNamePatternListModel())); buttonPannel.add(findButton); } // REPLACE if (operationType == OperationType.REPLACE) { JButton replaceButton = new JButton(localizer.localize("button.replace")); replaceButton.setEnabled(false); componentRepository.getOperationCallBackListener().addComponentTerminationEnabled(replaceButton, OperationType.FIND); componentRepository.getResetDispatcher().addToBeDisabled(replaceButton); componentRepository.getSearchBaseListener().addToBeDisabled(replaceButton); ConfirmReplaceListener replaceListener = new ConfirmReplaceListener(componentRepository.getRootWindow(), config, componentRepository.getReplaceForm()); replaceListener.addActionListener(componentRepository.getReplaceCommand()); replaceButton.addActionListener(replaceListener); buttonPannel.add(replaceButton); } // RENAME if (operationType == OperationType.RENAME) { JButton renameButton = new JButton(componentRepository.getRenameCommand()); renameButton.setEnabled(false); componentRepository.getResetDispatcher().addToBeDisabled(renameButton); buttonPannel.add(renameButton); } // CANCEL JButton cancelButton = new JButton(localizer.localize("button.cancel")); cancelButton.setEnabled(false); componentRepository.getOperationCallBackListener().addComponentStartEnabled(cancelButton, OperationType.ANY); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { backend.abort(); } }); buttonPannel.add(cancelButton); componentRepository.getResetDispatcher().addToBeDisabled(cancelButton); // UNDO if (operationType == OperationType.REPLACE) { JButton undoButton = new JButton(localizer.localize("button.undo")); undoButton.setEnabled(false); componentRepository.getOperationCallBackListener().addComponentTerminationEnabled(undoButton, OperationType.REPLACE); componentRepository.getOperationCallBackListener().addComponentStartDisabled(undoButton, OperationType.FIND); undoButton.addActionListener(componentRepository.getUndoListener()); undoButton.addActionListener(new OnClickDisable(undoButton)); buttonPannel.add(undoButton); } // RESET JButton clearButton = new JButton(localizer.localize("button.reset")); clearButton.addActionListener(componentRepository.getResetDispatcher()); buttonPannel.add(clearButton); // this.add( buttonPannel ); return buttonPannel; }
From source file:net.sf.taverna.raven.plugins.ui.CheckForUpdatesDialog.java
private void initComponents() { // Base font for all components on the form Font baseFont = new JLabel("base font").getFont().deriveFont(11f); // Message saying that updates are available JPanel messagePanel = new JPanel(new BorderLayout()); messagePanel.setBorder(/*from w w w. j a v a2 s. co m*/ new CompoundBorder(new EmptyBorder(10, 10, 10, 10), new EtchedBorder(EtchedBorder.LOWERED))); JLabel message = new JLabel( "<html><body>Updates are available for some Taverna components. To review and <br>install them go to 'Updates and plugins' in the 'Advanced' menu.</body><html>"); message.setFont(baseFont.deriveFont(12f)); message.setBorder(new EmptyBorder(5, 5, 5, 5)); message.setIcon(UpdatesAvailableIcon.updateIcon); messagePanel.add(message, BorderLayout.CENTER); // Buttons JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); JButton okButton = new JButton("OK"); // we'll check for updates again in 2 weeks okButton.setFont(baseFont); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okPressed(); } }); buttonsPanel.add(okButton); getContentPane().setLayout(new BorderLayout()); getContentPane().add(messagePanel, BorderLayout.CENTER); getContentPane().add(buttonsPanel, BorderLayout.SOUTH); pack(); setResizable(false); // Center the dialog on the screen (we do not have the parent) Dimension dimension = getToolkit().getScreenSize(); Rectangle abounds = getBounds(); setLocation((dimension.width - abounds.width) / 2, (dimension.height - abounds.height) / 2); setSize(getPreferredSize()); }
From source file:ErroresPorTraza.TabbedForm.java
private void setChartCantidadErroresPorMil() { ErroresPorMilChart chartErrores = new ErroresPorMilChart(); ChartPanel chartpanel1 = chartErrores.getChartPanel("Errores por mil", jTable3); jPanelMill.removeAll();/*from w ww . ja v a2s .c o m*/ jPanelMill.setLayout(new FlowLayout(FlowLayout.LEFT)); jPanelMill.add(chartpanel1); this.setLocationRelativeTo(null); }
From source file:TextInputDemo.java
protected JComponent createButtons() { JPanel panel = new JPanel(new FlowLayout(FlowLayout.TRAILING)); JButton button = new JButton("Set address"); button.addActionListener(this); panel.add(button);/* ww w .j a va 2s .c o m*/ button = new JButton("Clear address"); button.addActionListener(this); button.setActionCommand("clear"); panel.add(button); //Match the SpringLayout's gap, subtracting 5 to make //up for the default gap FlowLayout provides. panel.setBorder(BorderFactory.createEmptyBorder(0, 0, GAP - 5, GAP - 5)); return panel; }
From source file:org.pmedv.jake.app.PlayerView.java
private JPanel createTopPanel() { JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); buttonPanel.setBackground(Colors.LIGHT_GRAY); ImageIcon playIcon = resources.getIcon("icon.play"); ImageIcon stopIcon = resources.getIcon("icon.stop"); ImageIcon nextIcon = resources.getIcon("icon.next"); ImageIcon prevIcon = resources.getIcon("icon.last"); prevButton = new CmdJButton(prevIcon, "Plays the previous song", null); nextButton = new CmdJButton(nextIcon, "Plays the next song", null); startButton = new CmdJButton(playIcon, "Starts playing", null); stopButton = new CmdJButton(stopIcon, "Stops playing", null); buttonPanel.add(startButton);/*from w w w . j ava 2s.c om*/ buttonPanel.add(stopButton); buttonPanel.add(prevButton); buttonPanel.add(nextButton); buttonPanel.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0), BorderFactory.createLineBorder(Color.LIGHT_GRAY))); timeField = new JTextField(5); timeField.setEditable(false); timeField.setBackground(Colors.SOFT_BLUE_ICE); titleField = new JMarqueeTextField(30); titleField.setEditable(false); titleField.setBackground(Colors.SOFT_BLUE_ICE); buttonPanel.add(timeField); buttonPanel.add(titleField); randomBox = new JCheckBox("R"); buttonPanel.add(randomBox); return buttonPanel; }