List of usage examples for java.awt FlowLayout CENTER
int CENTER
To view the source code for java.awt FlowLayout CENTER.
Click Source Link
From source file:org.pentaho.reporting.libraries.designtime.swing.background.WaitDialog.java
public void reinitComponents() { contentPane.removeAll();//w ww. ja va 2 s.c om final JPanel contentPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); contentPanel.add(message); contentPane.add(contentPanel, BorderLayout.CENTER); final JPanel progressPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); progressPanel.add(progressBar); contentPane.add(progressPanel, BorderLayout.NORTH); if (showCancelButton) { final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, PADDING, PADDING)); final JButton cancelButton = new JButton(new CancelActionListener()); buttonPanel.add(cancelButton); contentPane.add(buttonPanel, BorderLayout.SOUTH); } contentPane.invalidate(); pack(); // Since the parent dialog has not yet been centered, we will just center on the screen LibSwingUtil.centerDialogInParent(this); }
From source file:us.paulevans.basicxslt.TransformOutputPropertiesFrame.java
/** * Builds the GUI/*from ww w . j av a 2 s.c om*/ * @param aNorthPanel * @param aOutputProps */ private void buildGui(JPanel aNorthPanel, TransformOutputProperties aOutputProps) { JPanel southPanel, mainPanel; addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { dispose(); } }); mainPanel = new JPanel(new BorderLayout()); mainPanel.add(buildMainPanel(), BorderLayout.CENTER); southPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); southPanel.add(okayBtn = new JButton(stringFactory.getString(LabelStringFactory.OK_BUTTON))); southPanel.add(cancelBtn = new JButton(stringFactory.getString(LabelStringFactory.CANCEL_BUTTON))); okayBtn.addActionListener(this); cancelBtn.addActionListener(this); getContentPane().setLayout(new BorderLayout()); getContentPane().add(aNorthPanel, BorderLayout.NORTH); getContentPane().add(southPanel, BorderLayout.SOUTH); getContentPane().add(new JScrollPane(mainPanel), BorderLayout.CENTER); setTitle(stringFactory.getString(LabelStringFactory.OUTPUTPROPS_FRAME_TRANSFORM_OUTPUT_PROPERTIES)); setSize(FRAME_WIDTH, FRAME_HEIGHT); GUIUtils.center(this, parent); initializeGUI(aOutputProps); setVisible(true); }
From source file:GCWrapper.java
/** * Creates and lays out components in the container. See the comments below * for an organizational overview by panel. *//*from ww w .j av a 2s. c om*/ private void initComponents(Container c) { c.setLayout(new BorderLayout()); // Graphics Config JPanel gcPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(gcPanel, BorderLayout.NORTH); gcSelection.setPreferredSize(new Dimension(400, 30)); gcPanel.add(gcSelection); // Capabilities JPanel capsPanel = new JPanel(new BorderLayout()); c.add(capsPanel, BorderLayout.CENTER); // Image Capabilities JPanel imageCapsPanel = new JPanel(new GridLayout(2, 1)); capsPanel.add(imageCapsPanel, BorderLayout.NORTH); imageCapsPanel.setBorder(BorderFactory.createTitledBorder("Image Capabilities")); imageAccelerated.setEnabled(false); imageCapsPanel.add(imageAccelerated); imageTrueVolatile.setEnabled(false); imageCapsPanel.add(imageTrueVolatile); // Buffer Capabilities JPanel bufferCapsPanel = new JPanel(new BorderLayout()); capsPanel.add(bufferCapsPanel, BorderLayout.CENTER); bufferCapsPanel.setBorder(BorderFactory.createTitledBorder("Buffer Capabilities")); // Buffer Access JPanel bufferAccessCapsPanel = new JPanel(new GridLayout(3, 1)); bufferAccessCapsPanel.setPreferredSize(new Dimension(300, 88)); bufferCapsPanel.add(bufferAccessCapsPanel, BorderLayout.NORTH); // Flipping JPanel flippingPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(flippingPanel); flippingPanel.add(flipping); flipping.setEnabled(false); flippingPanel.add(flippingMethod); // Full-screen JPanel fsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(fsPanel); JPanel indentPanel = new JPanel(); indentPanel.setPreferredSize(new Dimension(30, 30)); fsPanel.add(indentPanel); fsPanel.add(fullScreen); fullScreen.setEnabled(false); // Multi-buffering JPanel mbPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); bufferAccessCapsPanel.add(mbPanel); indentPanel = new JPanel(); indentPanel.setPreferredSize(new Dimension(30, 30)); mbPanel.add(indentPanel); mbPanel.add(multiBuffer); multiBuffer.setEnabled(false); // Front and Back Buffer Capabilities JPanel buffersPanel = new JPanel(new GridLayout(1, 2)); bufferCapsPanel.add(buffersPanel, BorderLayout.CENTER); // Front Buffer JPanel fbPanel = new JPanel(new GridLayout(2, 1)); fbPanel.setBorder(BorderFactory.createTitledBorder("Front Buffer")); buffersPanel.add(fbPanel); fbPanel.add(fbAccelerated); fbAccelerated.setEnabled(false); fbPanel.add(fbTrueVolatile); fbTrueVolatile.setEnabled(false); // Back Buffer JPanel bbPanel = new JPanel(new GridLayout(2, 1)); bbPanel.setPreferredSize(new Dimension(250, 80)); bbPanel.setBorder(BorderFactory.createTitledBorder("Back and Intermediate Buffers")); buffersPanel.add(bbPanel); bbPanel.add(bbAccelerated); bbAccelerated.setEnabled(false); bbPanel.add(bbTrueVolatile); bbTrueVolatile.setEnabled(false); }
From source file:org.apache.ftpserver.gui.LoggerPanel.java
/** * Initialize UI components.//from ww w .ja va2 s.c o m */ private void initComponents() { setLayout(new BorderLayout()); // add top combo panel JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); add(topPanel, BorderLayout.NORTH); JLabel comboLab = new JLabel("Log Level :: "); comboLab.setForeground(Color.black); topPanel.add(comboLab); m_logCombo = new JComboBox(LEVELS); m_logCombo.setSelectedIndex(LEVEL_INFO); Dimension dim = new Dimension(90, 22); m_logCombo.setPreferredSize(dim); m_logCombo.setMaximumSize(dim); m_logCombo.setToolTipText("Set Log Level"); m_logCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { m_logLevel = m_logCombo.getSelectedIndex(); } }); topPanel.add(m_logCombo); // add text pane m_logTxt = new JTextPane(); m_logTxt.setFont(new Font("Monospaced", Font.PLAIN, 12)); m_logTxt.setEditable(false); m_doc = m_logTxt.getDocument(); JPanel noWrapPanel = new JPanel(new BorderLayout()); noWrapPanel.add(m_logTxt); add(new JScrollPane(noWrapPanel), BorderLayout.CENTER); // add clear button panel JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); add(bottomPanel, BorderLayout.SOUTH); JButton clearAction = new JButton("Clear"); clearAction.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { m_doc.remove(0, m_doc.getLength()); } catch (Exception ex) { ex.printStackTrace(); } } }); bottomPanel.add(clearAction); }
From source file:AtomPanel.java
private void commonInit() { //initial time series plots initJFreeChart();// www . jav a 2 s . c om startFlag = false; //create control panel // JPanel panel=new JPanel(new GridLayout(1,2)); //add control buttons to control panel /* startButton=new JButton("Start"); startButton.addActionListener(this); pauseButton=new JButton("Pause"); pauseButton.addActionListener(this); stopButton=new JButton("Stop"); stopButton.addActionListener(this); panel.add(startButton); panel.add(pauseButton); panel.add(stopButton); */ JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); //Create the slider JSlider faRateSlider = new JSlider(JSlider.HORIZONTAL, L_MIN, L_MAX, L_INIT); faRateSlider.setName("faRate"); faRateSlider.addChangeListener(this); faRateSlider.setMajorTickSpacing(30); faRateSlider.setPaintTicks(true); //Create the label table Hashtable labelTable = new Hashtable(); labelTable.put(new Integer(L_MIN), new JLabel("0.1%")); labelTable.put(new Integer((L_MIN + L_MAX) / 2), new JLabel(" False Alarm Rate")); labelTable.put(new Integer(L_MAX), new JLabel("1%")); faRateSlider.setLabelTable(labelTable); faRateSlider.setPaintLabels(true); panel.add(faRateSlider); // window size slider JSlider wdSzSlider = new JSlider(JSlider.HORIZONTAL, L_MIN, L_MAX, WDL_INIT); wdSzSlider.setName("wdSz"); wdSzSlider.addChangeListener(this); wdSzSlider.setMajorTickSpacing(30); wdSzSlider.setPaintTicks(true); //Create the label table Hashtable wdTable = new Hashtable(); wdTable.put(new Integer(L_MIN), new JLabel("20")); wdTable.put(new Integer((L_MIN + L_MAX) / 2), new JLabel(" Window Size")); wdTable.put(new Integer(L_MAX), new JLabel("200")); wdSzSlider.setLabelTable(wdTable); wdSzSlider.setPaintLabels(true); panel.add(wdSzSlider); if (AtomUtils.PCAType.pcaTrack == this.pcaType) { // new: tracking delta bar JSlider deltaSlider = new JSlider(JSlider.HORIZONTAL, L_MIN, L_MAX, L_INIT); deltaSlider.setName("delta"); deltaSlider.addChangeListener(this); deltaSlider.setMajorTickSpacing(30); deltaSlider.setPaintTicks(true); //Create the label table labelTable = new Hashtable(); labelTable.put(new Integer(L_MIN), new JLabel("0%")); labelTable.put(new Integer((L_MIN + L_MAX) / 2), new JLabel(" Tracking Threshold")); labelTable.put(new Integer(L_MAX), new JLabel("20%")); deltaSlider.setLabelTable(labelTable); deltaSlider.setPaintLabels(true); panel.add(deltaSlider); // tracking saving label trackSaveLabel = new JLabel(); trackSaveLabel.setText("Saved/Total:0/0"); panel.add(trackSaveLabel); } if (AtomUtils.PCAType.pcaTrackAdjust == this.pcaType) { JSlider devSlider = new JSlider(JSlider.HORIZONTAL, L_MIN, L_MAX, L_INIT); devSlider.setName("devbnd"); devSlider.addChangeListener(this); devSlider.setMajorTickSpacing(30); devSlider.setPaintTicks(true); //Create the label table labelTable = new Hashtable(); labelTable.put(new Integer(L_MIN), new JLabel("0%")); labelTable.put(new Integer((L_MIN + L_MAX) / 2), new JLabel(" Deviation Bound")); labelTable.put(new Integer(L_MAX), new JLabel("1%")); devSlider.setLabelTable(labelTable); devSlider.setPaintLabels(true); panel.add(devSlider); // tracking saving label trackSaveLabel = new JLabel(); trackSaveLabel.setText("Saved/Total:0/0"); panel.add(trackSaveLabel); } add(panel, BorderLayout.SOUTH); }
From source file:view.VideoSubscriberGUI.java
/** * Initialize the contents of the frame. */// w w w .ja va2 s . co m private void initialize() { frmBlackvidPubsubber = new JFrame(); frmBlackvidPubsubber.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { // unsubscribe from catalog - just in case videoSubscriber.cleanup(); // and then disconnect. client.disconnect(); } }); frmBlackvidPubsubber.setTitle("BlackVid Subscriber"); frmBlackvidPubsubber.setBounds(100, 100, 450, 300); frmBlackvidPubsubber.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmBlackvidPubsubber.getContentPane().setLayout(new BorderLayout(0, 0)); final JPanel panel = new JPanel(); frmBlackvidPubsubber.getContentPane().add(panel, BorderLayout.SOUTH); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JButton subscribeButton = new JButton("subscribe"); subscribeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // check something was selected. String selected = list.getSelectedItem(); if (selected != null) { // get the rid of the video clicked. String rid = ridMappings.get(selected); if (!videoSubscriber.subscribeVideo(rid)) JOptionPane.showMessageDialog(frmBlackvidPubsubber, "Something went wrong with the subscription."); } else { // error JOptionPane.showMessageDialog(frmBlackvidPubsubber, "You must select a video from the list."); } } }); panel.add(subscribeButton); JButton unsubscribeButton = new JButton("unsubscribe"); unsubscribeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // check something was selected. String selected = list.getSelectedItem(); if (selected != null) { // get the rid of the video clicked. String rid = ridMappings.get(selected); if (!videoSubscriber.unsubscribeVideo(rid)) JOptionPane.showMessageDialog(frmBlackvidPubsubber, "Something went wrong with the subscription.\nPerhaps you had not subscribed to that video?"); } else { // error JOptionPane.showMessageDialog(frmBlackvidPubsubber, "You must select a video from the list."); } } }); panel.add(unsubscribeButton); list = new List(); frmBlackvidPubsubber.getContentPane().add(list, BorderLayout.CENTER); JPanel panel_1 = new JPanel(); frmBlackvidPubsubber.getContentPane().add(panel_1, BorderLayout.NORTH); panel_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JButton refreshButton = new JButton("Refresh Catalogue"); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // unsubscribe and then subscribe again. // videoSubscriber.unsubscribeCatalog(); videoSubscriber.subscribeCatalog(); } }); panel_1.add(refreshButton); }
From source file:org.kuali.test.ui.components.dialogs.JmxDlg.java
private void initComponents() { String[] labels = { "Name", "JMX URL", "User Name", "Password" }; name = new JTextField(jmx.getName(), 20); name.setEditable(!isEditmode());/*from w w w .j a v a 2 s . c om*/ jmxUrl = new JTextField(jmx.getJmxUrl(), 30); username = new JTextField(jmx.getUsername(), 20); String pass = ""; if (StringUtils.isNotBlank(jmx.getPassword())) { try { pass = Utils.decrypt(getMainframe().getEncryptionPassword(), jmx.getPassword()); } catch (UnsupportedEncodingException ex) { UIUtils.showError(this, "Decrypt Exception", "Password decryption failed"); } } password = new JPasswordField(pass, 20); JComponent[] components = { name, jmxUrl, username, password }; getContentPane().add(UIUtils.buildEntryPanel(labels, components), BorderLayout.NORTH); JPanel p = new JPanel(new BorderLayout()); if (!isEditmode()) { JButton b = new JButton("Refresh JMX Attributes"); JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER, 1, 6)); p2.add(b); p.add(p2, BorderLayout.NORTH); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadJMXData(); } }); } tabbedPane = new JTabbedPane(); for (int i = 0; i < tabInfo.length; ++i) { tabbedPane.addTab(tabInfo[i].getTabName(), new TablePanel(getMBeanTable(tabInfo[i].getJmxBeanName()))); } p.add(tabbedPane, BorderLayout.CENTER); getContentPane().add(p, BorderLayout.CENTER); if (isEditmode()) { loadJMXData(); } addStandardButtons(); setDefaultBehavior(); }
From source file:org.zaproxy.zap.extension.httppanel.HttpPanel.java
private void initUi() { allOptions = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); componentOptions = new JPanel(new BorderLayout(0, 0)); moreOptionsComponent = new JPanel(new BorderLayout(0, 0)); toolBarComponents = new JToolBar(); toolBarComponents.setFloatable(false); toolBarComponents.setBorder(BorderFactory.createEmptyBorder()); toolBarComponents.setRollover(true); toolBarMoreOptions = new JToolBar(); toolBarMoreOptions.setFloatable(false); toolBarMoreOptions.setBorder(BorderFactory.createEmptyBorder()); toolBarMoreOptions.setRollover(true); endAllOptions = new JPanel(); JPanel panel1 = new JPanel(new BorderLayout(0, 0)); JPanel panelFlow = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); panelFlow.add(allOptions);/*from www.j a v a 2 s . c o m*/ panelFlow.add(componentOptions); panelFlow.add(toolBarComponents); panelFlow.add(moreOptionsComponent); panelFlow.add(toolBarMoreOptions); panel1.add(panelFlow, BorderLayout.WEST); panelFlow = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); panelFlow.add(endAllOptions); panel1.add(panelFlow, BorderLayout.EAST); panelHeader.add(panel1, BorderLayout.NORTH); //getPanelContent().add(new EmptyComponent(), ""); initComponents(); setMessage(null); }
From source file:view.VideoPublisherGUI.java
/** * Initialize the contents of the frame. *//* w w w . j a v a 2 s .co m*/ private void initialize() { frmBlackvidPubsubber = new JFrame(); frmBlackvidPubsubber.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { // unpublish everything videoPublisher.cleanup(); // then disconnect... client.disconnect(); } }); frmBlackvidPubsubber.setTitle("BlackVid Publisher"); frmBlackvidPubsubber.setBounds(100, 100, 450, 300); frmBlackvidPubsubber.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmBlackvidPubsubber.getContentPane().setLayout(new BorderLayout(0, 0)); final JPanel panel = new JPanel(); frmBlackvidPubsubber.getContentPane().add(panel, BorderLayout.SOUTH); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JButton publishButton = new JButton("publish video"); publishButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // Open file dialog JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("Video Files", "mov", "mpg", "mkv", "mp4", "avi", "mpeg"); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(frmBlackvidPubsubber); if (returnVal == JFileChooser.APPROVE_OPTION) { System.out .println("You chose to open this file: " + chooser.getSelectedFile().getAbsolutePath()); } try { // publish the event. Under root for now... String newPubIDString = rootGenerator.getNextID(chooser.getSelectedFile().getAbsolutePath(), IDStrategy.RANDOM); videoPublisher.publishVideo(newPubIDString, chooser.getSelectedFile().getAbsolutePath()); populatePublishList(); } catch (DecoderException e) { // Report the failed event. JOptionPane.showConfirmDialog(panel, "Could Not Publish the Video..."); e.printStackTrace(); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); panel.add(publishButton); JButton unpublishButton = new JButton("unpublish"); unpublishButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // unpublish a video. // check something has been selected String selected = getList().getSelectedItem(); if (selected != null) { // get the rid String rid = ridMappings.get(selected); //unpublish by rid ByteIdentifier vidID; try { videoPublisher.unpublishVideo(rid); } catch (DecoderException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } populatePublishList(); } } }); JButton btnPublishStream = new JButton("publish stream"); btnPublishStream.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String httpStr = JOptionPane.showInputDialog("Please enter URL of media stream."); System.out.println(httpStr); try { // publish the event. Under root for now... String newPubIDString = rootGenerator.getNextID(httpStr, IDStrategy.RANDOM); videoPublisher.publishVideo(newPubIDString, httpStr); populatePublishList(); } catch (DecoderException e2) { // Report the failed event. JOptionPane.showConfirmDialog(panel, "Could Not Publish the Media..."); e2.printStackTrace(); } catch (NoSuchAlgorithmException e3) { // TODO Auto-generated catch block e3.printStackTrace(); } catch (UnsupportedEncodingException e4) { // TODO Auto-generated catch block e4.printStackTrace(); } } }); panel.add(btnPublishStream); panel.add(unpublishButton); list = new List(); frmBlackvidPubsubber.getContentPane().add(list, BorderLayout.CENTER); JPanel panel_1 = new JPanel(); frmBlackvidPubsubber.getContentPane().add(panel_1, BorderLayout.NORTH); panel_1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); }
From source file:de.pavloff.spark4knime.jsnippet.ui.JarListPanel.java
/** Inits GUI. */ public JarListPanel() { super(new BorderLayout()); m_addJarList = new JList<String>(new DefaultListModel<String>()) { /** {@inheritDoc} */ @Override//from w ww. j a v a 2 s . c o m protected void processComponentKeyEvent(final KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_A && e.isControlDown()) { int end = getModel().getSize() - 1; getSelectionModel().setSelectionInterval(0, end); } else if (e.getKeyCode() == KeyEvent.VK_DELETE) { onJarRemove(); } } }; m_addJarList.setCellRenderer(new ConvenientComboBoxRenderer()); add(new JScrollPane(m_addJarList), BorderLayout.CENTER); JPanel southP = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 5)); m_addJarFilesButton = new JButton("Add File(s)..."); m_addJarFilesButton.addActionListener(new ActionListener() { /** {@inheritDoc} */ @Override public void actionPerformed(final ActionEvent e) { onJarFileAdd(); } }); m_addJarURLsButton = new JButton("Add KNIME URL..."); m_addJarURLsButton.setToolTipText("Add 'knime' URLs that resolve to local paths"); m_addJarURLsButton.addActionListener(new ActionListener() { /** {@inheritDoc} */ @Override public void actionPerformed(final ActionEvent e) { onJarURLAdd(); } }); m_removeButton = new JButton("Remove"); m_removeButton.addActionListener(new ActionListener() { /** {@inheritDoc} */ @Override public void actionPerformed(final ActionEvent e) { onJarRemove(); } }); m_addJarList.addListSelectionListener(new ListSelectionListener() { /** {@inheritDoc} */ @Override public void valueChanged(final ListSelectionEvent e) { m_removeButton.setEnabled(!m_addJarList.isSelectionEmpty()); } }); m_removeButton.setEnabled(!m_addJarList.isSelectionEmpty()); southP.add(m_addJarFilesButton); southP.add(m_addJarURLsButton); southP.add(m_removeButton); add(southP, BorderLayout.SOUTH); JPanel northP = new JPanel(new FlowLayout()); JLabel label = new JLabel("<html><body>Specify additional jar files " + "that are necessary for the snippet to run</body></html>"); northP.add(label); add(northP, BorderLayout.NORTH); }