List of usage examples for java.awt FlowLayout LEFT
int LEFT
To view the source code for java.awt FlowLayout LEFT.
Click Source Link
From source file:com.sec.ose.osi.ui.frm.main.report.JPanBillOfMaterials.java
private JPanel getJPanelCheckAll() { if (jPanelCheckAll == null) { jPanelCheckAll = new JPanel(new FlowLayout(FlowLayout.LEFT)); jPanelCheckAll.add(getJCheckBoxCheckAll()); jPanelCheckAll.add(getJLabelCheckAll()); jPanelCheckAll.add(new JLabel(" "), new JLabel(" ").getName()); }// w w w.ja v a 2 s.co m return jPanelCheckAll; }
From source file:com.limegroup.gnutella.gui.GUIUtils.java
/** * Left flushes the given component./* w w w . j a v a2s. com*/ */ public static JPanel left(JComponent c) { JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); p.add(c); return p; }
From source file:org.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java
private void drillToOverview(final ValueCountingAnalyzerResult result) { final TableModel model = new DefaultTableModel(new String[] { "Value", LabelUtils.COUNT_LABEL }, _valueCounts.size());// ww w . j a v a2s . co m int i = 0; for (final ValueFrequency valueFreq : _valueCounts) { final String key = valueFreq.getName(); final int count = valueFreq.getCount(); model.setValueAt(key, i, 0); if (valueFreq.isComposite() && valueFreq.getChildren() != null && !valueFreq.getChildren().isEmpty()) { DCPanel panel = new DCPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); JLabel label = new JLabel(count + ""); JButton button = WidgetFactory.createSmallButton(IconUtils.ACTION_DRILL_TO_DETAIL); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { drillToGroup(result, valueFreq, true); } }); panel.add(label); panel.add(Box.createHorizontalStrut(4)); panel.add(button); model.setValueAt(panel, i, 1); } else { setCountValue(result, model, i, valueFreq); } i++; } _table.setModel(model); _backButton.setVisible(false); _rightPanel.updateUI(); }
From source file:com.petersoft.advancedswing.enhancedtextarea.EnhancedTextArea.java
private void initGUI() { try {//from w w w. j ava 2 s. c om BorderLayout thisLayout = new BorderLayout(); this.setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(725, 290)); { jToolBar = new JToolBar(); this.add(jToolBar, BorderLayout.NORTH); { jSaveButton = new JButton(); jToolBar.add(jSaveButton); jSaveButton.setText("Save"); jSaveButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/disk.png"))); jSaveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jSaveButtonActionPerformed(evt); } }); } { jLineWrapButton = new JToggleButton(); jToolBar.add(jLineWrapButton); jLineWrapButton.setText("Wrap"); jLineWrapButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/linewrap.png"))); jLineWrapButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jLineWrapButtonActionPerformed(evt); } }); } { jFontBiggerButton = new JButton(); jToolBar.add(jFontBiggerButton); jFontBiggerButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/font_add.png"))); jFontBiggerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontBiggerButtonActionPerformed(evt); } }); } { jFontSmallerButton = new JButton(); jToolBar.add(jFontSmallerButton); jFontSmallerButton.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("com/petersoft/advancedswing/enhancedtextarea/font_delete.png"))); jFontSmallerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontSmallerButtonActionPerformed(evt); } }); } { jLabel1 = new JLabel(); jToolBar.add(jLabel1); jLabel1.setText(" "); } { jSearchTextField = new JSearchTextField(); jToolBar.add(jSearchTextField); jSearchTextField.setMaximumSize(new java.awt.Dimension(100, 22)); jSearchTextField.setPreferredSize(new java.awt.Dimension(100, 22)); jSearchTextField.setSize(new java.awt.Dimension(100, 22)); jSearchTextField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent evt) { jSearchTextFieldKeyReleased(evt); } }); } { jSeparatorLabel = new JLabel(); jToolBar.add(jSeparatorLabel); jSeparatorLabel.setText(" "); } { GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = e.getAllFonts(); String fontNames[] = new String[fonts.length]; int x = 0; for (Font f : fonts) { fontNames[x++] = f.getFontName(); } ComboBoxModel jFontComboBoxModel = new DefaultComboBoxModel(fontNames); jFontComboBox = new JComboBox(); jToolBar.add(jFontComboBox); jFontComboBox.setModel(jFontComboBoxModel); jFontComboBox.setMaximumSize(new java.awt.Dimension(180, 22)); jFontComboBox.setPreferredSize(new java.awt.Dimension(180, 22)); jFontComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jFontComboBoxActionPerformed(evt); } }); } { pager = new Pager(); jToolBar.add(pager); pager.setVisible(false); } } { jScrollPane1 = new JScrollPane(); this.add(jScrollPane1, BorderLayout.CENTER); { jTextArea = new JTextArea(); jTextArea.getDocument().addDocumentListener(this); lines = new JTextArea(" 1 "); lines.setBackground(new Color(200, 230, 245)); lines.setEditable(false); jScrollPane1.setRowHeaderView(lines); jTextArea.getDocument().addDocumentListener(new DocumentListener() { public String getText() { int caretPosition = jTextArea.getDocument().getLength(); Element root = jTextArea.getDocument().getDefaultRootElement(); int base = 0; if (separateByLine == false) { if (str != null) { base = StringUtils.countMatches( str.substring(0, (pager.getPage() - 1) * pageSize), System.getProperty("line.separator")); if (base == 1) { base = 0; } } } else { base = (pager.getPage() - 1) * pageSize; } base += lineNoBase; String text = " " + (base + 1) + " " + System.getProperty("line.separator"); for (int i = 2; i < root.getElementIndex(caretPosition) + 2; i++) { text += " " + (base + i) + " " + System.getProperty("line.separator"); } return text; } @Override public void changedUpdate(DocumentEvent de) { lines.setText(getText()); } @Override public void insertUpdate(DocumentEvent de) { lines.setText(getText()); } @Override public void removeUpdate(DocumentEvent de) { lines.setText(getText()); } }); jScrollPane1.setViewportView(jTextArea); } } { jStatusPanel = new JPanel(); FlowLayout jStatusPanelLayout = new FlowLayout(); jStatusPanelLayout.setAlignment(FlowLayout.LEFT); jStatusPanel.setLayout(jStatusPanelLayout); this.add(jStatusPanel, BorderLayout.SOUTH); { jStatusLabel = new JLabel(); jStatusPanel.add(jStatusLabel); } { jSearchLabel = new JLabel(); jStatusPanel.add(jSearchLabel); } } this.jFontComboBox.setSelectedItem(jTextArea.getFont().getFamily() + ".plain"); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Formats the header.//from w w w . ja va 2 s. c o m * * @param text The text to display * @return See above. */ private JPanel formatHeader(String text) { JPanel title = new JPanel(); title.setLayout(new FlowLayout(FlowLayout.LEFT)); title.add(UIUtilities.setTextFont(text)); title.setBackground(UIUtilities.BACKGROUND_COLOUR_EVEN); return title; }
From source file:com.accenture.assets.ui.dialogs.panels.NewProjectConfigurationDialogPanel.java
/** * //from w ww . j a va 2 s .co m */ private JPanel getProjectNamePanel() { if (projectNamePanel == null) { projectNamePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); projectNamePanel.add(getProjectNameLabel()); projectNamePanel.add(getProjectNameInput()); projectNamePanel.setName("projectNamePanel"); } return projectNamePanel; }
From source file:nz.ac.waikato.cms.supernova.gui.Supernova.java
/** * Creates the panel for generating a single graph. * * @return the panel// w ww . j ava 2 s . c o m */ protected BasePanel createSinglePanel() { BasePanel result; JPanel params; JPanel left1; JPanel left2; JPanel panel; JPanel panel2; result = new BasePanel(new BorderLayout()); panel = new JPanel(new BorderLayout()); result.add(panel, BorderLayout.CENTER); m_PanelSinglePreview = new ImagePanel(); panel.add(new BaseScrollPane(m_PanelSinglePreview), BorderLayout.CENTER); panel2 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panel.add(panel2, BorderLayout.SOUTH); m_SingleCopy = new JButton(GUIHelper.getIcon("copy.gif")); m_SingleCopy.setEnabled(false); m_SingleCopy.addActionListener((ActionEvent e) -> copySinglePreview()); panel2.add(m_SingleCopy); left1 = new JPanel(new BorderLayout()); result.add(left1, BorderLayout.WEST); // params with height 2 params = new JPanel(new GridLayout(0, 1)); left1.add(params, BorderLayout.NORTH); m_SingleStatistics = new StatisticsTable(); left1.add(new BaseScrollPane(m_SingleStatistics), BorderLayout.NORTH); // params with height 1 panel = new JPanel(new BorderLayout()); left1.add(panel, BorderLayout.CENTER); left2 = new JPanel(new BorderLayout()); panel.add(left2, BorderLayout.NORTH); params = new JPanel(new GridLayout(0, 1)); left2.add(params, BorderLayout.NORTH); // background m_SingleBackground = new ColorButton(Color.BLACK); params.add(createParameter("Background", m_SingleBackground)); // opacity m_SingleOpacity = new JSpinner(); m_SingleOpacity.setValue(10); ((SpinnerNumberModel) m_SingleOpacity.getModel()).setMinimum(0); ((SpinnerNumberModel) m_SingleOpacity.getModel()).setMaximum(100); ((SpinnerNumberModel) m_SingleOpacity.getModel()).setStepSize(10); ((JSpinner.DefaultEditor) m_SingleOpacity.getEditor()).getTextField().setColumns(5); params.add(createParameter("Opacity %", m_SingleOpacity)); // margin m_SingleMargin = new JSpinner(); m_SingleMargin.setValue(20); ((SpinnerNumberModel) m_SingleMargin.getModel()).setMinimum(0); ((SpinnerNumberModel) m_SingleMargin.getModel()).setMaximum(100); ((SpinnerNumberModel) m_SingleMargin.getModel()).setStepSize(10); ((JSpinner.DefaultEditor) m_SingleMargin.getEditor()).getTextField().setColumns(5); params.add(createParameter("Margin %", m_SingleMargin)); // width m_SingleWidth = new JSpinner(); m_SingleWidth.setValue(400); ((SpinnerNumberModel) m_SingleWidth.getModel()).setMinimum(1); ((SpinnerNumberModel) m_SingleWidth.getModel()).setStepSize(100); ((JSpinner.DefaultEditor) m_SingleWidth.getEditor()).getTextField().setColumns(5); params.add(createParameter("Width", m_SingleWidth)); // height m_SingleHeight = new JSpinner(); m_SingleHeight.setValue(400); ((SpinnerNumberModel) m_SingleHeight.getModel()).setMinimum(1); ((SpinnerNumberModel) m_SingleHeight.getModel()).setStepSize(100); ((JSpinner.DefaultEditor) m_SingleHeight.getEditor()).getTextField().setColumns(5); params.add(createParameter("Height", m_SingleHeight)); // generator m_SingleGenerator = new JComboBox<>(Registry.toStringArray(Registry.getGenerators(), true)); m_SingleGenerator.addActionListener((ActionEvent e) -> { updateSingleOutput(); }); params.add(createParameter("Generator", m_SingleGenerator)); // center m_SingleCenter = new JComboBox<>(Registry.toStringArray(Registry.getCenters(), true)); params.add(createParameter("Center", m_SingleCenter)); // output m_SingleOutput = new FileChooserPanel(); m_SingleOutput.setUseSaveDialog(true); m_SingleOutput.setPreferredSize(new Dimension(170, (int) m_SingleOutput.getPreferredSize().getHeight())); params.add(createParameter("Output", m_SingleOutput)); // preview/generate panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); m_SinglePreview = new JButton("Preview"); m_SinglePreview.addActionListener((ActionEvent e) -> generateSinglePreview()); m_SingleGenerate = new JButton("Generate"); m_SingleGenerate.addActionListener((ActionEvent e) -> generateSingleOutput()); panel.add(m_SinglePreview); panel.add(m_SingleGenerate); params.add(panel); adjustLabels(); return result; }
From source file:executor.TesterMainGUIMode.java
/** * Add buttons to start/pause/continue/cancel actions *//*from w w w . j ava2 s .com*/ private void addControlPanel() { controlPanel = new JPanel(); FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT); controlPanel.setLayout(flowLayout); controlPanel.setPreferredSize(new Dimension(frameWidth, controlPanelHeight)); controlPanel.setMinimumSize(new Dimension(frameWidth, controlPanelHeight)); controlPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, controlPanelHeight)); startStrategyButton = new JButton("Start strategy"); startStrategyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startStrategyButton.setEnabled(false); Runnable r = new Runnable() { public void run() { try { start(); } catch (Exception e2) { LOGGER.error(e2.getMessage(), e2); e2.printStackTrace(); resetButtons(); } } }; Thread t = new Thread(r); t.start(); } }); pauseButton = new JButton("Pause"); pauseButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (executionControl != null) { executionControl.pauseExecution(); updateButtons(); } } }); continueButton = new JButton("Continue"); continueButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (executionControl != null) { executionControl.continueExecution(); updateButtons(); } } }); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (executionControl != null) { executionControl.cancelExecution(); updateButtons(); } } }); controlPanel.add(startStrategyButton); controlPanel.add(pauseButton); controlPanel.add(continueButton); controlPanel.add(cancelButton); getContentPane().add(controlPanel); pauseButton.setEnabled(false); continueButton.setEnabled(false); cancelButton.setEnabled(false); }
From source file:org.interreg.docexplore.authoring.AuthoringToolFrame.java
public AuthoringToolFrame(final DocExploreDataLink link, final Startup startup) throws Exception { super("Authoring Tool"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.startup = startup; this.displayHelp = startup.showHelp; startup.screen.setText("Initializing history"); this.historyManager = new HistoryManager(50, new File(DocExploreTool.getHomeDir(), ".at-cache")); this.historyDialog = new JDialog(this, XMLResourceBundle.getBundledString("generalHistory")); historyDialog.add(new HistoryPanel(historyManager)); historyDialog.pack();//from w w w . j a va2 s .co m setJMenuBar(this.menu = new AuthoringMenu(this)); startup.screen.setText("Initializing plugins"); plugins = new Vector<MetaDataPlugin>(); List<PluginConfig> pluginConfigs = startup.filterPlugins(MetaDataPlugin.class); for (PluginConfig config : pluginConfigs) { MetaDataPlugin plugin = null; if ((plugin = (MetaDataPlugin) config.clazz.newInstance()) != null) { plugins.add(plugin); plugin.setHost(config.jarFile, config.dependencies); System.out.println( "Loaded plugin '" + plugin.getName() + "' (" + plugin.getClass().getSimpleName() + ")"); } } startup.screen.setText("Initializing filters"); //filter = new FilterPanel(link); this.importOptions = new ImportOptions(this); startup.screen.setText("Initializing styles"); this.styleManager = new StyleManager(this); startup.screen.setText("Creating explorer data link"); this.linkExplorer = new DataLinkExplorer(this, link, null); //linkExplorer.toolPanel.add(filter); //linkExplorer.setFilter(filter); startup.screen.setText("Creating explorer"); //this.fileExplorer = new FileExplorer(this); this.explorer = new JPanel(new BorderLayout()); explorer.add( new JLabel("<html><font style=\"font-size:16\">" + XMLResourceBundle.getBundledString("generalLibraryLabel") + "</font></html>"), BorderLayout.NORTH); explorer.add(linkExplorer, BorderLayout.CENTER); //explorer.addTab(XMLResourceBundle.getBundledString("generalFilesLabel"), fileExplorer); startup.screen.setText("Creating editor data link"); recovery = defaultFile.exists(); DataLink fslink = new DataLinkFS2Source(defaultFile.getAbsolutePath()).getDataLink(); fslink.setProperty("autoWrite", false); final DocExploreDataLink editorLink = new DocExploreDataLink(); final JLabel titleLabel = new JLabel(); editorLink.addListener(new DocExploreDataLink.Listener() { public void dataLinkChanged(DataLink link) { String bookName = ""; try { List<Integer> books = editorLink.getLink().getAllBookIds(); if (!books.isEmpty()) { Book book = editorLink.getBook(books.get(0)); bookName = book.getName(); MetaDataKey key = editorLink.getOrCreateKey("styles", ""); List<MetaData> mds = book.getMetaDataListForKey(key); MetaData md = null; if (mds.isEmpty()) { md = new MetaData(editorLink, key, ""); book.addMetaData(md); } else md = mds.get(0); styleManager.setMD(md); } } catch (Exception e) { e.printStackTrace(); } String linkTitle = menu.curFile == null ? null : menu.curFile.getAbsolutePath(); titleLabel.setText("<html><font style=\"font-size:14\">" + XMLResourceBundle.getBundledString("generalPresentationLabel") + " : <b>" + bookName + "</b>" + (linkTitle != null ? " (" + linkTitle + ")" : "") + "</font></html>"); setTitle(XMLResourceBundle.getBundledString("frameTitle") + " " + (linkTitle != null ? linkTitle : "")); historyManager.reset(-1); repaint(); } }); editorLink.setLink(fslink); startup.screen.setText("Creating editor"); this.editor = new DataLinkExplorer(this, editorLink, new BookImporter()); for (ExplorerView view : editor.views) if (view instanceof PageEditorView) { this.mdEditor = new MetaDataEditor(((PageEditorView) view).editor); } editor.addListener(new Explorer.Listener() { @Override public void exploringChanged(Object object) { try { boolean isRegion = object instanceof Region; int div = splitPane.getDividerLocation(); mdEditor.setDocument(null); if (isRegion) mdEditor.setDocument((Region) object); if (isRegion != regionMode) splitPane.setRightComponent(isRegion ? mdEditor : explorer); regionMode = isRegion; validate(); splitPane.setDividerLocation(div); } catch (Exception e) { ErrorHandler.defaultHandler.submit(e); } } }); final JButton editBook = new JButton(new AbstractAction("", ImageUtils.getIcon("pencil-24x24.png")) { @Override public void actionPerformed(ActionEvent e) { try { Book book = editorLink.getBook(editorLink.getLink().getAllBookIds().get(0)); String name = JOptionPane.showInputDialog(AuthoringToolFrame.this, XMLResourceBundle.getBundledString("collectionAddBookMessage"), book.getName()); if (name == null) return; book.setName(name); editorLink.notifyDataLinkChanged(); editor.refreshPath(); } catch (Exception ex) { ErrorHandler.defaultHandler.submit(ex); } } }); editBook.setToolTipText(XMLResourceBundle.getBundledString("generalToolbarEdit")); this.splitPane = new JSplitPane(); JPanel editorPanel = new JPanel(new BorderLayout()); JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); titlePanel.add(titleLabel); titlePanel.add(editBook); //editorPanel.add(titlePanel, BorderLayout.NORTH); editorPanel.add(editor, BorderLayout.CENTER); splitPane.setLeftComponent(editorPanel); splitPane.setRightComponent(explorer); getContentPane().setLayout(new BorderLayout()); add(titlePanel, BorderLayout.NORTH); add(splitPane, BorderLayout.CENTER); this.clipboard = new MetaDataClipboard(this, new File(DocExploreTool.getHomeDir(), ".at-clipboard")); startup.screen.setText("Initializing exporter"); this.readerExporter = new ReaderExporter(this); this.webExporter = new WebExporter(this); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { quit(); } public void windowOpened(WindowEvent e) { splitPane.setDividerLocation(getWidth() / 2); } }); this.oldSize = getWidth(); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { splitPane.setDividerLocation(splitPane.getDividerLocation() * getWidth() / oldSize); oldSize = getWidth(); } }); }
From source file:org.eobjects.datacleaner.widgets.result.ValueDistributionResultSwingRendererGroupDelegate.java
private void drillToOverview(final ValueCountingAnalyzerResult result) { final TableModel model = new DefaultTableModel(new String[] { "Value", LabelUtils.COUNT_LABEL }, _valueCounts.size());//from w w w. ja v a 2 s .c o m int i = 0; for (final ValueFrequency valueFreq : _valueCounts) { final String key = valueFreq.getName(); final int count = valueFreq.getCount(); model.setValueAt(key, i, 0); if (valueFreq.isComposite() && valueFreq.getChildren() != null && !valueFreq.getChildren().isEmpty()) { DCPanel panel = new DCPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); JLabel label = new JLabel(count + ""); JButton button = WidgetFactory.createSmallButton("images/actions/drill-to-detail.png"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { drillToGroup(result, valueFreq, true); } }); panel.add(label); panel.add(Box.createHorizontalStrut(4)); panel.add(button); model.setValueAt(panel, i, 1); } else { setCountValue(result, model, i, valueFreq); } i++; } _table.setModel(model); _backButton.setVisible(false); }