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:davmail.ui.SettingsFrame.java
protected void addPortSettingComponent(JPanel panel, String label, JComponent component, JComponent checkboxComponent, JComponent checkboxSSLComponent, String toolTipText) { JLabel fieldLabel = new JLabel(label); fieldLabel.setHorizontalAlignment(SwingConstants.RIGHT); fieldLabel.setVerticalAlignment(SwingConstants.CENTER); panel.add(fieldLabel);// w w w . ja va2 s .c o m component.setMaximumSize(component.getPreferredSize()); JPanel innerPanel = new JPanel(); innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS)); innerPanel.add(checkboxComponent); innerPanel.add(component); innerPanel.add(checkboxSSLComponent); panel.add(innerPanel); if (toolTipText != null) { fieldLabel.setToolTipText(toolTipText); component.setToolTipText(toolTipText); } }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.AngleDirectController.java
/** * Show the instantaneous turning angles for each plate condition. * * @param plateCondition/*from ww w . j a v a 2s. c om*/ */ public void showInstAngleInTable(PlateCondition plateCondition) { SingleCellConditionDataHolder singleCellConditionDataHolder = singleCellPreProcessingController .getConditionDataHolder(plateCondition); if (singleCellConditionDataHolder != null) { dataTable.setModel(new InstantaneousDataTableModel(singleCellConditionDataHolder.getDataStructure(), singleCellConditionDataHolder.getTurningAnglesVector(), "inst turn angle")); AlignedTableRenderer alignedTableRenderer = new AlignedTableRenderer(SwingConstants.CENTER); FormatRenderer formatRenderer = new FormatRenderer(singleCellPreProcessingController.getFormat(), SwingConstants.CENTER); for (int i = 0; i < dataTable.getColumnModel().getColumnCount(); i++) { dataTable.getColumnModel().getColumn(i).setCellRenderer(alignedTableRenderer); } dataTable.getColumnModel().getColumn(3).setCellRenderer(formatRenderer); dataTable.getTableHeader().setDefaultRenderer(new TableHeaderRenderer(SwingConstants.CENTER)); } angleDirectPanel.getTableInfoLabel() .setText("Instantaneous Single Cell Turning Angles (for each time step)"); }
From source file:drusy.ui.panels.SwitchStatePanel.java
private void addUser(String hostName, String information, long txBytes, long rxBytes) { JPanel panel = new JPanel(); JLabel informationLabel = new JLabel(); ImageIcon imageIcon;//from w w w . j a v a 2 s. co m //======== panel1 ======== { panel.setLayout(new BorderLayout()); panel.setBorder(new EmptyBorder(0, 10, 0, 10)); //---- label2 ---- if (hostName.equals("smartphone")) { imageIcon = Res.getImage("img/iphone-56.png"); } else { imageIcon = Res.getImage("img/mac-56.png"); } informationLabel.setIcon(imageIcon); informationLabel.setText("<html><b>" + information + "</b><br />Download: " + txBytes / 1000.0 + " ko/s <br />Upload: " + rxBytes / 1000.0 + " ko/s</html>"); informationLabel.setHorizontalAlignment(SwingConstants.CENTER); panel.add(informationLabel, BorderLayout.CENTER); } mainPanel.add(panel); adaptPanelSize(); users.add(panel); }
From source file:com.funambol.admin.settings.panels.EditRollingFileAppender.java
/** * Create the panel/*from ww w . j av 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_ROLLING_FILE_APPENDER_PANEL_NAME)); panelNameLabel.setText(Bundle.getMessage(Bundle.EDIT_ROLLING_FILE_APPENDER_PANEL_NAME)); panelNameLabel.setBounds(new Rectangle(14, 5, 245, 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; fileSizeLabel.setText(Bundle.getMessage(Bundle.LABEL_MAX_FILE_SIZE) + " :"); fileSizeLabel.setBounds(new Rectangle(x1, y, w1, h)); fileSizeValue.setBounds(new Rectangle(x2, y, w2, h)); fileSizeValue.setHorizontalAlignment(JTextField.RIGHT); limitMBLabel.setBounds(new Rectangle(x2 + w2 + 10, y, 50, h)); y += dy; fileRotationCountLabel.setText(Bundle.getMessage(Bundle.LABEL_MAX_BACKUP_INDEX) + " :"); fileRotationCountLabel.setBounds(new Rectangle(x1, y, w1, h)); fileRotationCountValue.setBounds(new Rectangle(x2, y, w2, h)); fileRotationCountValue.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(); EditRollingFileAppender.this.actionPerformed(new ActionEvent(EditRollingFileAppender.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(fileRotationCountLabel, null); add(fileRotationCountValue, null); add(fileSizeLabel, null); add(fileSizeValue, null); add(limitMBLabel, null); add(conversionPatternLabel, null); add(conversionPattern, null); add(noteLabel, null); add(confirmButton, null); GuiFactory.setDefaultFont(this); panelNameLabel.setFont(GuiFactory.titlePanelFont); }
From source file:com.funambol.exchange.admin.DefaultExchangeConnectorConfigPanel.java
/** * Create the panel//from w w w .j a v a 2 s . c om */ private void init() { JLabel title, contactFolderLabel, eventFolderLabel, taskFolderLabel, noteFolderLabel, seccServerLabel, seccPortLabel, exchangeServerLabel; JPanel seccPanel, exchangePanel, sslPanel; title = new JLabel(); exchangePanel = new JPanel(); seccPanel = new JPanel(); sslPanel = new JPanel(); contactFolderValue = new JTextField(); eventFolderValue = new JTextField(); taskFolderValue = new JTextField(); noteFolderValue = new JTextField(); seccServerLabel = new JLabel(); seccServerValue = new JTextField(); seccPortLabel = new JLabel(); seccPortValue = new JTextField(); useSSLValue = new JCheckBox(); useFBAValue = new JCheckBox(); useKeyStoreValue = new JCheckBox(); keyStoreFileNameLabel = new JLabel(); keyStoreFileNameValue = new JTextField(); keyStorePasswordLabel = new JLabel(); keyStorePasswordValue = new JTextField(); exchangeServerLabel = new JLabel(); exchangeServerValue = new JTextField(); exchangeServerNameLabel = new JLabel(); exchangeServerNameValue = new JTextField(); setLayout(null); title.setFont(GuiFactory.titlePanelFont); title.setText("Funambol Exchange Connector"); title.setBounds(new Rectangle(14, 5, 316, 28)); title.setAlignmentX(SwingConstants.CENTER); title.setBorder(new TitledBorder("")); contactFolderLabel = new JLabel(); contactFolderLabel.setText("Contact Folder: "); contactFolderLabel.setBounds(14, 35, 116, 15); add(contactFolderLabel); contactFolderValue.setBounds(150, 35, 220, 19); add(contactFolderValue); eventFolderLabel = new JLabel(); eventFolderLabel.setText("Event Folder: "); eventFolderLabel.setBounds(14, 65, 116, 15); add(eventFolderLabel); eventFolderValue.setBounds(150, 65, 220, 19); add(eventFolderValue); taskFolderLabel = new JLabel(); taskFolderLabel.setText("Task Folder: "); taskFolderLabel.setBounds(14, 95, 116, 15); add(taskFolderLabel); taskFolderValue.setBounds(150, 95, 220, 19); add(taskFolderValue); noteFolderLabel = new JLabel(); noteFolderLabel.setText("Note Folder: "); noteFolderLabel.setBounds(14, 125, 116, 15); add(noteFolderLabel); noteFolderValue.setBounds(150, 125, 220, 19); add(noteFolderValue); seccPanel.setLayout(null); seccPanel.setBorder(new TitledBorder("HTTP Server Configuration")); seccServerLabel.setText("Server:"); seccPanel.add(seccServerLabel); seccServerLabel.setBounds(10, 20, 116, 15); seccPanel.add(seccServerValue); seccServerValue.setBounds(150, 20, 220, 19); seccServerValue.setFont(GuiFactory.defaultFont); seccPortLabel.setText("Port:"); seccPanel.add(seccPortLabel); seccPortLabel.setBounds(10, 50, 131, 15); seccPanel.add(seccPortValue); seccPortValue.setBounds(150, 50, 220, 19); seccPortValue.setFont(GuiFactory.defaultFont); add(seccPanel); seccPanel.setBounds(10, 155, 380, 80); exchangePanel.setLayout(null); exchangePanel.setBorder(new TitledBorder("WebDav Message Configuration")); exchangeServerLabel.setText("Server: "); exchangePanel.add(exchangeServerLabel); exchangeServerLabel.setBounds(10, 20, 150, 19); exchangePanel.add(exchangeServerValue); exchangeServerValue.setBounds(150, 20, 220, 19); exchangeServerValue.setFont(GuiFactory.defaultFont); exchangeServerNameLabel.setText("Name:"); exchangeServerNameLabel.setBounds(10, 50, 150, 19); exchangePanel.add(exchangeServerNameLabel); exchangeServerNameValue.setBounds(150, 50, 220, 19); exchangeServerNameValue.setFont(GuiFactory.defaultFont); exchangePanel.add(exchangeServerNameValue); add(exchangePanel); exchangePanel.setBounds(10, 255, 380, 80); //the ssl option panel sslPanel.setLayout(null); sslPanel.setBorder(new TitledBorder("SSL")); useSSLValue.setText("Use SSL"); useSSLValue.setSelected(false); useSSLValue.setBounds(5, 20, 150, 19); sslPanel.add(useSSLValue); useFBAValue.setText("Use Form-Based Authentication"); useFBAValue.setSelected(true); useFBAValue.setBounds(5, 40, 250, 19); sslPanel.add(useFBAValue); useKeyStoreValue.setText("Use Keystore"); useKeyStoreValue.setSelected(false); useKeyStoreValue.setBounds(5, 60, 200, 19); sslPanel.add(useKeyStoreValue); useKeyStoreValue.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent acEvent) { boolean enabled = useKeyStoreValue.isSelected(); keyStoreFileNameLabel.setEnabled(enabled); keyStoreFileNameValue.setEnabled(enabled); keyStorePasswordLabel.setEnabled(enabled); keyStorePasswordValue.setEnabled(enabled); } }); keyStoreFileNameLabel.setText("Key Store File: "); sslPanel.add(keyStoreFileNameLabel); keyStoreFileNameLabel.setEnabled(false); keyStoreFileNameLabel.setBounds(10, 80, 131, 15); sslPanel.add(keyStoreFileNameValue); keyStoreFileNameValue.setEnabled(false); keyStoreFileNameValue.setBounds(150, 80, 220, 19); keyStoreFileNameValue.setFont(GuiFactory.defaultFont); keyStorePasswordLabel.setText("Key Store Password: "); sslPanel.add(keyStorePasswordLabel); keyStorePasswordLabel.setEnabled(false); keyStorePasswordLabel.setBounds(10, 110, 131, 15); sslPanel.add(keyStorePasswordValue); keyStorePasswordValue.setEnabled(false); keyStorePasswordValue.setBounds(150, 110, 220, 19); keyStorePasswordValue.setFont(GuiFactory.defaultFont); add(sslPanel); sslPanel.setBounds(10, 355, 450, 140); confirmButton.setFont(GuiFactory.defaultFont); confirmButton.setText("Save"); add(confirmButton); confirmButton.setBounds(120, 500, 70, 25); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { getValues(); configPanel.saveDefaultConfig(event.getActionCommand()); configPanel.finishedDefaultConfig(); } }); cancelButton.setFont(GuiFactory.defaultFont); cancelButton.setText("Cancel"); add(cancelButton); cancelButton.setBounds(200, 500, 70, 25); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { configPanel.finishedDefaultConfig(); } }); // // Setting font... // Component[] components = getComponents(); for (int i = 0; (components != null) && (i < components.length); ++i) { components[i].setFont(GuiFactory.defaultFont); } // // We add it as the last one so that the font won't be changed // add(title); }
From source file:com.rapidminer.template.gui.RoleRequirementSelector.java
public RoleRequirementSelector(final TemplateController controller) { super(new BorderLayout()); setBorder(border);/* w ww . j ava2 s . com*/ this.controller = controller; setBackground(Color.WHITE); updateRequirement(); controller.getModel().addObserver(new Observer() { @Override public void update(Observable o, Object arg) { if (TemplateState.OBSERVER_EVENT_TEMPLATE.equals(arg)) { updateRequirement(); updateComponents(); } else if (TemplateState.OBSERVER_EVENT_ROLES.equals(arg)) { assignSelectionToCombo(); updateComponents(); attributeCombo.repaint(); } else if (TemplateState.OBSERVER_EVENT_INPUT.equals(arg)) { updateAttributes(); } } }); AutoCompleteDecorator.decorate(attributeCombo); AutoCompleteDecorator.decorate(positiveClassCombo); attributeCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (areValuesAdjusting) { return; } assignRoles(); } }); positiveClassCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (areValuesAdjusting) { return; } assignRoles(); } }); helpLabel.setHorizontalAlignment(SwingConstants.CENTER); add(helpLabel, BorderLayout.PAGE_START); chartPanel = new ChartPanel(null, 250, 250, 100, 100, 360, 360, true, false, false, false, false, false); chartPanel.setMinimumDrawWidth(0); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMinimumDrawHeight(0); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); attributeCombo.setPreferredSize(new Dimension(100, 30)); attributeCombo.setMaximumSize(new Dimension(150, 30)); add(chartPanel, BorderLayout.CENTER); JComponent comboPanel = new JPanel(); comboPanel.setLayout(new BoxLayout(comboPanel, BoxLayout.PAGE_AXIS)); JComponent comboPanelAtt = new JPanel(); comboPanelAtt.setBackground(Color.WHITE); comboPanelAtt.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JComponent comboPanelClass = new JPanel(); comboPanelClass.setBackground(Color.WHITE); comboPanelClass.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); positiveClassCombo.setPreferredSize(new Dimension(100, 30)); positiveClassCombo.setMaximumSize(new Dimension(150, 30)); positiveClassLabel.setLabelFor(positiveClassCombo); positiveClassLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); positiveClassLabel.setToolTipText(positiveClassLabel.getText()); positiveClassLabel.setHorizontalAlignment(SwingConstants.RIGHT); columnLabel.setLabelFor(attributeCombo); columnLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); columnLabel.setToolTipText(columnLabel.getText()); columnLabel.setHorizontalAlignment(SwingConstants.RIGHT); comboPanelAtt.add(columnLabel); comboPanelAtt.add(attributeCombo); comboPanelClass.add(positiveClassLabel); comboPanelClass.add(positiveClassCombo); comboPanel.add(comboPanelAtt); comboPanel.add(comboPanelClass); add(comboPanel, BorderLayout.SOUTH); updateComponents(); }
From source file:de.freese.base.swing.mac_os_x.MyApp.java
/** * *///from w w w . j a v a 2 s.c o m public MyApp() { super("OSXAdapter"); addMenus(); // Main content area; set up a JLabel to display images selected by the user getContentPane().setLayout(new BorderLayout()); getContentPane().add(this.imageLabel = new JLabel("Open an image to view it")); this.imageLabel.setHorizontalAlignment(SwingConstants.CENTER); this.imageLabel.setVerticalAlignment(SwingConstants.CENTER); this.imageLabel.setOpaque(true); // set up a simple about box this.aboutBox = new JDialog(this, "About OSXAdapter"); this.aboutBox.getContentPane().setLayout(new BorderLayout()); this.aboutBox.getContentPane().add(new JLabel("OSXAdapter", SwingConstants.CENTER)); this.aboutBox.getContentPane().add(new JLabel("\u00A92003-2007 Apple, Inc.", SwingConstants.CENTER), BorderLayout.SOUTH); this.aboutBox.setSize(160, 120); this.aboutBox.setResizable(false); // Preferences dialog lets you select the background color when displaying an image this.prefs = new JDialog(this, "OSXAdapter Preferences"); this.colorComboBox = new JComboBox<>(this.colorNames); this.colorComboBox.addActionListener(new ActionListener() { /** * @see * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed(final ActionEvent ev) { if (MyApp.this.currentImage != null) { MyApp.this.imageLabel .setBackground(MyApp.this.colors[MyApp.this.colorComboBox.getSelectedIndex()]); } } }); JPanel masterPanel = new JPanel(); masterPanel.setBorder(new TitledBorder("Window background color:")); masterPanel.add(this.colorComboBox); this.prefs.getContentPane().add(masterPanel); this.prefs.setSize(240, 100); this.prefs.setResizable(false); // Set up our application to respond to the Mac OS X application menu registerForMacOSXEvents(); setSize(320, 240); }
From source file:edu.ku.brc.specify.config.init.secwiz.DatabasePanel.java
/** * Creates a dialog for entering database name and selecting the appropriate driver. *///from www .j a va 2s . c o m public DatabasePanel(final JButton nextBtn, final JButton prevBtn, final String helpContext, final boolean doSetDefaultValues) { super("DATABASE", helpContext, nextBtn, prevBtn); this.doSetDefaultValues = doSetDefaultValues; String header = getResourceString("ENTER_DB_INFO") + ":"; CellConstraints cc = new CellConstraints(); String rowDef = "p,2px," + UIHelper.createDuplicateJGoodiesDef("p", "2px", isMobile() ? 5 : 4) + ",10px,p,10px,p,4px,p,4px,p,10px,f:p:g"; PanelBuilder builder = new PanelBuilder(new FormLayout("p,2px,p:g", rowDef), this); int row = 1; builder.add(createLabel(header, SwingConstants.CENTER), cc.xywh(1, row, 3, 1)); row += 2; usernameTxt = createField(builder, "IT_USERNAME", true, row); row += 2; passwordTxt = createField(builder, "IT_PASSWORD", true, row, true, null); row += 2; if (isMobile()) { dbNameTxt = createField(builder, "DB_NAME", true, row); row += 2; } else { dbNameTxt = createTextField(); } hostNameTxt = createField(builder, "HOST_NAME", true, row); row += 2; driverList = DatabaseDriverInfo.getDriversList(); drivers = createComboBox(driverList); // MySQL as the default drivers.setSelectedItem(DatabaseDriverInfo.getDriver("MySQL")); JLabel lbl = createI18NFormLabel("DRIVER", SwingConstants.RIGHT); lbl.setFont(bold); builder.add(lbl, cc.xy(1, row)); builder.add(drivers, cc.xy(3, row)); row += 2; label = UIHelper.createLabel("", SwingConstants.CENTER); PanelBuilder panelPB = new PanelBuilder(new FormLayout("f:p:g", "20px,p,8px,p")); panelPB.add(getProgressBar(), cc.xy(1, 2)); panelPB.add(label, cc.xy(1, 4)); builder.add(panelPB.getPanel(), cc.xy(3, row)); row += 2; //panelPB.getPanel().setBackground(Color.RED); //setBackground(Color.GREEN); // Advance part of pane advLabel = UIHelper.createI18NLabel("SEC_ADV_MU_DESC", SwingConstants.CENTER); skipStepBtn = UIHelper.createI18NButton("ADV_DB_TEST"); builder.add(advLabel, cc.xyw(3, row, 1)); row += 2; PanelBuilder tstPB = new PanelBuilder(new FormLayout("f:p:g,p,f:p:g", "p")); tstPB.add(skipStepBtn, cc.xy(2, 1)); builder.add(tstPB.getPanel(), cc.xyw(3, row, 1)); row += 2; JComponent helpComponent = createHelpPanel(getBackground(), "database"); builder.add(helpComponent, cc.xyw(3, row, 1)); row += 2; skipStepBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { skipStepBtn.setEnabled(false); boolean ok = skipDBCreate(); if (ok) { ok = checkForPermissions(); } isOK = ok; skipStepBtn.setEnabled(true); advLabel.setText(getResourceString(ok ? "ADV_DB_OK" : "ADV_DB_ERR")); advLabel.setForeground(ok ? Color.BLACK : Color.RED); nextBtn.setEnabled(isOK); } }); if (isMobile()) { skipStepBtn.setVisible(false); advLabel.setVisible(false); } progressBar.setVisible(false); updateBtnUI(); }
From source file:com.funambol.foundation.admin.SIFSyncSourceConfigPanel.java
/** * Create the panel/* w w w. j a v a2 s .c om*/ * * @throws Exception if error occures during creation of the panel */ private void init() { 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 SIF SyncSource"); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder1); int y = 60; int dy = 30; int x1 = 14; int x2 = 170; int w1 = 150; int w2 = 350; int h = 18; sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(x1, y, w1, h); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(x2, y, w2, h); y += dy; nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(x1, y, w1, h); nameValue.setFont(defaultFont); nameValue.setBounds(x2, y, w2, h); y += dy; typeLabel.setText("Type: "); typeLabel.setFont(defaultFont); typeLabel.setBounds(x1, y, w1, h); typeCombo.setFont(defaultFont); typeCombo.setBounds(x2, y, 100, h); typeCombo.addItem(TYPE_SIF_C); typeCombo.addItem(TYPE_SIF_E); typeCombo.addItem(TYPE_SIF_N); typeCombo.addItem(TYPE_SIF_T); typeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { handleTypeSelected(); } }); handleTypeSelected(); y += dy; directoryLabel.setText("Source Directory: "); directoryLabel.setFont(defaultFont); directoryLabel.setBounds(x1, y, w1, h); directoryValue.setFont(defaultFont); directoryValue.setBounds(x2, y, w2, h); y += dy; twinPropertiesLabel.setText("Twin properties: "); twinPropertiesLabel.setFont(defaultFont); twinPropertiesLabel.setBounds(x1, y, w1, h); descrTwinPropLabel.setText("(Used to identify twins)"); descrTwinPropLabel.setFont(defaultFont); descrTwinPropLabel.setBounds(x1, (y + 15), w1, h); twinPropertiesValue.setFont(defaultFont); twinPropertiesValue.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); twinPropertiesValue.setAutoscrolls(true); scrollTable = new JScrollPane(twinPropertiesValue); scrollTable.setWheelScrollingEnabled(true); scrollTable.setBounds(x2, y, 200, 66); scrollTable.setColumnHeader(null); scrollTable.setMinimumSize(new Dimension(200, 66)); scrollTable.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); y += 45; y += dy; multiUserLabel.setText("MultiUser: "); multiUserLabel.setFont(defaultFont); multiUserLabel.setBounds(x1, y, w1, h); multiUserValue.setSelected(false); multiUserValue.setBounds(x2, y, h, h); y += 5; y += dy; confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(x2, y, 70, 25); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { SIFSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(SIFSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { SIFSyncSourceConfigPanel.this.actionPerformed(new ActionEvent(SIFSyncSourceConfigPanel.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(typeLabel, null); this.add(typeCombo, null); this.add(directoryLabel, null); this.add(directoryValue, null); this.add(twinPropertiesLabel, null); this.add(scrollTable, null); this.add(descrTwinPropLabel, null); this.add(multiUserLabel, null); this.add(multiUserValue, null); this.add(confirmButton, null); }
From source file:com.funambol.json.admin.CalendarSyncSourceAdminPanel.java
/** * Create the panel// w w w . ja v a 2 s . c om * @throws Exception if error occures during creation of the panel */ private void init() { this.setLayout(null); // set properties of label, position and border // referred to the title of the panel titledBorder = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText(getPanelName()); panelName.setBounds(new Rectangle(14, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder); final int LABEL_X = 14; final int VALUE_X = 170; int y = 60; final int GAP_X = 150; final int GAP_Y = 30; sourceUriLabel.setText("Source URI: "); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); sourceUriValue.setFont(defaultFont); sourceUriValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line nameLabel.setText("Name: "); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); nameValue.setFont(defaultFont); nameValue.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line typeLabel.setText("Client Type: "); typeLabel.setFont(defaultFont); typeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); typeCombo.setFont(defaultFont); typeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18)); typeCombo.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { updateEntityTypeCheckBoxes(); } }); y += GAP_Y; // New line datastoretypeLabel.setText("Datastore Type: "); datastoretypeLabel.setFont(defaultFont); datastoretypeLabel.setBounds(new Rectangle(LABEL_X, y, 150, 18)); datastoretypeCombo.setFont(defaultFont); datastoretypeCombo.setBounds(new Rectangle(VALUE_X, y, 350, 18)); y += GAP_Y; // New line int x = LABEL_X; y = addExtraComponents(x, y, GAP_X, GAP_Y); // Add other components, if needed y += GAP_Y; // New line confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(VALUE_X, y, 70, 25); // What happens when the confirmButton is pressed? confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { CalendarSyncSourceAdminPanel.this.actionPerformed(new ActionEvent( CalendarSyncSourceAdminPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { CalendarSyncSourceAdminPanel.this.actionPerformed(new ActionEvent( CalendarSyncSourceAdminPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { notifyError(new AdminException(e.getMessage(), e)); } } }); // Adds all components to the panel this.add(panelName, null); this.add(nameLabel, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); this.add(nameValue, null); this.add(typeLabel, null); this.add(typeCombo, null); this.add(confirmButton, null); this.add(eventValue, null); this.add(taskValue, null); this.add(datastoretypeLabel, null); this.add(datastoretypeCombo, null); }