List of usage examples for javax.swing SwingConstants CENTER
int CENTER
To view the source code for javax.swing SwingConstants CENTER.
Click Source Link
From source file:com.funambol.email.admin.EmailSyncSourceConfigPanel.java
/** * Create the panel//from w w w. ja v a 2s .c o m */ public void init() { // set layout this.setLayout(null); // set properties of label, position and border // referred to the title of the panel titledBorder1 = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText("Edit Email Connector SyncSource"); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder1); // -------- sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(14, 70, 150, 19)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(170, 70, 350, 19)); nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(14, 100, 150, 19)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(170, 100, 350, 19)); infoTypesLabel.setText("Supported Types: "); infoTypesLabel.setFont(defaultFont); infoTypesLabel.setBounds(new Rectangle(14, 130, 150, 19)); infoTypesValue.setFont(defaultFont); infoTypesValue.setBounds(new Rectangle(170, 130, 350, 19)); infoTypesValue.setEnabled(false); infoVersionsLabel.setText("Supported Versions: "); infoVersionsLabel.setFont(defaultFont); infoVersionsLabel.setBounds(new Rectangle(14, 160, 150, 19)); infoVersionsValue.setFont(defaultFont); infoVersionsValue.setBounds(new Rectangle(170, 160, 350, 19)); infoVersionsValue.setEnabled(false); dtEncryptLabel.setText("Encryption: "); dtEncryptLabel.setFont(defaultFont); dtEncryptLabel.setBounds(new Rectangle(14, 190, 150, 18)); dtEncryptValue.setSelected(false); dtEncryptValue.setBounds(new Rectangle(166, 190, 25, 19)); contentProviderURLLabel.setText("Content Provider URL: "); contentProviderURLLabel.setFont(defaultFont); contentProviderURLLabel.setBounds(new Rectangle(14, 250, 150, 19)); contentProviderURLValue.setFont(defaultFont); contentProviderURLValue.setBounds(new Rectangle(170, 250, 350, 19)); signatureLabel.setText("Funambol Signature: "); signatureLabel.setFont(defaultFont); signatureLabel.setBounds(new Rectangle(14, 220, 150, 19)); signatureValue.setFont(defaultFont); signatureValue.setBounds(new Rectangle(170, 220, 350, 19)); confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(170, 280, 70, 25); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { EmailSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( EmailSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { EmailSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( EmailSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage())); } } }); // add all components to the panel this.add(panelName, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameLabel, null); this.add(nameValue, null); this.add(infoTypesLabel, null); this.add(infoTypesValue, null); this.add(infoVersionsLabel, null); this.add(infoVersionsValue, null); this.add(dtEncryptLabel, null); this.add(dtEncryptValue, null); // Uncomment the next two lines if you want to show the Content Provider URL // input field //this.add(contentProviderURLLabel, null); //this.add(contentProviderURLValue, null); this.add(signatureLabel, null); this.add(signatureValue, null); this.add(confirmButton, null); }
From source file:com.funambol.admin.settings.panels.EditDailyRollingFileAppender.java
/** * Create the panel/* www. j a v a 2 s . c om*/ * @throws Exception if error occures during creation of the panel. */ private void init() throws Exception { final int h = 18; final int x1 = 15; final int x2 = 150; final int w1 = 100; final int w2 = 310; int y = 40; int dy = 25; setLayout(null); setName(Bundle.getMessage(Bundle.EDIT_DAILY_ROLLING_FILE_APPENDER_PANEL_NAME)); panelNameLabel.setText(Bundle.getMessage(Bundle.EDIT_DAILY_ROLLING_FILE_APPENDER_PANEL_NAME)); panelNameLabel.setBounds(new Rectangle(14, 5, 290, 28)); panelNameLabel.setAlignmentX(SwingConstants.CENTER); panelNameLabel.setBorder(new TitledBorder("")); nameLabel.setText(Bundle.getMessage(Bundle.LABEL_APPENDER_NAME) + " :"); nameLabel.setBounds(new Rectangle(x1, y, w1, h)); nameLabel2.setBounds(new Rectangle(x2, y, w2, h)); y += dy; fileNameLabel.setText(Bundle.getMessage(Bundle.LABEL_FILE_NAME) + " :"); fileNameLabel.setBounds(new Rectangle(x1, y, w1, h)); fileNameValue.setBounds(new Rectangle(x2, y, w2, h)); y += dy; datePatternLabel.setText(Bundle.getMessage(Bundle.LABEL_DATE_PATTERN) + " :"); datePatternLabel.setBounds(new Rectangle(x1, y, w1, h)); datePatternValue.setBounds(new Rectangle(x2, y, w2, h)); datePatternValue.setHorizontalAlignment(JTextField.RIGHT); y += dy; conversionPatternLabel.setText(Bundle.getMessage(Bundle.LABEL_PATTERN_LAYOUT) + " :"); conversionPatternLabel.setBounds(new Rectangle(x1, y, w1, h)); conversionPattern.setBounds(new Rectangle(x2, y, w2, h)); y += dy; noteLabel.setText(Bundle.getMessage(Bundle.LABEL_FILE_APPENDER_NOTE)); noteLabel.setBounds(new Rectangle(x1, y, 500, h)); y += dy; y += dy; confirmButton.setText(Bundle.getMessage(Bundle.LABEL_BUTTON_SAVE)); confirmButton.setBounds(new Rectangle(401, y, 60, 25)); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); EditDailyRollingFileAppender.this.actionPerformed(new ActionEvent( EditDailyRollingFileAppender.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } catch (Exception e) { notifyError(new AdminException(e.getMessage())); } } }); add(panelNameLabel, null); add(nameLabel, null); add(nameLabel2, null); add(fileNameLabel, null); add(fileNameValue, null); add(datePatternLabel, null); add(datePatternValue, null); add(conversionPatternLabel, null); add(conversionPattern, null); add(noteLabel, null); add(confirmButton, null); GuiFactory.setDefaultFont(this); panelNameLabel.setFont(GuiFactory.titlePanelFont); }
From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java
/** * Constructor//w ww. java 2 s.co m * * @param compactLayout * if false, there will be message type selectors in the panel */ public ChatServicePanel(boolean compactLayout) { super(new BorderLayout()); // Prepare the title header titleHeader.setBackground(getBackground().darker()); titleHeader.setOpaque(true); titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titleHeader.setHorizontalAlignment(SwingConstants.CENTER); add(titleHeader, BorderLayout.NORTH); // Add messages panel scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); messagesPanel.setBackground(UIManager.getColor("List.background")); messagesPanel.setOpaque(false); messagesPanel.setLayout(new GridBagLayout()); messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(scrollPane, BorderLayout.CENTER); JPanel sendPanel = new JPanel(new GridBagLayout()); add(sendPanel, BorderLayout.SOUTH); Insets insets = new Insets(2, 2, 2, 2); // Add text area if (compactLayout) { messageText = new JTextField(); ((JTextField) messageText).addActionListener(this); sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } else { messageText = new JTextArea(); JScrollPane scrollPane2 = new JScrollPane(messageText); scrollPane2.setPreferredSize(new Dimension(100, 50)); scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); } // Add buttons ButtonGroup group = new ButtonGroup(); messageTypeBtn = createMessageTypeButton("Send messages", ICON_MESSAGE, true, group); warningTypeBtn = createMessageTypeButton("Send warnings", ICON_WARNING, false, group); alertTypeBtn = createMessageTypeButton("Send alerts", ICON_ALERT, false, group); if (!compactLayout) { JToolBar msgTypePanel = new JToolBar(); msgTypePanel.setBorderPainted(false); msgTypePanel.setOpaque(true); msgTypePanel.setFloatable(false); sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); msgTypePanel.add(messageTypeBtn); msgTypePanel.add(warningTypeBtn); msgTypePanel.add(alertTypeBtn); } if (compactLayout) { sendBtn = new JButton("Send"); sendPanel.add(sendBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } else { sendBtn = new JButton("Send", ICON_MESSAGE); sendBtn.setPreferredSize(new Dimension(100, sendBtn.getPreferredSize().height)); sendPanel.add(sendBtn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } sendBtn.setEnabled(false); messageText.setEditable(false); sendBtn.addActionListener(this); }
From source file:edu.ku.brc.specify.utilapps.ERDTable.java
/** * @param p/*from www .ja v a2 s. co m*/ * @param tbl * @param font * @param y * @param all */ public void build(final PanelBuilder p, final DBTableInfo tbl, final Font font, final int y, boolean all) { String typ = StringUtils.substringAfterLast(tbl.getIdType(), "."); if (StringUtils.isEmpty(typ)) { typ = tbl.getIdType(); } CellConstraints cc = new CellConstraints(); p.add(ERDVisualizer.mkLabel(font, tbl.getIdColumnName(), SwingConstants.LEFT), cc.xy(1, y)); p.add(ERDVisualizer.mkLabel(font, typ, SwingConstants.CENTER), cc.xy(3, y)); p.add(ERDVisualizer.mkLabel(font, "", SwingConstants.CENTER), cc.xy(5, y)); if (all) { p.add(ERDVisualizer.mkLabel(font, yesStr, SwingConstants.CENTER), cc.xy(7, y)); p.add(ERDVisualizer.mkLabel(font, yesStr, SwingConstants.CENTER), cc.xy(9, y)); } }
From source file:edu.ku.brc.af.tasks.subpane.StatsPane.java
/** * Creates a StatsPane.//from w w w.ja v a 2 s. co m * @param name name of pane * @param task the owning task * @param resourceName the name of the resource that contains the configuration * @param useSeparatorTitles indicates the group panels should use separator titles instead of boxes * @param bgColor the background color * @param upperDisplayComp a display component for the upper half of the screen */ public StatsPane(final String name, final Taskable task, final String resourceName, final boolean useSeparatorTitles, final Color bgColor, final JComponent upperDisplayComp) { super(name, task); this.resourceName = resourceName; this.useSeparatorTitles = useSeparatorTitles; this.upperDisplayComp = upperDisplayComp; if (bgColor != null) { this.bgColor = bgColor; } else { this.bgColor = Color.WHITE; } setBackground(this.bgColor); setOpaque(true); setLayout(new BorderLayout()); if (upperDisplayComp == null) { JLabel lbl = UIHelper.createI18NLabel("COLL_STATS", SwingConstants.CENTER); int pntSize = lbl.getFont().getSize(); lbl.setFont(lbl.getFont().deriveFont((float) pntSize + 2).deriveFont(Font.BOLD)); add(lbl, BorderLayout.NORTH); } init(); registerPrintContextMenu(); }
From source file:com.sshtools.common.ui.SshToolsApplicationSessionPanel.java
/** * * * @param profile// www.j a va 2 s . c om * * @return */ public boolean editSettings(SshToolsConnectionProfile profile) { final SshToolsConnectionPanel panel = new SshToolsConnectionPanel(false); SshToolsConnectionTab[] tabs = getAdditionalConnectionTabs(); for (int i = 0; (tabs != null) && (i < tabs.length); i++) { tabs[i].setConnectionProfile(profile); panel.addTab(tabs[i]); } panel.setConnectionProfile(profile); final Option ok = new Option("Ok", "Apply the settings and close this dialog", 'o'); final Option cancel = new Option("Cancel", "Close this dialog without applying the settings", 'c'); OptionCallback callback = new OptionCallback() { public boolean canClose(OptionsDialog dialog, Option option) { if (option == ok) { return panel.validateTabs(); } return true; } }; OptionsDialog od = OptionsDialog.createOptionDialog(SshToolsApplicationSessionPanel.this, new Option[] { ok, cancel }, panel, "Connection Settings", ok, callback, null); od.pack(); UIUtil.positionComponent(SwingConstants.CENTER, od); od.setVisible(true); if (od.getSelectedOption() == ok) { // Apply the changes to the profile panel.applyTabs(); // Ask the session manager to apply them to persistence manager.applyProfileChanges(profile); return true; } return false; }
From source file:llc.rockford.webcast.EC2Driver.java
public Component createComponents() { startButton = new JButton("START SERVER"); startButton.setEnabled(false);/* www . j ava 2 s.co m*/ startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(false); new StartInstanceWorker(ec2Handle.getEc2Handle(), applicationState, amazonProperties).execute(); } }); startStreamButton = new JButton("START BROADCAST"); startStreamButton.setEnabled(false); startStreamButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startStreamButton.setEnabled(false); stopStreamButton.setEnabled(true); try { broadcaster.start(); } catch (ExecuteException e1) { startStreamButton.setEnabled(true); e1.printStackTrace(); } catch (IOException e1) { startStreamButton.setEnabled(true); e1.printStackTrace(); } catch (InterruptedException e1) { e1.printStackTrace(); } } }); stopStreamButton = new JButton("STOP BROADCAST"); stopStreamButton.setEnabled(false); stopStreamButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { broadcaster.stop(); } }); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); statusLabel.setOpaque(true); statusLabel.setBackground(Color.YELLOW); broadcastStatusLabel.setHorizontalAlignment(SwingConstants.CENTER); broadcastStatusLabel.setOpaque(true); broadcastStatusLabel.setBackground(Color.RED); stopButton = new JButton("STOP SERVER"); stopButton.setEnabled(false); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(false); new TerminateInstanceWorker(ec2Handle.getEc2Handle(), applicationState, amazonProperties).execute(); } }); JPanel pane = new JPanel(new GridLayout(7, 1)); pane.add(startButton); pane.add(statusLabel); pane.add(stopButton); pane.add(new JSeparator(SwingConstants.HORIZONTAL)); pane.add(startStreamButton); pane.add(broadcastStatusLabel); pane.add(stopStreamButton); pane.setBorder(BorderFactory.createEmptyBorder(30, // top 30, // left 10, // bottom 30) // right ); return pane; }
From source file:edu.ku.brc.af.tasks.subpane.BarChartPane.java
public void resultsInError(final QueryResultsContainerIFace qrc) { //JOptionPane.showMessageDialog(this, getResourceString("ERROR_CREATNG_BARCHART"), getResourceString("Error"), JOptionPane.ERROR_MESSAGE); // XXX LOCALIZE JLabel lbl = createLabel(getResourceString("BarChartPane.ERROR_CREATNG_BARCHART"), SwingConstants.CENTER); //$NON-NLS-1$ addCompletedComp(lbl);/*ww w. j ava 2 s . c o m*/ }
From source file:filterviewplugin.FilterViewSettingsTab.java
public JPanel createSettingsPanel() { final EnhancedPanelBuilder panelBuilder = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ',' + FormFactory.PREF_COLSPEC.encode() + ',' + FormFactory.RELATED_GAP_COLSPEC.encode() + ',' + FormFactory.PREF_COLSPEC.encode() + ", fill:default:grow"); final CellConstraints cc = new CellConstraints(); final JLabel label = new JLabel(mLocalizer.msg("daysToShow", "Days to show")); panelBuilder.addRow();//from w w w. j a v a 2 s . c om panelBuilder.add(label, cc.xy(2, panelBuilder.getRow())); final SpinnerNumberModel model = new SpinnerNumberModel(3, 1, 7, 1); mSpinner = new JSpinner(model); mSpinner.setValue(mSettings.getDays()); panelBuilder.add(mSpinner, cc.xy(4, panelBuilder.getRow())); panelBuilder.addParagraph(mLocalizer.msg("filters", "Filters to show")); mFilterList = new SelectableItemList(mSettings.getActiveFilterNames(), FilterViewSettings.getAvailableFilterNames()); mIcons.clear(); for (String filterName : FilterViewSettings.getAvailableFilterNames()) { mIcons.put(filterName, mSettings.getFilterIconName(mSettings.getFilter(filterName))); } mFilterList.addCenterRendererComponent(String.class, new SelectableItemRendererCenterComponentIf() { private DefaultListCellRenderer mRenderer = new DefaultListCellRenderer(); public void calculateSize(JList list, int index, JPanel contentPane) { } public JPanel createCenterPanel(JList list, Object value, int index, boolean isSelected, boolean isEnabled, JScrollPane parentScrollPane, int leftColumnWidth) { DefaultListCellRenderer label = (DefaultListCellRenderer) mRenderer .getListCellRendererComponent(list, value, index, isSelected, false); String filterName = value.toString(); String iconFileName = mIcons.get(filterName); Icon icon = null; if (!StringUtils.isEmpty(iconFileName)) { try { icon = FilterViewPlugin.getInstance().getIcon( FilterViewSettings.getIconDirectoryName() + File.separatorChar + iconFileName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } label.setIcon(icon); } String text = filterName; if (icon == null) { text += " (" + mLocalizer.msg("noIcon", "no icon") + ')'; } label.setText(text); label.setHorizontalAlignment(SwingConstants.LEADING); label.setVerticalAlignment(SwingConstants.CENTER); label.setOpaque(false); JPanel panel = new JPanel(new BorderLayout()); if (isSelected && isEnabled) { panel.setOpaque(true); panel.setForeground(list.getSelectionForeground()); panel.setBackground(list.getSelectionBackground()); } else { panel.setOpaque(false); panel.setForeground(list.getForeground()); panel.setBackground(list.getBackground()); } panel.add(label, BorderLayout.WEST); return panel; } }); panelBuilder.addGrowingRow(); panelBuilder.add(mFilterList, cc.xyw(2, panelBuilder.getRow(), panelBuilder.getColumnCount() - 1)); panelBuilder.addRow(); mFilterButton = new JButton(mLocalizer.msg("changeIcon", "Change icon")); mFilterButton.setEnabled(false); panelBuilder.add(mFilterButton, cc.xyw(2, panelBuilder.getRow(), 1)); mRemoveButton = new JButton(mLocalizer.msg("deleteIcon", "Remove icon")); mRemoveButton.setEnabled(false); panelBuilder.add(mRemoveButton, cc.xyw(4, panelBuilder.getRow(), 1)); mFilterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SelectableItem item = (SelectableItem) mFilterList.getSelectedValue(); String filterName = (String) item.getItem(); chooseIcon(filterName); } }); mFilterList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { mFilterButton.setEnabled(mFilterList.getSelectedValue() != null); mRemoveButton.setEnabled(mFilterButton.isEnabled()); } }); mRemoveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SelectableItem item = (SelectableItem) mFilterList.getSelectedValue(); String filterName = (String) item.getItem(); mIcons.put(filterName, ""); mFilterList.updateUI(); } }); return panelBuilder.getPanel(); }
From source file:edu.ku.brc.specify.tasks.StatsTrackerTask.java
@Override protected void showClosingFrame() { if (hasChanged) { ImageIcon img = IconManager.getIcon("SpecifySplash"); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g,150px", "f:p:g,2px,p")); pb.setDefaultDialogBorder();/* w ww. j av a 2s .c o m*/ JLabel lbl = new JLabel(img); pb.add(lbl, cc.xyw(1, 1, 2)); lbl = UIHelper.createI18NLabel("SPECIFY_SHUTDOWN", SwingConstants.CENTER); lbl.setFont(lbl.getFont().deriveFont(18.0f)); pb.add(lbl, cc.xy(1, 3)); progress = new JProgressBar(0, 100); pb.add(progress, cc.xy(2, 3)); JFrame frame = new JFrame(); frame.setUndecorated(true); frame.setContentPane(pb.getPanel()); frame.pack(); UIHelper.centerAndShow(frame); } }