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:us.paulevans.basicxslt.TransformParametersFrame.java
/** * Constructor//from w w w .java 2 s . c o m * @param aParent * @param aXSLRow * @throws IOException */ public TransformParametersFrame(Frame aParent, XSLRow aXSLRow) { JPanel southPanel; xslRow = aXSLRow; addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { dispose(); } }); parameterTextFieldGroups = new ArrayList<ParameterTextFieldGroup>(); parameters = xslRow.getTransformParameters(); 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(buildNorthPanel(), BorderLayout.NORTH); getContentPane().add(southPanel, BorderLayout.SOUTH); getContentPane().add(buildMainPanel(), BorderLayout.CENTER); setTitle(stringFactory.getString(LabelStringFactory.PARAMS_FRAME_TRANSFORM_PARAMETERS)); setSize(FRAME_WIDTH, FRAME_HEIGHT); GUIUtils.center(this, aParent); initializeGUI(); setVisible(true); }
From source file:org.apache.shiro.samples.spring.ui.WebStartView.java
public void afterPropertiesSet() throws Exception { ClassPathResource resource = new ClassPathResource("logo.png"); ImageIcon icon = new ImageIcon(resource.getURL()); JLabel logo = new JLabel(icon); valueField = new JTextField(20); updateValueLabel();/* w w w .j a v a 2 s . com*/ saveButton = new JButton("Save Value"); saveButton.addActionListener(this); refreshButton = new JButton("Refresh Value"); refreshButton.addActionListener(this); JPanel valuePanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); valuePanel.add(valueField); valuePanel.add(saveButton); valuePanel.add(refreshButton); secureMethod1Button = new JButton("Method #1"); secureMethod1Button.addActionListener(this); secureMethod2Button = new JButton("Method #2"); secureMethod2Button.addActionListener(this); secureMethod3Button = new JButton("Method #3"); secureMethod3Button.addActionListener(this); JPanel methodPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); methodPanel.add(secureMethod1Button); methodPanel.add(secureMethod2Button); methodPanel.add(secureMethod3Button); frame = new JFrame("Apache Shiro Sample Application"); frame.setSize(500, 200); Container panel = frame.getContentPane(); panel.setLayout(new BorderLayout()); panel.add(logo, BorderLayout.NORTH); panel.add(valuePanel, BorderLayout.CENTER); panel.add(methodPanel, BorderLayout.SOUTH); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); }
From source file:pl.otros.logview.gui.actions.ChekForNewVersionOnStartupAction.java
@Override protected void handleNewVersionIsAvailable(final String current, String running) { LOGGER.info(String.format("Running version is %s, current is %s", running, current)); DataConfiguration configuration = getOtrosApplication().getConfiguration(); String doNotNotifyThisVersion = configuration .getString(ConfKeys.VERSION_CHECK_SKIP_NOTIFICATION_FOR_VERSION, "2000-01-01"); if (current != null && doNotNotifyThisVersion.compareTo(current) > 0) { return;/* w ww.j a v a 2s . com*/ } JPanel message = new JPanel(new GridLayout(4, 1, 4, 4)); message.add(new JLabel(String.format("New version %s is available", current))); JButton button = new JButton("Open download page"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { Desktop.getDesktop() .browse(new URI("https://sourceforge.net/projects/otroslogviewer/files/?source=app")); } catch (Exception e1) { String msg = "Can't open browser with download page: " + e1.getMessage(); LOGGER.severe(msg); getOtrosApplication().getStatusObserver().updateStatus(msg, StatusObserver.LEVEL_ERROR); } } }); message.add(button); final JCheckBox chboxDoNotNotifyMeAboutVersion = new JCheckBox("Do not notify me about version " + current); message.add(chboxDoNotNotifyMeAboutVersion); final JCheckBox chboxDoNotCheckVersionOnStart = new JCheckBox("Do not check for new version on startup"); message.add(chboxDoNotCheckVersionOnStart); final JDialog dialog = new JDialog((Frame) null, "New version is available"); dialog.getContentPane().setLayout(new BorderLayout(5, 5)); dialog.getContentPane().add(message); JPanel jp = new JPanel(new FlowLayout(FlowLayout.CENTER)); jp.add(new JButton(new AbstractAction("Ok") { /** * */ private static final long serialVersionUID = 7930093775785431184L; @Override public void actionPerformed(ActionEvent e) { dialog.setVisible(false); dialog.dispose(); if (chboxDoNotNotifyMeAboutVersion.isSelected()) { LOGGER.fine("Disabling new version notificiation for " + current); getOtrosApplication().getConfiguration() .setProperty(ConfKeys.VERSION_CHECK_SKIP_NOTIFICATION_FOR_VERSION, current); } if (chboxDoNotCheckVersionOnStart.isSelected()) { LOGGER.fine("Disabling new version check on start"); getOtrosApplication().getConfiguration().setProperty(ConfKeys.VERSION_CHECK_ON_STARTUP, false); } } })); dialog.getContentPane().add(jp, BorderLayout.SOUTH); dialog.pack(); dialog.setResizable(false); GuiUtils.centerOnScreen(dialog); dialog.setVisible(true); }
From source file:com.antelink.sourcesquare.gui.view.ExitSourceSquareView.java
/** * Create the frame./*from w w w .j a v a2 s . c o m*/ */ public ExitSourceSquareView() { setIconImage(Toolkit.getDefaultToolkit().getImage(SourceSquareView.class.getResource("/antelink.png"))); setTitle("SourceSquare"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 500, 170); this.contentPane = new JPanel(); this.contentPane.setBackground(Color.WHITE); this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(this.contentPane); this.mainPanel = new JPanel(); this.mainPanel.setBackground(Color.WHITE); GroupLayout gl_contentPane = new GroupLayout(this.contentPane); gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)); gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)); this.mainPanel.setLayout(new BoxLayout(this.mainPanel, BoxLayout.Y_AXIS)); JPanel panel_1 = new JPanel(); panel_1.setBackground(Color.WHITE); this.mainPanel.add(panel_1); panel_1.setLayout(new BorderLayout(0, 0)); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20)); panel.setBackground(Color.WHITE); panel_1.add(panel, BorderLayout.SOUTH); Image openButtonImage = Toolkit.getDefaultToolkit() .getImage(SourceSquareView.class.getResource("/OpenButton.png")); this.openButtonLabel = new JLabel(new ImageIcon(openButtonImage)); this.openButtonLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); panel.add(this.openButtonLabel); JLabel exitLabel = new JLabel("<html><b>Closing this window will quit the application</b></html>"); exitLabel.setFont(new Font("Helvetica", Font.PLAIN, 13)); JLabel explainLabel = new JLabel("<html>(You won't be able to see or publish your results anymore)</html>"); explainLabel.setFont(new Font("Helvetica", Font.PLAIN, 13)); JPanel textPanel = new JPanel(); textPanel.setBackground(Color.WHITE); textPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0)); textPanel.add(exitLabel, BorderLayout.CENTER); textPanel.add(explainLabel, BorderLayout.CENTER); panel_1.add(textPanel, BorderLayout.CENTER); CopyrightPanel copyrightPanel = new CopyrightPanel(); copyrightPanel.setBackground(Color.WHITE); this.mainPanel.add(copyrightPanel); this.contentPane.setLayout(gl_contentPane); setLocationRelativeTo(null); }
From source file:org.kuali.test.ui.utils.UIUtils.java
/** * * @param labels//from www .java 2 s. c o m * @param components * @return */ public static JPanel buildEntryPanel(String[] labels, JComponent[] components) { JPanel retval = new JPanel(new FlowLayout(FlowLayout.CENTER)); JPanel entryPanel = new JPanel(new BorderLayout()); entryPanel.add(buildComponentGridPanel(components), BorderLayout.CENTER); entryPanel.add(buildLabelGridPanel(labels), BorderLayout.WEST); retval.add(entryPanel); return retval; }
From source file:com.emental.mindraider.ui.dialogs.AddLinkToConceptJDialog.java
/** * Constructor.//from ww w . j a v a2 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:de.fhbingen.wbs.wpOverview.tabs.AvailabilityGraphGUI.java
/** * Creates the panel for the GUI.//www .java 2 s . co m * @return The created panel. */ protected final JPanel createOptionPanel() { General generalStrings = LocalizedStrings.getGeneralStrings(); JPanel optionPanel = new JPanel(); buttons = new JToggleButton[4]; buttons[AvailabilityGraph.DAY] = new JToggleButton(generalStrings.day()); buttons[AvailabilityGraph.WEEK] = new JToggleButton(generalStrings.week()); buttons[AvailabilityGraph.MONTH] = new JToggleButton(generalStrings.month()); buttons[AvailabilityGraph.YEAR] = new JToggleButton(generalStrings.year()); for (int i = 0; i < buttons.length; i++) { optionPanel.add(buttons[i]); } optionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); btnPrev = new JButton("<"); optionPanel.add(btnPrev); btnNext = new JButton(">"); optionPanel.add(btnNext); btnManualAv = new JToggleButton( LocalizedStrings.getButton().show(LocalizedStrings.getWbs().manualAvailabilities())); optionPanel.add(btnManualAv); return optionPanel; }
From source file:com.okmich.twitanalysis.gui.ApplicationFrame.java
private void setChartPanel(JPanel jpanel) { this.negativeSeries = new TimeSeries("Negative", Millisecond.class); this.postiveSeries = new TimeSeries("Positive", Millisecond.class); this.neutralSeries = new TimeSeries("Neutral", Millisecond.class); final TimeSeriesCollection dataset = new TimeSeriesCollection(this.negativeSeries); dataset.addSeries(this.postiveSeries); dataset.addSeries(this.neutralSeries); final JFreeChart chart = createChart(dataset); chart.getXYPlot().getRenderer(0).setSeriesPaint(0, Color.RED); chart.getXYPlot().getRenderer(0).setSeriesStroke(0, new BasicStroke(2.0f)); chart.getXYPlot().getRenderer(0).setSeriesPaint(1, Color.GREEN); chart.getXYPlot().getRenderer(0).setSeriesStroke(1, new BasicStroke(2.0f)); chart.getXYPlot().getRenderer(0).setSeriesPaint(2, Color.GRAY); chart.getXYPlot().getRenderer(0).setSeriesStroke(2, new BasicStroke(2.0f)); chart.getPlot().setBackgroundPaint(Color.BLACK); final ChartPanel chartPanel = new ChartPanel(chart); final JPanel tweetCountPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); tweetCountLabel = new JLabel(); setTweetCountLabel();/* w ww . j a va2s.co m*/ tweetCountPanel.add(tweetCountLabel); jpanel.setLayout(new BorderLayout(10, 10)); jpanel.add(chartPanel, BorderLayout.CENTER); jpanel.add(tweetCountPanel, BorderLayout.SOUTH); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(jpanel); }
From source file:org.p_vcd.ui.LicenseDialog.java
public LicenseDialog(String libName, String libHomepage, String licenseName, String licenseFilename) { setSize(680, 480);//from www .j a va 2 s.c o m setTitle(libName); getContentPane().setLayout(new BorderLayout()); { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.NORTH); panel.setLayout(new MigLayout("", "[grow,trailing][grow]", "[20px][][]")); { JLabel lblSoft = new JLabel(libName); lblSoft.setFont(new Font("Tahoma", Font.BOLD, 16)); panel.add(lblSoft, "center,cell 0 0 2 1"); } { JLabel lblHomePage = new JLabel("Home page:"); lblHomePage.setFont(new Font("Tahoma", Font.BOLD, 14)); panel.add(lblHomePage, "cell 0 1"); } { JLabel lblHome = SwingUtil.createLink(libHomepage, libHomepage); lblHome.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(lblHome, "cell 1 1"); } { JLabel lblNewLabel = new JLabel("License:"); lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 14)); panel.add(lblNewLabel, "cell 0 2"); } { JLabel lblLicense = new JLabel(licenseName); lblLicense.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(lblLicense, "cell 1 2"); } } { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(new FlowLayout()); panel.setBorder(new EmptyBorder(5, 5, 5, 5)); JScrollPane scrollPane = new JScrollPane(); scrollPane.setPreferredSize(new Dimension(600, 300)); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); panel.add(scrollPane); { JTextArea txtLicense = new JTextArea(); txtLicense.setEditable(false); txtLicense.setFont(new Font("Monospaced", Font.PLAIN, 11)); txtLicense.setWrapStyleWord(true); txtLicense.setLineWrap(true); try { InputStream is = Thread.currentThread().getContextClassLoader() .getResourceAsStream("org/p_vcd/licenses/" + licenseFilename); String text = IOUtils.toString(is, "UTF-8"); IOUtils.closeQuietly(is); txtLicense.setText(text); txtLicense.setCaretPosition(0); } catch (Exception e) { e.printStackTrace(); } scrollPane.setViewportView(txtLicense); } } { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.SOUTH); panel.setLayout(new FlowLayout(FlowLayout.CENTER)); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { LicenseDialog.this.dispose(); } }); okButton.setActionCommand("OK"); panel.add(okButton); getRootPane().setDefaultButton(okButton); } }
From source file:com.emental.mindraider.ui.dialogs.AddTripletJDialog.java
/** * Constructor./*from ww w . j av a 2 s . co m*/ */ public AddTripletJDialog() { super("Add Triplet"); JPanel framePanel = new JPanel(); framePanel.setLayout(new GridLayout(4, 1)); JPanel p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.RIGHT)); p.add(new JLabel(" Predicate: ")); predicateNs = new JTextField(30); predicateNs.setText(MindRaiderConstants.MR_RDF_PREDICATE_NS); 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.RIGHT)); p.add(new JLabel(" Object: ")); objectNs = new JTextField(30); objectNs.setText(MindRaiderConstants.MR_RDF_PREDICATE_NS); objectNs.selectAll(); p.add(objectNs); p.add(new JLabel("#")); objectLocalName = new JTextField(15); objectLocalName.grabFocus(); objectLocalName.selectAll(); objectLocalName.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) { createTriplet(); } } public void keyReleased(KeyEvent keyEvent) { } public void keyTyped(KeyEvent keyEvent) { } }); p.add(objectLocalName); framePanel.add(p); p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.RIGHT)); literalCheckBox = new JCheckBox("literal", false); p.add(literalCheckBox); 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) { AddTripletJDialog.this.dispose(); } }); framePanel.add(p); getContentPane().add(framePanel, BorderLayout.CENTER); // show pack(); Gfx.centerAndShowWindow(this); addWindowListener(new WindowAdapter() { public void windowActivated(WindowEvent e) { getObjectLocalName().requestFocusInWindow(); } }); }