List of usage examples for java.awt GridBagConstraints HORIZONTAL
int HORIZONTAL
To view the source code for java.awt GridBagConstraints HORIZONTAL.
Click Source Link
From source file:org.jets3t.gui.ObjectsAttributesDialog.java
/** * Initialise the GUI elements to display the given item. */// ww w . jav a 2 s . com private void initGui() { this.setResizable(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); JPanel unmodifiableAttributesPanel = skinsFactory.createSkinnedJPanel("ObjectStaticAttributesPanel"); unmodifiableAttributesPanel.setLayout(new GridBagLayout()); JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataPanel"); metadataContainer.setLayout(new GridBagLayout()); metadataButtonsContainer = skinsFactory.createSkinnedJPanel("ObjectPropertiesMetadataButtonsPanel"); metadataButtonsContainer.setLayout(new GridBagLayout()); // Fields to display unmodifiable object details. JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel"); objectKeyLabel.setText("Object key:"); objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField"); objectKeyTextField.setEditable(false); JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel"); objectContentLengthLabel.setText("Size:"); objectContentLengthTextField = skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField"); objectContentLengthTextField.setEditable(false); JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel"); objectLastModifiedLabel.setText("Last modified:"); objectLastModifiedTextField = skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField"); objectLastModifiedTextField.setEditable(false); JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel"); objectETagLabel.setText("ETag:"); objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField"); objectETagTextField.setEditable(false); JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel"); bucketNameLabel.setText("Bucket:"); bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField"); bucketLocationTextField.setEditable(false); ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel"); ownerNameLabel.setText("Owner name:"); ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField"); ownerNameTextField.setEditable(false); ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel"); ownerIdLabel.setText("Owner ID:"); ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField"); ownerIdTextField.setEditable(false); int row = 0; unmodifiableAttributesPanel.add(objectKeyLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); unmodifiableAttributesPanel.add(objectKeyTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); row++; unmodifiableAttributesPanel.add(objectContentLengthLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); unmodifiableAttributesPanel.add(objectContentLengthTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); row++; unmodifiableAttributesPanel.add(objectLastModifiedLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); unmodifiableAttributesPanel.add(objectLastModifiedTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); row++; unmodifiableAttributesPanel.add(objectETagLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); unmodifiableAttributesPanel.add(objectETagTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); row++; unmodifiableAttributesPanel.add(ownerNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); unmodifiableAttributesPanel.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); row++; unmodifiableAttributesPanel.add(ownerIdLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); unmodifiableAttributesPanel.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); row++; unmodifiableAttributesPanel.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0)); unmodifiableAttributesPanel.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); // Build metadata table. objectMetadataTableModel = new DefaultTableModel(new Object[] { "Name", "Value" }, 0) { private static final long serialVersionUID = -3762866886166776851L; public boolean isCellEditable(int row, int column) { return isModifyMode(); } }; metadataTableSorter = new TableSorter(objectMetadataTableModel); metadataTable = skinsFactory.createSkinnedJTable("MetadataTable"); metadataTable.setModel(metadataTableSorter); metadataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting() && removeMetadataItemButton != null) { int row = metadataTable.getSelectedRow(); removeMetadataItemButton.setEnabled(row >= 0); } } }); metadataTableSorter.setTableHeader(metadataTable.getTableHeader()); metadataTableSorter.setSortingStatus(0, TableSorter.ASCENDING); metadataContainer.add(new JScrollPane(metadataTable), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsHorizontalSpace, 0, 0)); // Add/remove buttons for metadata table. removeMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton"); removeMetadataItemButton.setEnabled(false); removeMetadataItemButton.setToolTipText("Remove the selected metadata item(s)"); guiUtils.applyIcon(removeMetadataItemButton, "/images/nuvola/16x16/actions/viewmag-.png"); removeMetadataItemButton.addActionListener(this); removeMetadataItemButton.setActionCommand("removeMetadataItem"); addMetadataItemButton = skinsFactory.createSkinnedJButton("ObjectPropertiesAddMetadataButton"); addMetadataItemButton.setToolTipText("Add a new metadata item"); guiUtils.applyIcon(addMetadataItemButton, "/images/nuvola/16x16/actions/viewmag+.png"); addMetadataItemButton.setActionCommand("addMetadataItem"); addMetadataItemButton.addActionListener(this); metadataButtonsContainer.add(removeMetadataItemButton, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0)); metadataButtonsContainer.add(addMetadataItemButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsZero, 0, 0)); metadataContainer.add(metadataButtonsContainer, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsHorizontalSpace, 0, 0)); metadataButtonsContainer.setVisible(false); // OK Button. okButton = skinsFactory.createSkinnedJButton("ObjectPropertiesOKButton"); okButton.setText("OK"); okButton.setActionCommand("OK"); okButton.addActionListener(this); // Cancel Button. cancelButton = null; cancelButton = skinsFactory.createSkinnedJButton("ObjectPropertiesCancelButton"); cancelButton.setText("Cancel"); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); cancelButton.setVisible(false); // Recognize and handle ENTER, ESCAPE, PAGE_UP, and PAGE_DOWN key presses. this.getRootPane().setDefaultButton(okButton); this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() { private static final long serialVersionUID = -7768790936535999307L; public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } }); this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_UP"), "PAGE_UP"); this.getRootPane().getActionMap().put("PAGE_UP", new AbstractAction() { private static final long serialVersionUID = -6324229423705756219L; public void actionPerformed(ActionEvent actionEvent) { previousObjectButton.doClick(); } }); this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("PAGE_DOWN"), "PAGE_DOWN"); this.getRootPane().getActionMap().put("PAGE_DOWN", new AbstractAction() { private static final long serialVersionUID = -5808972377672449421L; public void actionPerformed(ActionEvent actionEvent) { nextObjectButton.doClick(); } }); // Put it all together. row = 0; JPanel container = skinsFactory.createSkinnedJPanel("ObjectPropertiesPanel"); container.setLayout(new GridBagLayout()); container.add(unmodifiableAttributesPanel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); // Object previous and next buttons, if we have multiple objects. previousObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesPreviousButton"); guiUtils.applyIcon(previousObjectButton, "/images/nuvola/16x16/actions/1leftarrow.png"); previousObjectButton.addActionListener(this); previousObjectButton.setEnabled(false); nextObjectButton = skinsFactory.createSkinnedJButton("ObjectPropertiesNextButton"); guiUtils.applyIcon(nextObjectButton, "/images/nuvola/16x16/actions/1rightarrow.png"); nextObjectButton.addActionListener(this); nextObjectButton.setEnabled(false); currentObjectLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectPropertiesCurrentObjectLabel"); currentObjectLabel.setHorizontalAlignment(JLabel.CENTER); nextPreviousPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesNextPreviousPanel"); nextPreviousPanel.setLayout(new GridBagLayout()); nextPreviousPanel.add(previousObjectButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); nextPreviousPanel.add(currentObjectLabel, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsHorizontalSpace, 0, 0)); nextPreviousPanel.add(nextObjectButton, new GridBagConstraints(2, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); container.add(nextPreviousPanel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); nextPreviousPanel.setVisible(false); row++; JHtmlLabel metadataLabel = skinsFactory.createSkinnedJHtmlLabel("MetadataLabel"); metadataLabel.setText("<html><b>Metadata Attributes</b></html>"); metadataLabel.setHorizontalAlignment(JLabel.CENTER); container.add(metadataLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0)); container.add(metadataContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); // Destination Access Control List setting. destinationPanel = skinsFactory.createSkinnedJPanel("DestinationPanel"); destinationPanel.setLayout(new GridBagLayout()); JPanel actionButtonsPanel = skinsFactory.createSkinnedJPanel("ObjectPropertiesActionButtonsPanel"); actionButtonsPanel.setLayout(new GridBagLayout()); actionButtonsPanel.add(cancelButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); actionButtonsPanel.add(okButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); cancelButton.setVisible(false); container.add(actionButtonsPanel, new GridBagConstraints(0, row++, 3, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsDefault, 0, 0)); this.getContentPane().add(container); this.pack(); this.setSize(new Dimension(450, 500)); this.setLocationRelativeTo(this.getOwner()); }
From source file:edu.harvard.mcz.imagecapture.VerbatimCaptureDialog.java
protected void init() { setDefaultCloseOperation(DISPOSE_ON_CLOSE); setTitle("Transcribe Verbatim Data"); setMinimumSize(new Dimension(1020, 640)); setBounds(100, 100, 1020, 640);/*ww w . j a va 2s.c om*/ getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new BorderLayout(0, 0)); { JPanel panel = new JPanel(); contentPanel.add(panel, BorderLayout.NORTH); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); JLabel lblVerbatimDataFor = new JLabel("Verbatim Data for:"); panel.add(lblVerbatimDataFor); lblBarcode = new JLabel("Barcode"); panel.add(lblBarcode); lblCurrentid = new JLabel("CurrentID"); panel.add(lblCurrentid); } { JPanel panel = new JPanel(); contentPanel.add(panel, BorderLayout.WEST); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[] { 0, 0, 0, 0 }; gbl_panel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_panel.columnWeights = new double[] { 0.0, 1.0, 1.0, Double.MIN_VALUE }; gbl_panel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE }; panel.setLayout(gbl_panel); JLabel lblNewLabel = new JLabel("Locality"); GridBagConstraints gbc_lblNewLabel = new GridBagConstraints(); gbc_lblNewLabel.anchor = GridBagConstraints.NORTHEAST; gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel.gridx = 0; gbc_lblNewLabel.gridy = 0; panel.add(lblNewLabel, gbc_lblNewLabel); textFieldVerbLocality = new JTextArea(); textFieldVerbLocality.setRows(3); GridBagConstraints gbc_textFieldVerbLocality = new GridBagConstraints(); gbc_textFieldVerbLocality.gridheight = 2; gbc_textFieldVerbLocality.gridwidth = 2; gbc_textFieldVerbLocality.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbLocality.fill = GridBagConstraints.BOTH; gbc_textFieldVerbLocality.gridx = 1; gbc_textFieldVerbLocality.gridy = 0; panel.add(textFieldVerbLocality, gbc_textFieldVerbLocality); textFieldVerbLocality.setColumns(10); JLabel lblVerbatimDate = new JLabel("Date"); GridBagConstraints gbc_lblVerbatimDate = new GridBagConstraints(); gbc_lblVerbatimDate.anchor = GridBagConstraints.EAST; gbc_lblVerbatimDate.insets = new Insets(0, 0, 5, 5); gbc_lblVerbatimDate.gridx = 0; gbc_lblVerbatimDate.gridy = 2; panel.add(lblVerbatimDate, gbc_lblVerbatimDate); textFieldVerbDate = new JTextField(); GridBagConstraints gbc_textFieldVerbDate = new GridBagConstraints(); gbc_textFieldVerbDate.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbDate.gridwidth = 2; gbc_textFieldVerbDate.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldVerbDate.gridx = 1; gbc_textFieldVerbDate.gridy = 2; panel.add(textFieldVerbDate, gbc_textFieldVerbDate); textFieldVerbDate.setColumns(10); JLabel lblCollector = new JLabel("Collector"); GridBagConstraints gbc_lblCollector = new GridBagConstraints(); gbc_lblCollector.anchor = GridBagConstraints.EAST; gbc_lblCollector.insets = new Insets(0, 0, 5, 5); gbc_lblCollector.gridx = 0; gbc_lblCollector.gridy = 3; panel.add(lblCollector, gbc_lblCollector); textFieldVerbCollector = new JTextField(); GridBagConstraints gbc_textFieldVerbCollector = new GridBagConstraints(); gbc_textFieldVerbCollector.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbCollector.gridwidth = 2; gbc_textFieldVerbCollector.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldVerbCollector.gridx = 1; gbc_textFieldVerbCollector.gridy = 3; panel.add(textFieldVerbCollector, gbc_textFieldVerbCollector); textFieldVerbCollector.setColumns(10); JLabel lblNewLabel_1 = new JLabel("Collection"); GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints(); gbc_lblNewLabel_1.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_1.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_1.gridx = 0; gbc_lblNewLabel_1.gridy = 4; panel.add(lblNewLabel_1, gbc_lblNewLabel_1); textFieldVerbCollection = new JTextField(); GridBagConstraints gbc_textFieldVerbCollection = new GridBagConstraints(); gbc_textFieldVerbCollection.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbCollection.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldVerbCollection.gridx = 2; gbc_textFieldVerbCollection.gridy = 4; panel.add(textFieldVerbCollection, gbc_textFieldVerbCollection); textFieldVerbCollection.setColumns(10); JLabel lblNumbers = new JLabel("Numbers"); GridBagConstraints gbc_lblNumbers = new GridBagConstraints(); gbc_lblNumbers.anchor = GridBagConstraints.EAST; gbc_lblNumbers.insets = new Insets(0, 0, 5, 5); gbc_lblNumbers.gridx = 0; gbc_lblNumbers.gridy = 5; panel.add(lblNumbers, gbc_lblNumbers); textFieldVerbNumbers = new JTextField(); GridBagConstraints gbc_textFieldVerbNumbers = new GridBagConstraints(); gbc_textFieldVerbNumbers.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbNumbers.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldVerbNumbers.gridx = 2; gbc_textFieldVerbNumbers.gridy = 5; panel.add(textFieldVerbNumbers, gbc_textFieldVerbNumbers); textFieldVerbNumbers.setColumns(10); JLabel lblNewLabel_2 = new JLabel("Other Text"); GridBagConstraints gbc_lblNewLabel_2 = new GridBagConstraints(); gbc_lblNewLabel_2.anchor = GridBagConstraints.EAST; gbc_lblNewLabel_2.insets = new Insets(0, 0, 5, 5); gbc_lblNewLabel_2.gridx = 0; gbc_lblNewLabel_2.gridy = 6; panel.add(lblNewLabel_2, gbc_lblNewLabel_2); textFieldVerbUnclassifiedText = new JTextArea(); textFieldVerbUnclassifiedText.setRows(3); GridBagConstraints gbc_textFieldVerbUnclassifiedText = new GridBagConstraints(); gbc_textFieldVerbUnclassifiedText.gridheight = 2; gbc_textFieldVerbUnclassifiedText.insets = new Insets(0, 0, 5, 5); gbc_textFieldVerbUnclassifiedText.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldVerbUnclassifiedText.gridx = 2; gbc_textFieldVerbUnclassifiedText.gridy = 6; panel.add(textFieldVerbUnclassifiedText, gbc_textFieldVerbUnclassifiedText); textFieldVerbUnclassifiedText.setColumns(10); JLabel lblQuestions = new JLabel("Questions"); GridBagConstraints gbc_lblQuestions = new GridBagConstraints(); gbc_lblQuestions.anchor = GridBagConstraints.EAST; gbc_lblQuestions.insets = new Insets(0, 0, 5, 5); gbc_lblQuestions.gridx = 0; gbc_lblQuestions.gridy = 8; panel.add(lblQuestions, gbc_lblQuestions); textFieldQuestions = new JTextField(); GridBagConstraints gbc_textFieldQuestions = new GridBagConstraints(); gbc_textFieldQuestions.insets = new Insets(0, 0, 5, 5); gbc_textFieldQuestions.fill = GridBagConstraints.HORIZONTAL; gbc_textFieldQuestions.gridx = 2; gbc_textFieldQuestions.gridy = 8; panel.add(textFieldQuestions, gbc_textFieldQuestions); textFieldQuestions.setColumns(30); JLabel lblWorkflowStatus = new JLabel("Workflow Status"); GridBagConstraints gbc_lblWorkflowStatus = new GridBagConstraints(); gbc_lblWorkflowStatus.anchor = GridBagConstraints.EAST; gbc_lblWorkflowStatus.insets = new Insets(0, 0, 5, 5); gbc_lblWorkflowStatus.gridx = 0; gbc_lblWorkflowStatus.gridy = 9; panel.add(lblWorkflowStatus, gbc_lblWorkflowStatus); comboBoxWorkflowStatus = new JComboBox<String>(WorkFlowStatus.getVerbatimWorkFlowStatusValues()); GridBagConstraints gbc_comboBoxWorkflowStatus = new GridBagConstraints(); gbc_comboBoxWorkflowStatus.insets = new Insets(0, 0, 5, 0); gbc_comboBoxWorkflowStatus.gridwidth = 2; gbc_comboBoxWorkflowStatus.fill = GridBagConstraints.HORIZONTAL; gbc_comboBoxWorkflowStatus.gridx = 2; gbc_comboBoxWorkflowStatus.gridy = 9; panel.add(comboBoxWorkflowStatus, gbc_comboBoxWorkflowStatus); JPanel panel_1 = new JPanel(); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.gridwidth = 2; gbc_panel_1.insets = new Insets(0, 0, 0, 5); gbc_panel_1.fill = GridBagConstraints.BOTH; gbc_panel_1.gridx = 2; gbc_panel_1.gridy = 11; panel.add(panel_1, gbc_panel_1); GridBagLayout gbl_panel_1 = new GridBagLayout(); gbl_panel_1.columnWidths = new int[] { 150, 143, 0 }; gbl_panel_1.rowHeights = new int[] { 25, 0, 0, 0, 0 }; gbl_panel_1.columnWeights = new double[] { 0.0, 0.0, 0.0 }; gbl_panel_1.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; panel_1.setLayout(gbl_panel_1); JButton btnPartiallyIllegible = new JButton("Partially Illegible"); btnPartiallyIllegible.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { appendToQuestions(Verbatim.PARTLY_ILLEGIBLE); } }); GridBagConstraints gbc_btnPartiallyIllegible = new GridBagConstraints(); gbc_btnPartiallyIllegible.fill = GridBagConstraints.HORIZONTAL; gbc_btnPartiallyIllegible.anchor = GridBagConstraints.NORTH; gbc_btnPartiallyIllegible.insets = new Insets(0, 0, 5, 5); gbc_btnPartiallyIllegible.gridx = 0; gbc_btnPartiallyIllegible.gridy = 0; panel_1.add(btnPartiallyIllegible, gbc_btnPartiallyIllegible); JButton btnNewButton = new JButton("No Locality Data"); btnNewButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { textFieldVerbLocality.setText(Verbatim.NO_LOCALITY_DATA); } }); GridBagConstraints gbc_btnNewButton = new GridBagConstraints(); gbc_btnNewButton.anchor = GridBagConstraints.NORTHWEST; gbc_btnNewButton.insets = new Insets(0, 0, 5, 5); gbc_btnNewButton.gridx = 1; gbc_btnNewButton.gridy = 0; panel_1.add(btnNewButton, gbc_btnNewButton); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); JButton btnNewButton_1 = new JButton("Entirely Illegible"); btnNewButton_1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { appendToQuestions(Verbatim.ENTIRELY_ILLEGIBLE); } }); GridBagConstraints gbc_btnNewButton_1 = new GridBagConstraints(); gbc_btnNewButton_1.fill = GridBagConstraints.HORIZONTAL; gbc_btnNewButton_1.anchor = GridBagConstraints.NORTH; gbc_btnNewButton_1.insets = new Insets(0, 0, 5, 5); gbc_btnNewButton_1.gridx = 0; gbc_btnNewButton_1.gridy = 1; panel_1.add(btnNewButton_1, gbc_btnNewButton_1); JButton btnNoDateData = new JButton("No Date Data"); btnNoDateData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { textFieldVerbDate.setText("[No date data]"); } }); GridBagConstraints gbc_btnNoDateData = new GridBagConstraints(); gbc_btnNoDateData.fill = GridBagConstraints.HORIZONTAL; gbc_btnNoDateData.insets = new Insets(0, 0, 5, 5); gbc_btnNoDateData.gridx = 1; gbc_btnNoDateData.gridy = 1; panel_1.add(btnNoDateData, gbc_btnNoDateData); JButton btnLabelTruncatedIn = new JButton("Label Truncated in Image"); btnLabelTruncatedIn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { appendToQuestions(Verbatim.TRUNCATED_BY_IMAGE); } }); GridBagConstraints gbc_btnLabelTruncatedIn = new GridBagConstraints(); gbc_btnLabelTruncatedIn.insets = new Insets(0, 0, 5, 5); gbc_btnLabelTruncatedIn.anchor = GridBagConstraints.NORTHWEST; gbc_btnLabelTruncatedIn.gridx = 0; gbc_btnLabelTruncatedIn.gridy = 2; panel_1.add(btnLabelTruncatedIn, gbc_btnLabelTruncatedIn); JButton btnNoCollectorData = new JButton("No Collector Data"); btnNoCollectorData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { textFieldVerbCollector.setText("[No collector data]"); } }); GridBagConstraints gbc_btnNoCollectorData = new GridBagConstraints(); gbc_btnNoCollectorData.insets = new Insets(0, 0, 5, 5); gbc_btnNoCollectorData.gridx = 1; gbc_btnNoCollectorData.gridy = 2; panel_1.add(btnNoCollectorData, gbc_btnNoCollectorData); JButton btnNoPinLabels = new JButton("No Pin Labels"); btnNoPinLabels.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { appendToQuestions(Verbatim.NO_PIN_LABELS); } }); GridBagConstraints gbc_btnNoPinLabels = new GridBagConstraints(); gbc_btnNoPinLabels.insets = new Insets(0, 0, 0, 5); gbc_btnNoPinLabels.gridx = 0; gbc_btnNoPinLabels.gridy = 3; panel_1.add(btnNoPinLabels, gbc_btnNoPinLabels); } { JPanel panel = new JPanel(); contentPanel.add(panel, BorderLayout.CENTER); panel.setLayout(new BorderLayout(0, 0)); panel.add(getImagePanePinLabels()); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); btnPrevious = new JButton("Previous"); btnPrevious.setEnabled(false); if (specimenControler != null && specimenControler.isInTable()) { btnPrevious.setEnabled(true); } btnPrevious.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { save(); if (specimenControler.previousSpecimenInTable()) { specimen = specimenControler.getSpecimen(); setValues(); } } }); buttonPane.add(btnPrevious); btnNext = new JButton("Next"); btnNext.setEnabled(false); if (specimenControler != null && specimenControler.isInTable()) { btnNext.setEnabled(true); } btnNext.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { save(); if (specimenControler.nextSpecimenInTable()) { specimen = specimenControler.getSpecimen(); setValues(); } } }); buttonPane.add(btnNext); { JButton okButton = new JButton("OK"); okButton.setActionCommand("OK"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (save()) { setVisible(false); } } }); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); buttonPane.add(cancelButton); } } }
From source file:logdruid.ui.DateEditor.java
/** * Create the panel.//from www .j a v a2s . co m */ public DateEditor(Repository rep) { repository = rep; model = new MyTableModel2(data, header); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 15, 550, 15 }; gridBagLayout.rowHeights = new int[] { 152, 300 }; gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0 }; gridBagLayout.rowWeights = new double[] { 0.0, 1.0 }; setLayout(gridBagLayout); JPanel panel_1 = new JPanel(); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.fill = GridBagConstraints.BOTH; gbc_panel_1.insets = new Insets(5, 0, 5, 5); gbc_panel_1.gridx = 1; gbc_panel_1.gridy = 0; add(panel_1, gbc_panel_1); panel_1.setLayout(new BorderLayout(0, 0)); table = new JTable(model); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setBorder(UIManager.getBorder("TextPane.border")); table.setPreferredScrollableViewportSize(new Dimension(0, 0)); table.setFillsViewportHeight(true); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // ((table.getSelectedRow()!=-1)?table.convertRowIndexToModel(table.getSelectedRow()):-1) // persist repository // display selected row if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1) >= 0) { /* * recEditor = new RecordingEditor(repository * .getRecordings().get(((table.getSelectedRow()!=-1)?table. * convertRowIndexToModel(table.getSelectedRow()):-1)), * repository); jPanelDetail.removeAll(); */ // jPanelDetail.add(recEditor, gbc_jPanelDetail); DateFormat df = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); if (df != null) { textFieldName.setText((String) df.getName()); textFieldPattern.setText((String) df.getPattern()); textField.setText((String) df.getDateFormat()); } // jPanelDetail.revalidate(); // jPanelDetail.repaint(); // jPanelDetail.setVisible(true); // reloadTable(); those 2 ******** // jPanelDetail.revalidate(); } } }); JScrollPane scrollPane = new JScrollPane(table); panel_1.add(scrollPane, BorderLayout.CENTER); // Set up column sizes. initColumnSizes(table); JPanel panel = new JPanel(); FlowLayout flowLayout = (FlowLayout) panel.getLayout(); flowLayout.setAlignment(FlowLayout.LEFT); flowLayout.setVgap(2); flowLayout.setHgap(2); panel_1.add(panel, BorderLayout.SOUTH); JButton btnNew = new JButton("New"); panel.add(btnNew); btnNew.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { DateFormat df = new DateFormat("name", "\\w{3}\\s[0-9]{1}/[0-9]{2}/[0-9]{2}\\s\\d\\d:\\d\\d:\\d\\d", "EEE. MM/dd/yy HH:mm:ss"); repository.addDateFormat(df); data.add(new Object[] { df.getName(), df.getPattern(), df.getDateFormat() }); table.repaint(); } }); JButton btnDuplicate = new JButton("Duplicate"); btnDuplicate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1) >= 0) { DateFormat df = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); repository.addDateFormat(df); reloadTable(); // data.add(new Object[] { table.getRowCount()+1, // df.getName(),df.getDateFormat()}); table.repaint(); } } }); panel.add(btnDuplicate); JButton btnDelete = new JButton("Delete"); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int selectedRow = ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1); if (selectedRow >= 0) { repository.deleteDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); data.remove( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); reloadTable(); table.setRowSelectionInterval(selectedRow, selectedRow); table.repaint(); } } }); panel.add(btnDelete); jPanelDetail = new JPanel(); gbc_jPanelDetail = new GridBagConstraints(); gbc_jPanelDetail.anchor = GridBagConstraints.NORTH; gbc_jPanelDetail.fill = GridBagConstraints.HORIZONTAL; gbc_jPanelDetail.gridx = 1; gbc_jPanelDetail.gridy = 1; add(jPanelDetail, gbc_jPanelDetail); GridBagLayout gbl_jPanelDetail = new GridBagLayout(); gbl_jPanelDetail.columnWidths = new int[] { 169 }; gbl_jPanelDetail.rowHeights = new int[] { 0, 0, 0, 0, 150, 0 }; gbl_jPanelDetail.columnWeights = new double[] { 1.0, 0.0 }; gbl_jPanelDetail.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0 }; jPanelDetail.setLayout(gbl_jPanelDetail); JPanel panel_2 = new JPanel(); panel_2.setBorder(null); GridBagConstraints gbc_panel_2 = new GridBagConstraints(); gbc_panel_2.gridwidth = 2; gbc_panel_2.anchor = GridBagConstraints.NORTHWEST; gbc_panel_2.insets = new Insets(0, 0, 5, 0); gbc_panel_2.gridx = 0; gbc_panel_2.gridy = 0; jPanelDetail.add(panel_2, gbc_panel_2); panel_2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); JLabel label = new JLabel("Name"); panel_2.add(label); textFieldName = new JTextField(); textFieldName.setColumns(20); panel_2.add(textFieldName); JPanel panel_3 = new JPanel(); FlowLayout flowLayout_1 = (FlowLayout) panel_3.getLayout(); flowLayout_1.setAlignment(FlowLayout.LEFT); panel_3.setBorder(null); GridBagConstraints gbc_panel_3 = new GridBagConstraints(); gbc_panel_3.insets = new Insets(0, 0, 5, 0); gbc_panel_3.gridwidth = 2; gbc_panel_3.anchor = GridBagConstraints.NORTHWEST; gbc_panel_3.gridx = 0; gbc_panel_3.gridy = 1; jPanelDetail.add(panel_3, gbc_panel_3); labelPattern = new JLabel("Pattern"); panel_3.add(labelPattern); textFieldPattern = new JTextField(); textFieldPattern.setColumns(40); panel_3.add(textFieldPattern); JButton btnSave = new JButton("Save"); btnSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DateFormat df1 = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); df1.update(textFieldName.getText(), textFieldPattern.getText(), textField.getText()); reloadTable(); } }); JPanel panel_4 = new JPanel(); FlowLayout flowLayout_2 = (FlowLayout) panel_4.getLayout(); flowLayout_2.setAlignment(FlowLayout.LEFT); GridBagConstraints gbc_panel_4 = new GridBagConstraints(); gbc_panel_4.anchor = GridBagConstraints.WEST; gbc_panel_4.insets = new Insets(0, 0, 5, 5); gbc_panel_4.gridx = 0; gbc_panel_4.gridy = 2; jPanelDetail.add(panel_4, gbc_panel_4); JLabel lblFastDateFormat = new JLabel("FastDateFormat"); panel_4.add(lblFastDateFormat); textField = new JTextField(); panel_4.add(textField); textField.setColumns(30); JPanel panel_5 = new JPanel(); FlowLayout flowLayout_3 = (FlowLayout) panel_5.getLayout(); flowLayout_3.setAlignment(FlowLayout.LEFT); GridBagConstraints gbc_panel_5 = new GridBagConstraints(); gbc_panel_5.insets = new Insets(0, 0, 5, 5); gbc_panel_5.fill = GridBagConstraints.BOTH; gbc_panel_5.gridx = 0; gbc_panel_5.gridy = 3; jPanelDetail.add(panel_5, gbc_panel_5); JLabel lblSampleLabel = new JLabel("Sample"); panel_5.add(lblSampleLabel); JPanel panel_6 = new JPanel(); panel_6.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); GridBagConstraints gbc_panel_6 = new GridBagConstraints(); gbc_panel_6.ipady = 1; gbc_panel_6.ipadx = 1; gbc_panel_6.insets = new Insets(0, 0, 5, 5); gbc_panel_6.fill = GridBagConstraints.BOTH; gbc_panel_6.gridx = 0; gbc_panel_6.gridy = 4; jPanelDetail.add(panel_6, gbc_panel_6); panel_6.setLayout(new BorderLayout(0, 0)); JTextPane textPane = new JTextPane(); textPane.setBackground(UIManager.getColor("windowBorder")); panel_6.add(textPane); GridBagConstraints gbc_btnSave = new GridBagConstraints(); gbc_btnSave.anchor = GridBagConstraints.WEST; gbc_btnSave.insets = new Insets(0, 0, 0, 5); gbc_btnSave.gridx = 0; gbc_btnSave.gridy = 5; jPanelDetail.add(btnSave, gbc_btnSave); reloadTable(); }
From source file:net.sf.taverna.t2.activities.rshell.views.RshellConfigurationPanel.java
private Component createSettingsPanel() { JPanel settingsPanel = new JPanel(new GridBagLayout()); GridBagConstraints labelConstraints = new GridBagConstraints(); labelConstraints.weightx = 0.0;// w w w. jav a 2 s. c o m labelConstraints.gridx = 0; labelConstraints.gridy = 0; labelConstraints.fill = GridBagConstraints.NONE; labelConstraints.anchor = GridBagConstraints.LINE_START; GridBagConstraints fieldConstraints = new GridBagConstraints(); fieldConstraints.weightx = 1.0; fieldConstraints.gridx = 1; fieldConstraints.gridy = 0; fieldConstraints.fill = GridBagConstraints.HORIZONTAL; GridBagConstraints buttonConstraints = new GridBagConstraints(); buttonConstraints.weightx = 1.0; buttonConstraints.gridx = 1; buttonConstraints.gridy = 2; buttonConstraints.fill = GridBagConstraints.NONE; buttonConstraints.anchor = GridBagConstraints.WEST; Dimension dimension = new Dimension(0, 0); hostnameField = new JTextField(); JLabel hostnameLabel = new JLabel("Hostname"); hostnameField.setSize(dimension); hostnameLabel.setSize(dimension); hostnameLabel.setLabelFor(hostnameField); JsonNode connectionSettings = getJson().path("connection"); hostnameField.setText(connectionSettings.path("hostname").asText()); portField = new JTextField(); JLabel portLabel = new JLabel("Port"); portField.setSize(dimension); portLabel.setSize(dimension); portLabel.setLabelFor(portField); portField.setText( Integer.toString(connectionSettings.path("port").asInt(RshellTemplateService.DEFAULT_PORT))); // "Set username and password" button ActionListener usernamePasswordListener = new ActionListener() { public void actionPerformed(ActionEvent e) { if (credManagerUI == null) { credManagerUI = new CredentialManagerUI(credentialManager); } credManagerUI.newPasswordForService( URI.create("rserve://" + hostnameField.getText() + ":" + portField.getText())); // this is used as a key for the service in Credential Manager } }; JButton setHttpUsernamePasswordButton = new JButton("Set username and password"); setHttpUsernamePasswordButton.setSize(dimension); setHttpUsernamePasswordButton.addActionListener(usernamePasswordListener); keepSessionAliveCheckBox = new JCheckBox("Keep Session Alive"); keepSessionAliveCheckBox.setSelected(connectionSettings.path("keepSessionAlive") .asBoolean(RshellTemplateService.DEFAULT_KEEP_SESSION_ALIVE)); settingsPanel.add(hostnameLabel, labelConstraints); labelConstraints.gridy++; settingsPanel.add(hostnameField, fieldConstraints); fieldConstraints.gridy++; settingsPanel.add(portLabel, labelConstraints); labelConstraints.gridy++; settingsPanel.add(portField, fieldConstraints); fieldConstraints.gridy++; settingsPanel.add(setHttpUsernamePasswordButton, buttonConstraints); buttonConstraints.gridy++; fieldConstraints.gridy++; settingsPanel.add(keepSessionAliveCheckBox, fieldConstraints); fieldConstraints.gridy++; return settingsPanel; }
From source file:net.java.sip.communicator.gui.AuthenticationSplash.java
/** * * We use dynamic layout managers, so that layout is dynamic and will * adapt properly to user-customized fonts and localized text. The * GridBagLayout makes it easy to line up components of varying * sizes along invisible vertical and horizontal grid lines. It * is important to sketch the layout of the interface and decide * on the grid before writing the layout code. * * Here we actually use/* w w w . j a v a 2s .co m*/ * our own subclass of GridBagLayout called StringGridBagLayout, * which allows us to use strings to specify constraints, rather * than having to create GridBagConstraints objects manually. * * * We use the JLabel.setLabelFor() method to connect * labels to what they are labeling. This allows mnemonics to work * and assistive to technologies used by persons with disabilities * to provide much more useful information to the user. */ private void initComponents(final Frame parent) { Container contents = getContentPane(); contents.setLayout(new BorderLayout()); String title = Utils.getProperty("net.java.sip.communicator.gui.AUTH_WIN_TITLE"); if (title == null) title = "Login Manager"; setTitle(title); setResizable(false); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { dialogDone(CMD_CANCEL, parent); } }); // Accessibility -- all frames, dialogs, and applets should // have a description getAccessibleContext().setAccessibleDescription("Authentication Splash"); String authPromptLabelValue = Utils.getProperty("net.java.sip.communicator.gui.AUTHENTICATION_PROMPT"); if (authPromptLabelValue == null) authPromptLabelValue = "Please register to the service or enter your credentials to log in:"; JLabel splashLabel = new JLabel(authPromptLabelValue); splashLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); splashLabel.setHorizontalAlignment(SwingConstants.CENTER); splashLabel.setHorizontalTextPosition(SwingConstants.CENTER); contents.add(splashLabel, BorderLayout.NORTH); JPanel centerPane = new JPanel(); centerPane.setLayout(new GridBagLayout()); userNameTextField = new JTextField(); // needed below // user name label JLabel userNameLabel = new JLabel(); userNameLabel.setDisplayedMnemonic('U'); // setLabelFor() allows the mnemonic to work userNameLabel.setLabelFor(userNameTextField); String userNameLabelValue = Utils.getProperty("net.java.sip.communicator.gui.USER_NAME_LABEL"); if (userNameLabelValue == null) userNameLabelValue = "Username"; int gridy = 0; userNameLabel.setText(userNameLabelValue); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(12, 12, 0, 0); centerPane.add(userNameLabel, c); // user name text c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(12, 7, 0, 11); centerPane.add(userNameTextField, c); passwordTextField = new JPasswordField(); //needed below // password label JLabel passwordLabel = new JLabel(); passwordLabel.setDisplayedMnemonic('P'); passwordLabel.setLabelFor(passwordTextField); String pLabelStr = PropertiesDepot.getProperty("net.java.sip.communicator.gui.PASSWORD_LABEL"); if (pLabelStr == null) pLabelStr = "Password"; passwordLabel.setText(pLabelStr); c = new GridBagConstraints(); c.gridx = 0; c.gridy = gridy; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(11, 12, 0, 0); centerPane.add(passwordLabel, c); // password text passwordTextField.setEchoChar('\u2022'); c = new GridBagConstraints(); c.gridx = 1; c.gridy = gridy++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.insets = new Insets(11, 7, 0, 11); centerPane.add(passwordTextField, c); //Set a relevant realm value //Bug report by Steven Lass (sltemp at comcast.net) //JLabel realmValueLabel = new JLabel("SipPhone.com"); // needed below // realm label JLabel realmLabel = new JLabel(); realmLabel.setDisplayedMnemonic('R'); realmLabel.setLabelFor(realmValueLabel); realmLabel.setText("Realm"); realmValueLabel = new JLabel(); // Buttons along bottom of window JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, 0)); loginButton = new JButton(); loginButton.setText("Login"); loginButton.setActionCommand(CMD_LOGIN); loginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(loginButton); // space buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); registerButton = new JButton(); registerButton.setMnemonic('G'); registerButton.setText("Register"); registerButton.setActionCommand(CMD_REGISTER); registerButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(registerButton); buttonPanel.add(Box.createRigidArea(new Dimension(5, 0))); cancelButton = new JButton(); cancelButton.setText("Cancel"); cancelButton.setActionCommand(CMD_CANCEL); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { dialogDone(event, parent); } }); buttonPanel.add(cancelButton); c = new GridBagConstraints(); c.gridx = 0; c.gridy = 3; c.gridwidth = 2; c.insets = new Insets(11, 12, 11, 11); centerPane.add(buttonPanel, c); contents.add(centerPane, BorderLayout.CENTER); getRootPane().setDefaultButton(loginButton); equalizeButtonSizes(); setFocusTraversalPolicy(new FocusTraversalPol()); }
From source file:dmh.kuebiko.view.NoteStackFrame.java
/** * Initialize the contents of the frame. The contents of this method was * generated by Window Builder Pro.// ww w .j av a2 s . c o m */ private void initialize() { setTitle(buildTitle()); setBounds(100, 100, 450, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 0, 0, 0, 0 }; gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0, 0 }; gridBagLayout.columnWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE }; gridBagLayout.rowWeights = new double[] { 0.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE }; getContentPane().setLayout(gridBagLayout); horizontalStrut = Box.createHorizontalStrut(20); horizontalStrut.setMinimumSize(new Dimension(3, 0)); horizontalStrut.setPreferredSize(new Dimension(3, 0)); horizontalStrut.setSize(new Dimension(3, 0)); GridBagConstraints gbc_horizontalStrut = new GridBagConstraints(); gbc_horizontalStrut.insets = new Insets(0, 0, 0, 0); gbc_horizontalStrut.gridx = 0; gbc_horizontalStrut.gridy = 0; getContentPane().add(horizontalStrut, gbc_horizontalStrut); GridBagConstraints gbc_stateImageLabel = new GridBagConstraints(); gbc_stateImageLabel.insets = new Insets(0, 0, 0, 0); gbc_stateImageLabel.anchor = GridBagConstraints.EAST; gbc_stateImageLabel.gridx = 1; gbc_stateImageLabel.gridy = 0; stateImageLabel.setBorder(null); stateImageLabel.setHorizontalAlignment(SwingConstants.CENTER); getContentPane().add(stateImageLabel, gbc_stateImageLabel); searchText = new JTextField(); GridBagConstraints gbc_searchText = new GridBagConstraints(); gbc_searchText.insets = new Insets(0, 0, 0, 0); gbc_searchText.fill = GridBagConstraints.HORIZONTAL; gbc_searchText.gridx = 2; gbc_searchText.gridy = 0; getContentPane().add(searchText, gbc_searchText); searchText.setColumns(10); if (SystemUtils.IS_OS_MAC_OSX) { // Make the text field look like the standard Mac OS X search // box control. searchText.putClientProperty("JTextField.variant", "search"); } splitPane = new JSplitPane(); splitPane.setBorder(null); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); GridBagConstraints gbc_splitPane = new GridBagConstraints(); gbc_splitPane.gridwidth = 3; gbc_splitPane.gridheight = 4; gbc_splitPane.insets = new Insets(0, 0, 0, 0); gbc_splitPane.fill = GridBagConstraints.BOTH; gbc_splitPane.gridx = 0; gbc_splitPane.gridy = 1; getContentPane().add(splitPane, gbc_splitPane); notePanel = new NotePanel(); notePanel.getHuxleyUiManager().setOnTextChangeCallback(new Callback<Boolean>() { @Override public void callback(Boolean input) { toggleUnsavedChangeIndicator(input); } }); splitPane.setRightComponent(notePanel); noteTableScroll = new JScrollPane(); noteTableScroll.setMinimumSize(new Dimension(23, 100)); splitPane.setLeftComponent(noteTableScroll); noteTable = newNoteTable(); noteTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); noteTableScroll.setViewportView(noteTable); ActionObserverUtil.registerEnMass(actionMngr, observable, notePanel.getHuxleyUiManager().getTextAction(TextAction.INSERT_DATE)); insertDateMenuItem = new JMenuItem(actionMngr.getAction(InsertDynamicTextAction.class)); insertDateMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.SHIFT_MASK | Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); textMenu.add(insertDateMenuItem); }
From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java
private JPanel creerJournalMoisPanel(final Date date, long debit, long credit, final Journal jrnl) { final JPanel panelMoisCompte = new JPanel(); panelMoisCompte.setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 2, 1, 2); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 0;//from w ww . ja v a 2 s. c o m c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 1; c.weighty = 0; panelMoisCompte.setBorder(BorderFactory.createTitledBorder(dateFormat.format(date))); // Date du mois panelMoisCompte.add(new JLabel(dateFormat.format(date)), c); // Totaux du mois c.gridx++; panelMoisCompte.add(new JLabel(" dbit : " + GestionDevise.currencyToString(debit)), c); c.gridx++; panelMoisCompte.add(new JLabel(" crdit : " + GestionDevise.currencyToString(credit)), c); // Bouton dtails JButton boutonShow = new JButton("+/-"); boutonShow.setOpaque(false); boutonShow.setHorizontalAlignment(SwingConstants.LEFT); c.weightx = 0; c.gridx++; panelMoisCompte.add(boutonShow, c); boutonShow.addActionListener(new ActionListener() { private boolean isShow = false; private ListPanelEcritures listEcriture; public void actionPerformed(ActionEvent e) { System.err.println(this.isShow); // Afficher la JTable du compte if (!this.isShow) { final SQLElement element = Configuration.getInstance().getDirectory().getElement("ECRITURE"); final SQLTable ecrTable = element.getTable(); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.DATE, 1); Date inf = cal.getTime(); cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE)); Date sup = cal.getTime(); System.out.println("Inf : " + inf + " Sup : " + sup); Where w = new Where(ecrTable.getField("ID_JOURNAL"), "=", jrnl.getId()); Where w2 = new Where(ecrTable.getField("DATE"), inf, sup); if (!UserManager.getInstance().getCurrentUser().getRights() .haveRight(ComptaUserRight.ACCES_NOT_RESCTRICTED_TO_411)) { // TODO Show Restricted acces in UI w = w.and(new Where(ecrTable.getField("COMPTE_NUMERO"), "LIKE", "411%")); } this.listEcriture = new ListPanelEcritures(element, w.and(w2)); this.listEcriture.setModificationVisible(false); this.listEcriture.setAjoutVisible(false); this.listEcriture.setSuppressionVisible(false); this.listEcriture.getListe().setSQLEditable(false); Dimension d; // Taille limite 200 maximum if (this.listEcriture.getListe().getPreferredSize().height > 200) { d = new Dimension(this.listEcriture.getListe().getPreferredSize().width, 200); } else { d = new Dimension(this.listEcriture.getListe().getPreferredSize().width, this.listEcriture.getListe().getPreferredSize().height + 30); } this.listEcriture.getListe().setPreferredSize(d); // c.gridy = 2; c.gridx = 0; c.gridy = 1; c.gridwidth = 4; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; this.listEcriture.getListe().setSQLEditable(false); panelMoisCompte.add(this.listEcriture, c); this.listEcriture.getListe().getJTable().addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { JPopupMenu menu = new JPopupMenu(); menu.add(new AbstractAction("Voir la source") { public void actionPerformed(ActionEvent e) { SQLRow row = base.getTable("ECRITURE") .getRow(listEcriture.getListe().getSelectedId()); MouvementSQLElement.showSource(row.getInt("ID_MOUVEMENT")); } }); menu.show(e.getComponent(), e.getPoint().x, e.getPoint().y); } } }); } else { panelMoisCompte.remove(this.listEcriture); System.out.println("Hide ListEcriture"); panelMoisCompte.repaint(); panelMoisCompte.revalidate(); } this.isShow = !this.isShow; SwingUtilities.getRoot(panelMoisCompte).repaint(); } }); return panelMoisCompte; }
From source file:org.executequery.gui.editor.QueryEditor.java
private void init() throws Exception { // construct the two query text area and results panels statusBar = new QueryEditorStatusBar(); statusBar.setBorder(BorderFactory.createEmptyBorder(0, -1, -2, -2)); editorPanel = new QueryEditorTextPanel(this); resultsPanel = new QueryEditorResultsPanel(this); delegate = new QueryEditorDelegate(this); popup = new QueryEditorPopupMenu(delegate); editorPanel.addEditorPaneMouseListener(popup); baseEditorPanel = new JPanel(new BorderLayout()); baseEditorPanel.add(editorPanel, BorderLayout.CENTER); baseEditorPanel.add(statusBar, BorderLayout.SOUTH); baseEditorPanel//from ww w. j a va 2 s . c o m .setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, GUIUtilities.getDefaultBorderColour())); // add to a base panel - when last tab closed visible set // to false on the tab pane and split collapses - want to avoid this resultsBase = new JPanel(new BorderLayout()); resultsBase.add(resultsPanel, BorderLayout.CENTER); if (new SplitPaneFactory().usesCustomSplitPane()) { splitPane = new EditorSplitPane(JSplitPane.VERTICAL_SPLIT, baseEditorPanel, resultsBase); } else { splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, baseEditorPanel, resultsBase); } splitPane.setDividerSize(4); splitPane.setResizeWeight(0.5); // --------------------------------------- // the tool bar and conn combo toolBar = new QueryEditorToolBar(editorPanel.getTextPaneActionMap(), editorPanel.getTextPaneInputMap()); Vector<DatabaseConnection> connections = ConnectionManager.getActiveConnections(); connectionsCombo = new OpenConnectionsComboBox(this, connections); maxRowCountCheckBox = new JCheckBox(); maxRowCountCheckBox.setToolTipText("Enable/disable max records"); maxRowCountCheckBox.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { maxRowCountCheckBoxSelected(); } }); maxRowCountField = new MaxRowCountField(this); toolsPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridy++; gbc.gridx++; gbc.weightx = 1.0; gbc.gridwidth = GridBagConstraints.REMAINDER; toolsPanel.add(toolBar, gbc); gbc.gridy++; gbc.weightx = 0; gbc.gridwidth = 1; gbc.insets.top = 7; gbc.insets.left = 5; gbc.insets.right = 10; toolsPanel.add(createLabel("Connection:", 'C'), gbc); gbc.gridx++; gbc.weightx = 1.0; gbc.insets.top = 2; gbc.insets.bottom = 2; gbc.insets.left = 0; gbc.insets.right = 0; toolsPanel.add(connectionsCombo, gbc); gbc.gridx++; gbc.weightx = 0; gbc.insets.left = 0; gbc.insets.top = 7; gbc.insets.right = 10; gbc.insets.left = 10; toolsPanel.add(createLabel("Filter:", 'l'), gbc); gbc.gridx++; gbc.weightx = 0.8; gbc.insets.top = 2; gbc.insets.bottom = 2; gbc.insets.right = 2; gbc.insets.left = 0; gbc.fill = GridBagConstraints.BOTH; toolsPanel.add(createResultSetFilterTextField(), gbc); gbc.gridx++; gbc.weightx = 0; gbc.insets.top = 5; gbc.insets.left = 10; toolsPanel.add(maxRowCountCheckBox, gbc); gbc.gridx++; gbc.insets.left = 0; gbc.insets.top = 7; gbc.insets.right = 10; toolsPanel.add(createLabel("Max Rows:", 'R'), gbc); gbc.gridx++; gbc.weightx = 0.3; gbc.insets.top = 2; gbc.insets.bottom = 2; gbc.insets.right = 2; gbc.fill = GridBagConstraints.BOTH; toolsPanel.add(maxRowCountField, gbc); splitPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 3)); JPanel base = new JPanel(new BorderLayout()); base.add(toolsPanel, BorderLayout.NORTH); base.add(splitPane, BorderLayout.CENTER); gbc.gridy = 1; gbc.gridx = 1; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.insets.top = 0; gbc.insets.bottom = 0; gbc.insets.left = 0; gbc.insets.right = 0; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.SOUTHEAST; add(base, gbc); // register for connection and keyword events EventMediator.registerListener(this); addDeleteLineActionMapping(); setEditorPreferences(); statusBar.setCaretPosition(1, 1); statusBar.setInsertionMode("INS"); }
From source file:cool.pandora.modeller.ui.jpanel.base.NewBagInPlaceFrame.java
/** * layoutAddKeepFilesToEmptyCheckBox.//w w w . j a v a2s .c o m * * <p>Setting and displaying the ".keep Files in Empty Folder(s):" Check Box * on the Create Bag In Place Pane */ private void layoutAddKeepFilesToEmptyCheckBox(final JPanel contentPane, final int row) { // Delete Empty Folder(s) final JLabel addKeepFilesToEmptyFoldersCheckBoxLabel = new JLabel( bagView.getPropertyMessage("bag.label" + ".addkeepfilestoemptyfolders")); addKeepFilesToEmptyFoldersCheckBoxLabel .setToolTipText(bagView.getPropertyMessage("bag" + ".addkeepfilestoemptyfolders" + ".help")); final JCheckBox addKeepFilesToEmptyFoldersCheckBox = new JCheckBox(bagView.getPropertyMessage("")); addKeepFilesToEmptyFoldersCheckBox.setSelected(bag.isAddKeepFilesToEmptyFolders()); addKeepFilesToEmptyFoldersCheckBox.addActionListener(new AddKeepFilesToEmptyFoldersHandler()); GridBagConstraints glbc = new GridBagConstraints(); final JLabel spacerLabel = new JLabel(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); contentPane.add(addKeepFilesToEmptyFoldersCheckBoxLabel, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); contentPane.add(addKeepFilesToEmptyFoldersCheckBox, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPane.add(spacerLabel, glbc); }
From source file:com.floreantpos.jasperreport.swing.JRViewerPanel.java
private void initComponents() { scrollPane = new javax.swing.JScrollPane(); scrollPane.getHorizontalScrollBar().setUnitIncrement(5); scrollPane.getVerticalScrollBar().setUnitIncrement(5); pnlInScroll = new javax.swing.JPanel(); pnlPage = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); pnlLinks = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); jPanel7 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblPage = new PageRenderer(); setMinimumSize(new java.awt.Dimension(450, 150)); setPreferredSize(new java.awt.Dimension(450, 150)); setLayout(new java.awt.BorderLayout()); addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { pnlMainComponentResized(evt); }/* www .j a va 2 s .c om*/ }); //scrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); //scrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); pnlInScroll.setLayout(new java.awt.GridBagLayout()); pnlPage.setLayout(new java.awt.BorderLayout()); pnlPage.setMinimumSize(new java.awt.Dimension(100, 100)); pnlPage.setPreferredSize(new java.awt.Dimension(100, 100)); jPanel4.setLayout(new java.awt.GridBagLayout()); jPanel4.setMinimumSize(new java.awt.Dimension(100, 120)); jPanel4.setPreferredSize(new java.awt.Dimension(100, 120)); pnlLinks.setLayout(null); pnlLinks.setMinimumSize(new java.awt.Dimension(5, 5)); pnlLinks.setPreferredSize(new java.awt.Dimension(5, 5)); pnlLinks.setOpaque(false); pnlLinks.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { pnlLinksMousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { pnlLinksMouseReleased(evt); } }); pnlLinks.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { pnlLinksMouseDragged(evt); } }); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; jPanel4.add(pnlLinks, gridBagConstraints); jPanel5.setBackground(java.awt.Color.gray); jPanel5.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel5.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; jPanel4.add(jPanel5, gridBagConstraints); jPanel6.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel6.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; jPanel4.add(jPanel6, gridBagConstraints); jPanel7.setBackground(java.awt.Color.gray); jPanel7.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel7.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; jPanel4.add(jPanel7, gridBagConstraints); jPanel8.setBackground(java.awt.Color.gray); jPanel8.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel8.setPreferredSize(new java.awt.Dimension(5, 5)); jLabel1.setText("jLabel1"); jPanel8.add(jLabel1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; jPanel4.add(jPanel8, gridBagConstraints); jPanel9.setMinimumSize(new java.awt.Dimension(5, 5)); jPanel9.setPreferredSize(new java.awt.Dimension(5, 5)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; jPanel4.add(jPanel9, gridBagConstraints); lblPage.setBackground(java.awt.Color.white); lblPage.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0))); lblPage.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel4.add(lblPage, gridBagConstraints); pnlPage.add(jPanel4, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); pnlInScroll.add(pnlPage, gridBagConstraints); scrollPane.setViewportView(pnlInScroll); add(scrollPane, java.awt.BorderLayout.CENTER); }