List of usage examples for java.awt Container setLayout
public void setLayout(LayoutManager mgr)
From source file:com.oracle.tutorial.jdbc.CoffeesFrame.java
public CoffeesFrame(JDBCTutorialUtilities settingsArg) throws SQLException { super("The Coffee Break: COFFEES Table"); // Set window title this.settings = settingsArg; connection = settings.getConnection(); // Close connections exit the application when the user // closes the window addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { try { connection.close();//from ww w . j a v a 2 s .c om } catch (SQLException sqle) { JDBCTutorialUtilities.printSQLException(sqle); } System.exit(0); } }); // Initialize and lay out window controls CachedRowSet myCachedRowSet = getContentsOfCoffeesTable(); myCoffeesTableModel = new CoffeesTableModel(myCachedRowSet); myCoffeesTableModel.addEventHandlersToRowSet(this); table = new JTable(); // Displays the table table.setModel(myCoffeesTableModel); label_COF_NAME = new JLabel(); label_SUP_ID = new JLabel(); label_PRICE = new JLabel(); label_SALES = new JLabel(); label_TOTAL = new JLabel(); textField_COF_NAME = new JTextField(10); textField_SUP_ID = new JTextField(10); textField_PRICE = new JTextField(10); textField_SALES = new JTextField(10); textField_TOTAL = new JTextField(10); button_ADD_ROW = new JButton(); button_UPDATE_DATABASE = new JButton(); button_DISCARD_CHANGES = new JButton(); label_COF_NAME.setText("Coffee Name:"); label_SUP_ID.setText("Supplier ID:"); label_PRICE.setText("Price:"); label_SALES.setText("Sales:"); label_TOTAL.setText("Total Sales:"); textField_COF_NAME.setText("Enter new coffee name"); textField_SUP_ID.setText("101"); textField_PRICE.setText("0"); textField_SALES.setText("0"); textField_TOTAL.setText("0"); button_ADD_ROW.setText("Add row to table"); button_UPDATE_DATABASE.setText("Update database"); button_DISCARD_CHANGES.setText("Discard changes"); // Place the components within the container contentPane; use GridBagLayout // as the layout. Container contentPane = getContentPane(); contentPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); contentPane.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.CENTER; c.weightx = 0.5; c.weighty = 1.0; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; contentPane.add(new JScrollPane(table), c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.weightx = 0.25; c.weighty = 0; c.gridx = 0; c.gridy = 1; c.gridwidth = 1; contentPane.add(label_COF_NAME, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.75; c.weighty = 0; c.gridx = 1; c.gridy = 1; c.gridwidth = 1; contentPane.add(textField_COF_NAME, c); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.25; c.weighty = 0; c.anchor = GridBagConstraints.LINE_START; c.gridx = 0; c.gridy = 2; c.gridwidth = 1; contentPane.add(label_SUP_ID, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.75; c.weighty = 0; c.gridx = 1; c.gridy = 2; c.gridwidth = 1; contentPane.add(textField_SUP_ID, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.weightx = 0.25; c.weighty = 0; c.gridx = 0; c.gridy = 3; c.gridwidth = 1; contentPane.add(label_PRICE, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.75; c.weighty = 0; c.gridx = 1; c.gridy = 3; c.gridwidth = 1; contentPane.add(textField_PRICE, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.weightx = 0.25; c.weighty = 0; c.gridx = 0; c.gridy = 4; c.gridwidth = 1; contentPane.add(label_SALES, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.75; c.weighty = 0; c.gridx = 1; c.gridy = 4; c.gridwidth = 1; contentPane.add(textField_SALES, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.weightx = 0.25; c.weighty = 0; c.gridx = 0; c.gridy = 5; c.gridwidth = 1; contentPane.add(label_TOTAL, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.75; c.weighty = 0; c.gridx = 1; c.gridy = 5; c.gridwidth = 1; contentPane.add(textField_TOTAL, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.weightx = 0.5; c.weighty = 0; c.gridx = 0; c.gridy = 6; c.gridwidth = 1; contentPane.add(button_ADD_ROW, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_END; c.weightx = 0.5; c.weighty = 0; c.gridx = 1; c.gridy = 6; c.gridwidth = 1; contentPane.add(button_UPDATE_DATABASE, c); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.LINE_START; c.weightx = 0.5; c.weighty = 0; c.gridx = 0; c.gridy = 7; c.gridwidth = 1; contentPane.add(button_DISCARD_CHANGES, c); // Add listeners for the buttons in the application button_ADD_ROW.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(CoffeesFrame.this, new String[] { "Adding the following row:", "Coffee name: [" + textField_COF_NAME.getText() + "]", "Supplier ID: [" + textField_SUP_ID.getText() + "]", "Price: [" + textField_PRICE.getText() + "]", "Sales: [" + textField_SALES.getText() + "]", "Total: [" + textField_TOTAL.getText() + "]" }); try { myCoffeesTableModel.insertRow(textField_COF_NAME.getText(), Integer.parseInt(textField_SUP_ID.getText().trim()), Float.parseFloat(textField_PRICE.getText().trim()), Integer.parseInt(textField_SALES.getText().trim()), Integer.parseInt(textField_TOTAL.getText().trim())); } catch (SQLException sqle) { displaySQLExceptionDialog(sqle); } } }); button_UPDATE_DATABASE.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { myCoffeesTableModel.coffeesRowSet.acceptChanges(); } catch (SQLException sqle) { displaySQLExceptionDialog(sqle); // Now revert back changes try { createNewTableModel(); } catch (SQLException sqle2) { displaySQLExceptionDialog(sqle2); } } } }); button_DISCARD_CHANGES.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { createNewTableModel(); } catch (SQLException sqle) { displaySQLExceptionDialog(sqle); } } }); }
From source file:com.tiempometa.muestradatos.JReadTags.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos"); dialogPane = new JPanel(); contentPanel = new JPanel(); label2 = new JLabel(); nextBibTextField = new JTextField(); statusLabel = new JLabel(); startReadingButton = new JButton(); bibLabel = new JLabel(); scrollPane1 = new JScrollPane(); tagReadTable = new JTable(); label3 = new JLabel(); tidTextField = new JTextField(); deleteSelectedButton = new JButton(); label4 = new JLabel(); epcTextField = new JTextField(); deleteReadButton = new JButton(); label1 = new JLabel(); dataToStoreComboBox = new JComboBox<>(); deleteAllButton = new JButton(); allowDuplicateBibsCheckBox = new JCheckBox(); buttonBar = new JPanel(); closeButton = new JButton(); CellConstraints cc = new CellConstraints(); //======== this ======== setTitle(bundle.getString("JReadTags.this.title")); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setResizable(false);/*from www .j av a2 s . c o m*/ setIconImage( new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png")) .getImage()); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== { dialogPane.setBorder(Borders.DIALOG_BORDER); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(15)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(52)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(138)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(155)) }, new RowSpec[] { new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(25)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- label2 ---- label2.setText(bundle.getString("JReadTags.label2.text")); label2.setFont(new Font("Tahoma", Font.PLAIN, 36)); contentPanel.add(label2, cc.xywh(3, 5, 3, 1)); //---- nextBibTextField ---- nextBibTextField.setFont(new Font("Tahoma", Font.PLAIN, 36)); nextBibTextField.setHorizontalAlignment(SwingConstants.RIGHT); nextBibTextField.setText(bundle.getString("JReadTags.nextBibTextField.text")); contentPanel.add(nextBibTextField, cc.xy(7, 5)); //---- statusLabel ---- statusLabel.setText(bundle.getString("JReadTags.statusLabel.text")); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); statusLabel.setBackground(Color.yellow); statusLabel.setOpaque(true); statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20)); contentPanel.add(statusLabel, cc.xywh(9, 3, 1, 5)); //---- startReadingButton ---- startReadingButton.setText(bundle.getString("JReadTags.startReadingButton.text")); startReadingButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); startReadingButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { startReadingButtonActionPerformed(e); } }); contentPanel.add(startReadingButton, cc.xywh(3, 7, 3, 1)); //---- bibLabel ---- bibLabel.setForeground(Color.red); bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36)); bibLabel.setHorizontalAlignment(SwingConstants.CENTER); contentPanel.add(bibLabel, cc.xy(9, 9)); //======== scrollPane1 ======== { scrollPane1.setViewportView(tagReadTable); } contentPanel.add(scrollPane1, cc.xywh(3, 11, 7, 1)); //---- label3 ---- label3.setText(bundle.getString("JReadTags.label3.text")); label3.setHorizontalAlignment(SwingConstants.RIGHT); label3.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label3, cc.xy(3, 13)); //---- tidTextField ---- tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(tidTextField, cc.xy(5, 13)); //---- deleteSelectedButton ---- deleteSelectedButton.setText(bundle.getString("JReadTags.deleteSelectedButton.text")); deleteSelectedButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); deleteSelectedButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteSelectedButtonActionPerformed(e); } }); contentPanel.add(deleteSelectedButton, cc.xy(9, 13)); //---- label4 ---- label4.setText(bundle.getString("JReadTags.label4.text")); label4.setHorizontalAlignment(SwingConstants.RIGHT); label4.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label4, cc.xy(3, 15)); //---- epcTextField ---- epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(epcTextField, cc.xy(5, 15)); //---- deleteReadButton ---- deleteReadButton.setText(bundle.getString("JReadTags.deleteReadButton.text")); deleteReadButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); deleteReadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteReadButtonActionPerformed(e); } }); contentPanel.add(deleteReadButton, cc.xy(9, 15)); //---- label1 ---- label1.setText(bundle.getString("JReadTags.label1.text")); label1.setHorizontalAlignment(SwingConstants.RIGHT); label1.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label1, cc.xy(3, 17)); //---- dataToStoreComboBox ---- dataToStoreComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "EPC", "TID" })); dataToStoreComboBox.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(dataToStoreComboBox, cc.xy(5, 17)); //---- deleteAllButton ---- deleteAllButton.setText(bundle.getString("JReadTags.deleteAllButton.text")); deleteAllButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); deleteAllButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { deleteAllButtonActionPerformed(e); } }); contentPanel.add(deleteAllButton, cc.xy(9, 17)); //---- allowDuplicateBibsCheckBox ---- allowDuplicateBibsCheckBox.setText(bundle.getString("JReadTags.allowDuplicateBibsCheckBox.text")); contentPanel.add(allowDuplicateBibsCheckBox, cc.xy(5, 19)); } dialogPane.add(contentPanel, BorderLayout.CENTER); //======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); buttonBar.setLayout( new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref"))); //---- closeButton ---- closeButton.setText("Cerrar"); closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeButtonActionPerformed(e); } }); buttonBar.add(closeButton, cc.xy(2, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(710, 675); setLocationRelativeTo(getOwner()); // //GEN-END:initComponents }
From source file:misc.DesktopDemo.java
/** Create and show components */// w ww . java 2s .c o m private void initComponents() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("DesktopDemo"); txtBrowserURI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onLaunchBrowser(null); } }); btnLaunchBrowser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onLaunchBrowser(evt); } }); txtMailTo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onLaunchMail(null); } }); btnLaunchEmail.setText("Launch Mail"); btnLaunchEmail.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onLaunchMail(evt); } }); txtFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onLaunchDefaultApplication(null); } }); rbOpen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onOpenAction(evt); } }); rbEdit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onEditAction(evt); } }); rbPrint.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onPrintAction(evt); } }); btnLaunchApplication.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onLaunchDefaultApplication(evt); } }); btnFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onChooseFile(evt); } }); Container conFrame = this.getContentPane(); bgAppAction.add(rbOpen); bgAppAction.add(rbEdit); bgAppAction.add(rbPrint); // Components layouting GroupLayout layout = new GroupLayout(conFrame); conFrame.setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setAutoCreateGaps(true); GroupLayout.SequentialGroup majorHGroup = layout.createSequentialGroup(); // Horizontal group GroupLayout.ParallelGroup lblHGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); lblHGroup.addComponent(lblBrowserUri, GroupLayout.Alignment.TRAILING); lblHGroup.addComponent(lblMailRecipient, GroupLayout.Alignment.TRAILING); lblHGroup.addComponent(lblFile, GroupLayout.Alignment.TRAILING); GroupLayout.ParallelGroup txtFieldsHGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); txtFieldsHGroup.addComponent(txtMailTo); txtFieldsHGroup.addComponent(txtBrowserURI); GroupLayout.SequentialGroup rbHGroup = layout.createSequentialGroup(); rbHGroup.addComponent(rbOpen); rbHGroup.addComponent(rbEdit); rbHGroup.addComponent(rbPrint); txtFieldsHGroup.addGroup(rbHGroup); GroupLayout.SequentialGroup fileHGroup = layout.createSequentialGroup(); fileHGroup.addComponent(txtFile); fileHGroup.addComponent(btnFile); txtFieldsHGroup.addGroup(fileHGroup); GroupLayout.ParallelGroup btnHGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); btnHGroup.addComponent(btnLaunchBrowser); btnHGroup.addComponent(btnLaunchEmail); btnHGroup.addComponent(btnLaunchApplication); majorHGroup.addGroup(lblHGroup); majorHGroup.addGroup(txtFieldsHGroup); majorHGroup.addGroup(btnHGroup); layout.setHorizontalGroup(majorHGroup); // Vertical group GroupLayout.SequentialGroup majorVGroup = layout.createSequentialGroup(); GroupLayout.ParallelGroup uriVGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); uriVGroup.addComponent(lblBrowserUri); uriVGroup.addComponent(txtBrowserURI); uriVGroup.addComponent(btnLaunchBrowser); GroupLayout.ParallelGroup mailVGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); mailVGroup.addComponent(lblMailRecipient); mailVGroup.addComponent(txtMailTo); mailVGroup.addComponent(btnLaunchEmail); GroupLayout.ParallelGroup rbVGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); rbVGroup.addComponent(rbOpen); rbVGroup.addComponent(rbEdit); rbVGroup.addComponent(rbPrint); GroupLayout.ParallelGroup fileVGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); fileVGroup.addComponent(lblFile); fileVGroup.addComponent(btnLaunchApplication); fileVGroup.addComponent(txtFile); fileVGroup.addComponent(btnFile); majorVGroup.addGroup(uriVGroup); majorVGroup.addGroup(mailVGroup); majorVGroup.addGroup(rbVGroup); majorVGroup.addGroup(fileVGroup); layout.setVerticalGroup(majorVGroup); pack(); }
From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterUI.java
/** Builds and lays out the UI. */ private void buildGUI() { Container container = getContentPane(); container.setLayout(new BorderLayout(0, 0)); IconManager icons = IconManager.getInstance(); TitlePanel tp = new TitlePanel(TEXT_TITLE, "", TEXT_TITLE_DESCRIPTION, icons.getIcon(IconManager.IMPORT_48)); JXPanel p = new JXPanel(); JXPanel lp = new JXPanel(); lp.setLayout(new FlowLayout(FlowLayout.LEFT)); lp.add(messageLabel);/*from w w w .java 2s .c o m*/ p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(tp); p.add(lp); p.setBackgroundPainter(tp.getBackgroundPainter()); lp.setBackgroundPainter(tp.getBackgroundPainter()); container.add(p, BorderLayout.NORTH); container.add(tabs, BorderLayout.CENTER); container.add(controlsBar, BorderLayout.SOUTH); }
From source file:org.kse.gui.dialogs.sign.DSignJar.java
private void initComponents(String signatureName) throws CryptoException { jlInputJar = new JLabel(res.getString("DSignJar.jlInputJar.text")); jtfInputJar = new JTextField(30); jtfInputJar.setCaretPosition(0);/*from ww w . ja v a 2 s. c om*/ jtfInputJar.setToolTipText(res.getString("DSignJar.jtfInputJar.tooltip")); jbInputJarBrowse = new JButton(res.getString("DSignJar.jbInputJarBrowse.text")); PlatformUtil.setMnemonic(jbInputJarBrowse, res.getString("DSignJar.jbInputJarBrowse.mnemonic").charAt(0)); jbInputJarBrowse.setToolTipText(res.getString("DSignJar.jbInputJarBrowse.tooltip")); jlSignDirectly = new JLabel(res.getString("DSignJar.jlSignDirectly.text")); jcbSignDirectly = new JCheckBox(); jcbSignDirectly.setSelected(true); jcbSignDirectly.setToolTipText(res.getString("DSignJar.jcbSignDirectly.tooltip")); jlOutputJar = new JLabel(res.getString("DSignJar.jlOutputJar.text")); jtfOutputJar = new JTextField(30); jtfOutputJar.setEnabled(false); jtfOutputJar.setCaretPosition(0); jtfOutputJar.setToolTipText(res.getString("DSignJar.jtfOutputJar.tooltip")); jbOutputJarBrowse = new JButton(res.getString("DSignJar.jbOutputJarBrowse.text")); PlatformUtil.setMnemonic(jbOutputJarBrowse, res.getString("DSignJar.jbOutputJarBrowse.mnemonic").charAt(0)); jbOutputJarBrowse.setToolTipText(res.getString("DSignJar.jbOutputJarBrowse.tooltip")); jbOutputJarBrowse.setEnabled(false); jlSignatureName = new JLabel(res.getString("DSignJar.jlSignatureName.text")); jtfSignatureName = new JTextField(convertSignatureName(signatureName), 15); jtfSignatureName.setCaretPosition(0); jtfSignatureName.setToolTipText(res.getString("DSignJar.jtfSignatureName.tooltip")); jlSignatureAlgorithm = new JLabel(res.getString("DSignJar.jlSignatureAlgorithm.text")); jcbSignatureAlgorithm = new JComboBox<SignatureType>(); DialogHelper.populateSigAlgs(signKeyPairType, this.signPrivateKey, provider, jcbSignatureAlgorithm); jcbSignatureAlgorithm.setToolTipText(res.getString("DSignJar.jcbSignatureAlgorithm.tooltip")); jlDigestAlgorithm = new JLabel(res.getString("DSignJar.jlDigestAlgorithm.text")); jcbDigestAlgorithm = new JComboBox<DigestType>(); populateDigestAlgs(); jcbDigestAlgorithm.setToolTipText(res.getString("DSignJar.jcbDigestAlgorithm.tooltip")); jlAddTimestamp = new JLabel(res.getString("DSignJar.jlAddTimestamp.text")); jcbAddTimestamp = new JCheckBox(); jcbAddTimestamp.setSelected(false); jcbAddTimestamp.setToolTipText(res.getString("DSignJar.jcbAddTimestamp.tooltip")); jlTimestampServerUrl = new JLabel(res.getString("DSignJar.jlTimestampServerUrl.text")); jcbTimestampServerUrl = new JComboBox<String>(); jcbTimestampServerUrl.setEditable(true); jcbTimestampServerUrl.setEnabled(false); jcbTimestampServerUrl.setToolTipText(res.getString("DSignJar.jcbTimestampServerUrl.tooltip")); jcbTimestampServerUrl.setModel(new DefaultComboBoxModel<String>(getTsaUrls())); jbOK = new JButton(res.getString("DSignJar.jbOK.text")); jbCancel = new JButton(res.getString("DSignJar.jbCancel.text")); jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY); jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel); // layout Container pane = getContentPane(); pane.setLayout(new MigLayout("insets dialog, fill", "[para]unrel[right]unrel[]", "[]unrel[]")); MiGUtil.addSeparator(pane, res.getString("DSignJar.jlFiles.text")); pane.add(jlInputJar, "skip"); pane.add(jtfInputJar, "sgx"); pane.add(jbInputJarBrowse, "wrap"); pane.add(jlSignDirectly, "skip"); pane.add(jcbSignDirectly, "wrap"); pane.add(jlOutputJar, "skip"); pane.add(jtfOutputJar, "sgx"); pane.add(jbOutputJarBrowse, "wrap para"); MiGUtil.addSeparator(pane, res.getString("DSignJar.jlSignature.text")); pane.add(jlSignatureName, "skip"); pane.add(jtfSignatureName, "sgx, wrap"); pane.add(jlSignatureAlgorithm, "skip"); pane.add(jcbSignatureAlgorithm, "sgx, wrap"); pane.add(jlDigestAlgorithm, "skip"); pane.add(jcbDigestAlgorithm, "sgx, wrap para"); MiGUtil.addSeparator(pane, res.getString("DSignJar.jlTimestamp.text")); pane.add(jlAddTimestamp, "skip"); pane.add(jcbAddTimestamp, "wrap"); pane.add(jlTimestampServerUrl, "skip"); pane.add(jcbTimestampServerUrl, "sgx, wrap para"); pane.add(new JSeparator(), "spanx, growx, wrap para"); pane.add(jpButtons, "right, spanx"); // actions jbInputJarBrowse.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { CursorUtil.setCursorBusy(DSignJar.this); inputJarBrowsePressed(); } finally { CursorUtil.setCursorFree(DSignJar.this); } } }); jcbSignDirectly.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent evt) { jtfOutputJar.setEnabled(!jcbSignDirectly.isSelected()); jbOutputJarBrowse.setEnabled(!jcbSignDirectly.isSelected()); } }); jbOutputJarBrowse.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { CursorUtil.setCursorBusy(DSignJar.this); outputJarBrowsePressed(); } finally { CursorUtil.setCursorFree(DSignJar.this); } } }); jcbAddTimestamp.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent evt) { jcbTimestampServerUrl.setEnabled(jcbAddTimestamp.isSelected()); } }); jbOK.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { okPressed(); } }); jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); jbCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { cancelPressed(); } }); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { closeDialog(); } }); setResizable(false); getRootPane().setDefaultButton(jbOK); pack(); setLocationRelativeTo(null); }
From source file:Provider.GoogleMapsStatic.TestUI.SampleApp.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license dialogPane = new JPanel(); contentPanel = new JPanel(); panel1 = new JPanel(); label2 = new JLabel(); ttfSizeW = new JTextField(); label4 = new JLabel(); ttfLat = new JTextField(); btnGetMap = new JButton(); label3 = new JLabel(); ttfSizeH = new JTextField(); label5 = new JLabel(); ttfLon = new JTextField(); btnQuit = new JButton(); label1 = new JLabel(); ttfLicense = new JTextField(); label6 = new JLabel(); ttfZoom = new JTextField(); scrollPane1 = new JScrollPane(); ttaStatus = new JTextArea(); panel2 = new JPanel(); panel3 = new JPanel(); checkboxRecvStatus = new JCheckBox(); checkboxSendStatus = new JCheckBox(); ttfProgressMsg = new JTextField(); progressBar = new JProgressBar(); lblProgressStatus = new JLabel(); //======== this ======== setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("Google Static Maps"); setIconImage(null);/* ww w . jav a 2s . c om*/ Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setOpaque(false); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setOpaque(false); contentPanel.setLayout(new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED } })); ((TableLayout) contentPanel.getLayout()).setHGap(5); ((TableLayout) contentPanel.getLayout()).setVGap(5); //======== panel1 ======== { panel1.setOpaque(false); panel1.setBorder(new CompoundBorder( new TitledBorder("Configure the inputs to Google Static Maps"), Borders.DLU2_BORDER)); panel1.setLayout( new TableLayout(new double[][] { { 0.17, 0.17, 0.17, 0.17, 0.05, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); ((TableLayout) panel1.getLayout()).setHGap(5); ((TableLayout) panel1.getLayout()).setVGap(5); //---- label2 ---- label2.setText("Size Width"); label2.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label2, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfSizeW ---- ttfSizeW.setText("512"); panel1.add(ttfSizeW, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label4 ---- label4.setText("Latitude"); label4.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label4, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLat ---- ttfLat.setText("38.931099"); panel1.add(ttfLat, new TableLayoutConstraints(3, 0, 3, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- btnGetMap ---- btnGetMap.setText("Get Map"); btnGetMap.setHorizontalAlignment(SwingConstants.LEFT); btnGetMap.setMnemonic('G'); btnGetMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startTaskAction(); } }); panel1.add(btnGetMap, new TableLayoutConstraints(5, 0, 5, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label3 ---- label3.setText("Size Height"); label3.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label3, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfSizeH ---- ttfSizeH.setText("512"); panel1.add(ttfSizeH, new TableLayoutConstraints(1, 1, 1, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label5 ---- label5.setText("Longitude"); label5.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label5, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLon ---- ttfLon.setText("-77.3489"); panel1.add(ttfLon, new TableLayoutConstraints(3, 1, 3, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- btnQuit ---- btnQuit.setText("Quit"); btnQuit.setMnemonic('Q'); btnQuit.setHorizontalAlignment(SwingConstants.LEFT); btnQuit.setHorizontalTextPosition(SwingConstants.RIGHT); btnQuit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { quitProgram(); } }); panel1.add(btnQuit, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label1 ---- label1.setText("License Key"); label1.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label1, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLicense ---- ttfLicense.setToolTipText("Enter your own URI for a file to download in the background"); panel1.add(ttfLicense, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label6 ---- label6.setText("Zoom"); label6.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label6, new TableLayoutConstraints(2, 2, 2, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfZoom ---- ttfZoom.setText("14"); panel1.add(ttfZoom, new TableLayoutConstraints(3, 2, 3, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } contentPanel.add(panel1, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //======== scrollPane1 ======== { scrollPane1.setBorder( new TitledBorder("System.out - displays all status and progress messages, etc.")); scrollPane1.setOpaque(false); //---- ttaStatus ---- ttaStatus.setBorder(Borders.createEmptyBorder("1dlu, 1dlu, 1dlu, 1dlu")); ttaStatus.setToolTipText( "<html>Task progress updates (messages) are displayed here,<br>along with any other output generated by the Task.<html>"); scrollPane1.setViewportView(ttaStatus); } contentPanel.add(scrollPane1, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //======== panel2 ======== { panel2.setOpaque(false); panel2.setBorder(new CompoundBorder(new TitledBorder("Status - control progress reporting"), Borders.DLU2_BORDER)); panel2.setLayout(new TableLayout(new double[][] { { 0.45, TableLayout.FILL, 0.45 }, { TableLayout.PREFERRED, TableLayout.PREFERRED } })); ((TableLayout) panel2.getLayout()).setHGap(5); ((TableLayout) panel2.getLayout()).setVGap(5); //======== panel3 ======== { panel3.setOpaque(false); panel3.setLayout(new GridLayout(1, 2)); //---- checkboxRecvStatus ---- checkboxRecvStatus.setText("Enable \"Recieve\""); checkboxRecvStatus.setOpaque(false); checkboxRecvStatus.setToolTipText("Task will fire \"send\" status updates"); checkboxRecvStatus.setSelected(true); panel3.add(checkboxRecvStatus); //---- checkboxSendStatus ---- checkboxSendStatus.setText("Enable \"Send\""); checkboxSendStatus.setOpaque(false); checkboxSendStatus.setToolTipText("Task will fire \"recieve\" status updates"); panel3.add(checkboxSendStatus); } panel2.add(panel3, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfProgressMsg ---- ttfProgressMsg.setText("Loading map from Google Static Maps"); ttfProgressMsg.setToolTipText("Set the task progress message here"); panel2.add(ttfProgressMsg, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- progressBar ---- progressBar.setStringPainted(true); progressBar.setString("progress %"); progressBar.setToolTipText("% progress is displayed here"); panel2.add(progressBar, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- lblProgressStatus ---- lblProgressStatus.setText("task status listener"); lblProgressStatus.setHorizontalTextPosition(SwingConstants.LEFT); lblProgressStatus.setHorizontalAlignment(SwingConstants.LEFT); lblProgressStatus.setToolTipText("Task status messages are displayed here when the task runs"); panel2.add(lblProgressStatus, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } contentPanel.add(panel2, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } dialogPane.add(contentPanel, BorderLayout.CENTER); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(675, 485); setLocationRelativeTo(null); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:org.gcaldaemon.gui.ConfigEditor.java
private ConfigEditor(MainConfig config, ProgressMonitor monitor) throws Exception { this.config = config; try {//from w w w .j ava 2 s .c o m // Init swing System.setProperty("sun.awt.noerasebackground", "false"); //$NON-NLS-1$ //$NON-NLS-2$ System.setProperty("swing.aatext", "true"); //$NON-NLS-1$ //$NON-NLS-2$ System.setProperty("swing.boldMetal", "false"); //$NON-NLS-1$ //$NON-NLS-2$ Locale locale = Locale.getDefault(); String code = null; try { code = config.getConfigProperty(Configurator.EDITOR_LANGUAGE, null); if (code != null) { locale = new Locale(code); } } catch (Exception invalidLocale) { log.warn(invalidLocale); } if (!Messages.setUserLocale(locale)) { locale = Locale.ENGLISH; Messages.setUserLocale(locale); code = null; } if (code == null) { config.setConfigProperty(Configurator.EDITOR_LANGUAGE, locale.getLanguage().toLowerCase()); } try { boolean lookAndFeelChanged = false; String oldLaf = UIManager.getLookAndFeel().getClass().getName(); String newLaf = config.getConfigProperty(Configurator.EDITOR_LOOK_AND_FEEL, UIManager.getCrossPlatformLookAndFeelClassName()); lookAndFeelChanged = !oldLaf.equals(newLaf); if (lookAndFeelChanged) { UIManager.setLookAndFeel(newLaf); } if (config.getConfigProperty(Configurator.EDITOR_LOOK_AND_FEEL, null) == null) { config.setConfigProperty(Configurator.EDITOR_LOOK_AND_FEEL, newLaf); } if (lookAndFeelChanged) { new ConfigEditor(config, monitor); dispose(); return; } } catch (Exception invalidLaf) { log.warn(invalidLaf); } // Window settings setTitle(Messages.getString("config.editor") + " - " + config.getConfigPath()); //$NON-NLS-1$ //$NON-NLS-2$ setIconImage(TOOLKIT.getImage(ConfigEditor.class.getResource("/org/gcaldaemon/gui/icons/icon.gif"))); //$NON-NLS-1$ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); Container root = getContentPane(); root.setLayout(new BorderLayout()); root.add(folder, BorderLayout.CENTER); folder.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); folder.setTabPlacement(JTabbedPane.LEFT); folder.addChangeListener(this); status.setBorder(new BevelBorder(BevelBorder.LOWERED)); root.add(status, BorderLayout.SOUTH); // Create menu items fileMenu = new JMenu(Messages.getString("file")); //$NON-NLS-1$ saveMenu = new JMenuItem(Messages.getString("save"), getIcon("save")); //$NON-NLS-1$ //$NON-NLS-2$ exitMenu = new JMenuItem(Messages.getString("exit"), getIcon("exit")); //$NON-NLS-1$ //$NON-NLS-2$ viewMenu = new JMenu(Messages.getString("view")); //$NON-NLS-1$ langMenu = new JMenu(Messages.getString("language")); //$NON-NLS-1$ lafMenu = new JMenu(Messages.getString("look.and.feel")); //$NON-NLS-1$ transMenu = new JMenuItem(Messages.getString("translate")); //$NON-NLS-1$ logMenu = new JMenuItem(Messages.getString("log.viewer")); //$NON-NLS-1$ helpMenu = new JMenu(Messages.getString("help")); //$NON-NLS-1$ aboutMenu = new JMenuItem(Messages.getString("about")); //$NON-NLS-1$ // Build menu setJMenuBar(menuBar); menuBar.add(fileMenu); fileMenu.add(saveMenu); fileMenu.addSeparator(); fileMenu.add(exitMenu); menuBar.add(viewMenu); viewMenu.add(logMenu); viewMenu.addSeparator(); viewMenu.add(langMenu); viewMenu.add(lafMenu); langMenu.add(transMenu); menuBar.add(helpMenu); helpMenu.add(aboutMenu); // Build language menu Locale[] locales = Messages.getAvailableLocales(); String[] names = new String[locales.length]; String temp; int i; for (i = 0; i < locales.length; i++) { names[i] = locales[i].getDisplayLanguage(Locale.ENGLISH); if (names[i] == null || names[i].length() == 0) { names[i] = locales[i].getLanguage().toLowerCase(); } temp = locales[i].getDisplayLanguage(locale); if (temp != null && temp.length() > 0 && !temp.equals(names[i])) { names[i] = names[i] + " [" + temp + ']'; } } Arrays.sort(names, String.CASE_INSENSITIVE_ORDER); if (locales.length != 0) { langMenu.addSeparator(); } for (i = 0; i < locales.length; i++) { JMenuItem item = new JMenuItem(names[i]); item.setName('!' + names[i]); langMenu.add(item); item.addActionListener(this); } // Build look and feel menu LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels(); LookAndFeelInfo info; for (i = 0; i < infos.length; i++) { info = infos[i]; JMenuItem item = new JMenuItem(info.getName()); item.addActionListener(this); item.setName('#' + info.getClassName()); lafMenu.add(item); } // Action listeners addWindowListener(this); folder.addChangeListener(this); exitMenu.addActionListener(this); saveMenu.addActionListener(this); transMenu.addActionListener(this); logMenu.addActionListener(this); aboutMenu.addActionListener(this); // Add pages addPage("common.settings", new CommonPage(config, this)); //$NON-NLS-1$ addPage("http.settings", new HttpPage(config, this)); //$NON-NLS-1$ addPage("file.settings", new FilePage(config, this)); //$NON-NLS-1$ addPage("feed.settings", new FeedPage(config, this)); //$NON-NLS-1$ addPage("ldap.settings", new LdapPage(config, this)); //$NON-NLS-1$ addPage("notifier.settings", new NotifierPage(config, this)); //$NON-NLS-1$ addPage("sendmail.settings", new SendmailPage(config, this)); //$NON-NLS-1$ addPage("mailterm.settings", new MailtermPage(config, this)); //$NON-NLS-1$ // Set tab colors Iterator editors = disabledServices.iterator(); while (editors.hasNext()) { setServiceEnabled((BooleanEditor) editors.next(), false); } disabledServices = null; // Show GUI setResizable(true); Dimension size = TOOLKIT.getScreenSize(); int w = size.width - 50; int h = size.height - 70; w = Math.min(w, 1000); h = Math.min(h, 700); setSize(w, h); setLocation((size.width - w) / 2, (size.height - h) / 2); validate(); if (monitor != null) { monitor.dispose(); } setVisible(true); toFront(); } catch (Exception error) { if (monitor != null) { monitor.dispose(); } error(Messages.getString("error"), "Unable to start configurator: " + error, error); } }
From source file:com.tiempometa.muestradatos.JProgramTags.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos"); dialogPane = new JPanel(); contentPanel = new JPanel(); label1 = new JLabel(); statusLabel = new JLabel(); nextChipnumberTextField = new JTextField(); programButton = new JButton(); bibLabel = new JLabel(); label3 = new JLabel(); tidTextField = new JTextField(); label4 = new JLabel(); epcTextField = new JTextField(); label5 = new JLabel(); programmedEpcTextField = new JTextField(); scrollPane1 = new JScrollPane(); tagReadTable = new JTable(); lockCheckbox = new JCheckBox(); label2 = new JLabel(); accessPasswordTextField = new JTextField(); label6 = new JLabel(); killPasswordTextField = new JTextField(); checkBox1 = new JCheckBox(); buttonBar = new JPanel(); closeButton = new JButton(); CellConstraints cc = new CellConstraints(); // ======== this ======== setTitle(bundle.getString("JProgramTags.this.title")); setIconImage(/*from w ww . j a v a2 s. com*/ new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png")) .getImage()); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(Borders.DIALOG_BORDER); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { contentPanel.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(12)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(86)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(73)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(68)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(97)) }, new RowSpec[] { new RowSpec(Sizes.dluY(10)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); // ---- label1 ---- label1.setText(bundle.getString("JProgramTags.label1.text")); label1.setFont(new Font("Tahoma", Font.PLAIN, 36)); contentPanel.add(label1, cc.xywh(3, 5, 3, 1)); // ---- statusLabel ---- statusLabel.setText(bundle.getString("JProgramTags.statusLabel.text")); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); statusLabel.setBackground(Color.yellow); statusLabel.setOpaque(true); statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20)); contentPanel.add(statusLabel, cc.xywh(9, 3, 3, 5)); // ---- nextChipnumberTextField ---- nextChipnumberTextField.setFont(new Font("Tahoma", Font.PLAIN, 36)); contentPanel.add(nextChipnumberTextField, cc.xy(7, 5)); // ---- programButton ---- programButton.setText(bundle.getString("JProgramTags.programButton.text")); programButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); programButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { programButtonActionPerformed(e); } }); contentPanel.add(programButton, cc.xywh(3, 7, 3, 1)); // ---- bibLabel ---- bibLabel.setForeground(Color.red); bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36)); bibLabel.setHorizontalAlignment(SwingConstants.CENTER); contentPanel.add(bibLabel, cc.xy(11, 9)); // ---- label3 ---- label3.setText(bundle.getString("JProgramTags.label3.text")); label3.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label3, cc.xy(7, 11)); // ---- tidTextField ---- tidTextField.setEditable(false); tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(tidTextField, cc.xywh(9, 11, 3, 1)); // ---- label4 ---- label4.setText(bundle.getString("JProgramTags.label4.text")); label4.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label4, cc.xy(7, 13)); // ---- epcTextField ---- epcTextField.setEditable(false); epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(epcTextField, cc.xywh(9, 13, 3, 1)); // ---- label5 ---- label5.setText(bundle.getString("JProgramTags.label5.text")); label5.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label5, cc.xy(7, 15)); // ---- programmedEpcTextField ---- programmedEpcTextField.setEditable(false); programmedEpcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(programmedEpcTextField, cc.xywh(9, 15, 3, 1)); // ======== scrollPane1 ======== { scrollPane1.setViewportView(tagReadTable); } contentPanel.add(scrollPane1, cc.xywh(3, 17, 9, 1)); // ---- lockCheckbox ---- lockCheckbox.setText(bundle.getString("JProgramTags.lockCheckbox.text")); lockCheckbox.setSelected(true); lockCheckbox.setFont(new Font("Tahoma", Font.PLAIN, 14)); lockCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { checkBox2ItemStateChanged(e); } }); contentPanel.add(lockCheckbox, cc.xy(3, 19)); // ---- label2 ---- label2.setText(bundle.getString("JProgramTags.label2.text")); label2.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label2, cc.xy(5, 19)); // ---- accessPasswordTextField ---- accessPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(accessPasswordTextField, cc.xy(7, 19)); // ---- label6 ---- label6.setText(bundle.getString("JProgramTags.label6.text")); label6.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label6, cc.xy(5, 21)); // ---- killPasswordTextField ---- killPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(killPasswordTextField, cc.xy(7, 21)); // ---- checkBox1 ---- checkBox1.setText(bundle.getString("JProgramTags.checkBox1.text")); checkBox1.setEnabled(false); contentPanel.add(checkBox1, cc.xy(9, 21)); } dialogPane.add(contentPanel, BorderLayout.EAST); // ======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); buttonBar.setLayout( new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref"))); // ---- closeButton ---- closeButton.setText("Cerrar"); closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeButtonActionPerformed(e); } }); buttonBar.add(closeButton, cc.xy(2, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(700, 625); setLocationRelativeTo(getOwner()); // //GEN-END:initComponents }
From source file:org.spiderplan.tools.visulization.GraphFrame.java
/** * @param graph//w w w. ja v a2 s . co m * @param history optional history of the graph * @param title * @param lC the layout * @param edgeLabels map from edges to string labels * @param w width of the window * @param h height of the window */ @SuppressWarnings({ "rawtypes", "unchecked" }) public GraphFrame(AbstractTypedGraph<V, E> graph, Vector<AbstractTypedGraph<V, E>> history, String title, LayoutClass lC, Map<E, String> edgeLabels, int w, int h) { super(title); this.edgeLabels = edgeLabels; this.g = new ObservableGraph<V, E>(graph); this.g.addGraphEventListener(this); this.defaultEdgeType = this.g.getDefaultEdgeType(); this.layoutClass = lC; this.history = history; this.setLayout(lC); layout.setSize(new Dimension(w, h)); try { Relaxer relaxer = new VisRunner((IterativeContext) layout); relaxer.stop(); relaxer.prerelax(); } catch (java.lang.ClassCastException e) { } // Layout<V,E> staticLayout = new StaticLayout<V,E>(g, layout); // Layout<V,E> staticLayout = new SpringLayout<V, E>(g); vv = new VisualizationViewer<V, E>(layout, new Dimension(w, h)); JRootPane rp = this.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(java.awt.Color.lightGray); getContentPane().setFont(new Font("Serif", Font.PLAIN, 10)); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.S); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<V>()); vv.setForeground(Color.black); graphMouse = new EditingModalGraphMouse<V, E>(vv.getRenderContext(), null, null); graphMouse.setMode(ModalGraphMouse.Mode.PICKING); vv.setGraphMouse(graphMouse); vv.addKeyListener(graphMouse.getModeKeyListener()); // vv.getRenderContext().setEd vv.getRenderContext().setEdgeLabelTransformer(this); vv.getRenderContext().setEdgeDrawPaintTransformer( new PickableEdgePaintTransformer<E>(vv.getPickedEdgeState(), Color.black, Color.cyan)); vv.addComponentListener(new ComponentAdapter() { /** * @see java.awt.event.ComponentAdapter#componentResized(java.awt.event.ComponentEvent) */ @Override public void componentResized(ComponentEvent arg0) { super.componentResized(arg0); layout.setSize(arg0.getComponent().getSize()); } }); getContentPane().add(vv); /** * Create simple container for stuff on SOUTH border of this JFrame */ Container c = new Container(); c.setLayout(new FlowLayout()); c.setBackground(java.awt.Color.lightGray); c.setFont(new Font("Serif", Font.PLAIN, 10)); /** * Button to dump jpeg */ dumpJPEG = new JButton("Dump"); dumpJPEG.addActionListener(this); dumpJPEG.setName("Dump"); c.add(dumpJPEG); /** * Button that creates offspring frame for selected vertices */ subGraphButton = new JButton("Subgraph"); subGraphButton.addActionListener(this); subGraphButton.setName("Subgraph"); c.add(subGraphButton); subGraphDepthLabel = new JLabel("Depth"); c.add(subGraphDepthLabel); subGraphDepth = new JTextField("0", 2); subGraphDepth.setHorizontalAlignment(SwingConstants.CENTER); subGraphDepth.setToolTipText("Depth of sub-graph created from selected nodes."); c.add(subGraphDepth); /** * Button that switches mouse mode */ switchMode = new JButton("Transformation"); switchMode.addActionListener(this); switchMode.setName("SwitchMode"); c.add(switchMode); /** * ComboBox for Layout selection: */ JComboBox layoutList; if (graph instanceof Forest) { String[] layoutStrings = { "Static", "Circle", "DAG", "Spring", "Spring2", "FR", "FR2", "Baloon", "ISOM", "KK", "PolarPoint", "RadialTree", "Tree" }; layoutList = new JComboBox(layoutStrings); } else { String[] layoutStrings = { "Static", "Circle", "DAG", "Spring", "Spring2", "FR", "FR2", "ISOM", "KK", "PolarPoint" }; layoutList = new JComboBox(layoutStrings); } layoutList.setSelectedIndex(5); layoutList.addActionListener(this); layoutList.setName("SelectLayout"); c.add(layoutList); /** * Add container to layout */ c.setVisible(true); getContentPane().add(c, BorderLayout.SOUTH); /** * Setup history scroll bar */ if (history != null) { historySlider = new JSlider(0, history.size() - 1, history.size() - 1); historySlider.addChangeListener(this); historySlider.setMajorTickSpacing(10); historySlider.setMinorTickSpacing(1); historySlider.setPaintTicks(true); historySlider.setPaintLabels(true); historySlider.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); Font font = new Font("Serif", Font.ITALIC, 15); historySlider.setFont(font); getContentPane().add(historySlider, BorderLayout.NORTH); } this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.pack(); this.setVisible(true); }
From source file:org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjSavingDialog.java
/** Builds and lays out the UI. */ private void buildGUI() { IconManager icons = IconManager.getInstance(); TitlePanel tp = new TitlePanel(TITLE, "Set the projection's " + "parameters.", icons.getIcon(IconManager.PROJECTION_48)); Container c = getContentPane(); c.setLayout(new BorderLayout(5, 5)); c.add(tp, BorderLayout.NORTH); c.add(buildBody(), BorderLayout.CENTER); c.add(buildToolBar(), BorderLayout.SOUTH); }