List of usage examples for java.awt GridBagConstraints NORTHEAST
int NORTHEAST
To view the source code for java.awt GridBagConstraints NORTHEAST.
Click Source Link
From source file:net.chaosserver.timelord.swingui.SummaryPanel.java
/** * Constructs the panel.// ww w . ja v a 2 s .c o m */ protected void buildSummaryPanel() { GridBagLayout gridBagLayout = new GridBagLayout(); GridBagConstraints gridBagConstraints = new GridBagConstraints(); setLayout(gridBagLayout); if (isToday()) { JLabel remainderName = new JLabel("Remainder"); gridBagConstraints.anchor = GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = LayoutConstants.HEAVY_WEIGHT; gridBagConstraints.insets = new Insets(0, LayoutConstants.SMALL_INSET, 0, LayoutConstants.BIG_INSET); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.gridwidth = 1; gridBagLayout.addLayoutComponent(remainderName, gridBagConstraints); add(remainderName); timeLeftLabel = new JLabel(); gridBagConstraints.anchor = GridBagConstraints.SOUTHEAST; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagConstraints.insets = new Insets(0, LayoutConstants.BIG_INSET, 0, LayoutConstants.SMALL_INSET); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagLayout.addLayoutComponent(timeLeftLabel, gridBagConstraints); add(timeLeftLabel); } JLabel taskName = new JLabel("Total"); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = LayoutConstants.HEAVY_WEIGHT; gridBagConstraints.insets = new Insets(0, LayoutConstants.SMALL_INSET, 0, LayoutConstants.BIG_INSET); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.gridwidth = 1; gridBagLayout.addLayoutComponent(taskName, gridBagConstraints); add(taskName); totalTimeLabel = new JLabel(); gridBagConstraints.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.weightx = 0; gridBagConstraints.insets = new Insets(0, LayoutConstants.BIG_INSET, 0, LayoutConstants.SMALL_INSET); gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; gridBagLayout.addLayoutComponent(totalTimeLabel, gridBagConstraints); add(totalTimeLabel); updateTotalTimeLabel(); updateTimeLeftLabel(); }
From source file:com.digitalgeneralists.assurance.ui.components.ScanLaunchPanel.java
private void initializeComponent() { if (!this.initialized) { GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); GridBagConstraints existingScansPanelConstraints = new GridBagConstraints(); existingScansPanelConstraints.anchor = GridBagConstraints.WEST; existingScansPanelConstraints.fill = GridBagConstraints.BOTH; existingScansPanelConstraints.gridx = 0; existingScansPanelConstraints.gridy = 0; existingScansPanelConstraints.weightx = 1.0; existingScansPanelConstraints.weighty = 1.0; existingScansPanelConstraints.gridheight = 2; existingScansPanelConstraints.gridwidth = 1; existingScansPanelConstraints.insets = new Insets(0, 0, 0, 0); JPanel existingScansPanel = new JPanel(); GridBagLayout panelGridbag = new GridBagLayout(); existingScansPanel.setLayout(panelGridbag); this.add(existingScansPanel, existingScansPanelConstraints); GridBagConstraints existingScansListConstraints = new GridBagConstraints(); existingScansListConstraints.anchor = GridBagConstraints.WEST; existingScansListConstraints.fill = GridBagConstraints.BOTH; existingScansListConstraints.gridx = 0; existingScansListConstraints.gridy = 0; existingScansListConstraints.weightx = 1.0; existingScansListConstraints.weighty = 0.9; existingScansListConstraints.gridheight = 1; existingScansListConstraints.gridwidth = 2; existingScansListConstraints.insets = new Insets(5, 5, 5, 5); GridBagConstraints existingScanDefinitionsListConstraints = new GridBagConstraints(); existingScanDefinitionsListConstraints.anchor = GridBagConstraints.WEST; existingScanDefinitionsListConstraints.fill = GridBagConstraints.BOTH; existingScanDefinitionsListConstraints.gridx = 0; existingScanDefinitionsListConstraints.gridy = 0; existingScanDefinitionsListConstraints.weightx = 1.0; existingScanDefinitionsListConstraints.weighty = 0.9; existingScanDefinitionsListConstraints.gridheight = 1; existingScanDefinitionsListConstraints.gridwidth = 2; existingScanDefinitionsListConstraints.insets = new Insets(5, 5, 5, 5); this.existingScanDefinitionsListPanel = new ListInputPanel<ScanDefinition>(this, this); existingScansPanel.add(this.existingScanDefinitionsListPanel, existingScanDefinitionsListConstraints); GridBagConstraints scanButtonConstraints = new GridBagConstraints(); scanButtonConstraints.anchor = GridBagConstraints.NORTHEAST; scanButtonConstraints.fill = GridBagConstraints.BOTH; scanButtonConstraints.gridx = 1; scanButtonConstraints.gridy = 0; scanButtonConstraints.weightx = 1.0; scanButtonConstraints.weighty = 1.0; this.startScanButton.setActionCommand(AssuranceActions.scanAction); this.add(this.startScanButton, scanButtonConstraints); GridBagConstraints scanAndMergeButtonConstraints = new GridBagConstraints(); scanAndMergeButtonConstraints.anchor = GridBagConstraints.SOUTHEAST; scanAndMergeButtonConstraints.fill = GridBagConstraints.BOTH; scanAndMergeButtonConstraints.gridx = 1; scanAndMergeButtonConstraints.gridy = 1; scanAndMergeButtonConstraints.weightx = 1.0; scanAndMergeButtonConstraints.weighty = 1.0; this.startScanAndMergeButton.setActionCommand(AssuranceActions.scanAndMergeAction); this.add(this.startScanAndMergeButton, scanAndMergeButtonConstraints); this.startScanAndMergeButton.addActionListener(this); this.startScanButton.addActionListener(this); this.startScanButton.setEnabled(false); this.startScanAndMergeButton.setEnabled(false); this.addAncestorListener(new AncestorListener() { public void ancestorAdded(AncestorEvent event) { applicationDelegate.addEventObserver(ScanStartedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(ScanCompletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(ScanDefinitionDeletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(ScanDefinitionSavedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.addEventObserver(ScanDefinitionsLoadedEvent.class, (IEventObserver) event.getSource()); }// w ww . j a v a 2 s . co m public void ancestorRemoved(AncestorEvent event) { applicationDelegate.removeEventObserver(ScanStartedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(ScanCompletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(ScanDefinitionDeletedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(ScanDefinitionSavedEvent.class, (IEventObserver) event.getSource()); applicationDelegate.removeEventObserver(ScanDefinitionsLoadedEvent.class, (IEventObserver) event.getSource()); } public void ancestorMoved(AncestorEvent event) { } }); this.initialized = true; } }
From source file:edu.harvard.mcz.imagecapture.LoginDialog.java
/** * This method initializes jPanel /*from ww w . j a v a2s.c om*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); gridBagConstraints17.gridx = 1; gridBagConstraints17.anchor = GridBagConstraints.WEST; gridBagConstraints17.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints17.gridy = 16; jLabel6 = new JLabel(); jLabel6.setText(""); GridBagConstraints gridBagConstraints62 = new GridBagConstraints(); gridBagConstraints62.gridx = 0; gridBagConstraints62.gridwidth = 2; gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints62.anchor = GridBagConstraints.WEST; gridBagConstraints62.gridy = 6; GridBagConstraints gridBagConstraints51 = new GridBagConstraints(); gridBagConstraints51.gridx = 0; gridBagConstraints51.gridy = 4; GridBagConstraints gridBagConstraints41 = new GridBagConstraints(); gridBagConstraints41.fill = GridBagConstraints.BOTH; gridBagConstraints41.gridy = 3; gridBagConstraints41.weightx = 1.0; gridBagConstraints41.anchor = GridBagConstraints.WEST; gridBagConstraints41.gridx = 1; GridBagConstraints gridBagConstraints31 = new GridBagConstraints(); gridBagConstraints31.gridx = 0; gridBagConstraints31.anchor = GridBagConstraints.EAST; gridBagConstraints31.gridy = 3; jLabel9 = new JLabel(); jLabel9.setText("Password"); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.gridx = 0; gridBagConstraints21.anchor = GridBagConstraints.EAST; gridBagConstraints21.gridy = 2; jLabel8 = new JLabel(); jLabel8.setText("email"); GridBagConstraints gridBagConstraints16 = new GridBagConstraints(); gridBagConstraints16.fill = GridBagConstraints.BOTH; gridBagConstraints16.gridy = 2; gridBagConstraints16.weightx = 1.0; gridBagConstraints16.anchor = GridBagConstraints.WEST; gridBagConstraints16.gridx = 1; GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); gridBagConstraints15.gridx = 1; gridBagConstraints15.gridy = 12; GridBagConstraints gridBagConstraints61 = new GridBagConstraints(); gridBagConstraints61.gridx = 0; gridBagConstraints61.gridwidth = 1; gridBagConstraints61.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints61.gridheight = 4; gridBagConstraints61.fill = GridBagConstraints.NONE; gridBagConstraints61.weighty = 1.0; gridBagConstraints61.insets = new Insets(0, 0, 0, 0); gridBagConstraints61.gridy = 10; jLabel7 = new JLabel(); URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/key_small.png"); try { //this.setIconImage(new ImageIcon(iconFile).getImage()); jLabel7.setIcon(new ImageIcon(iconFile)); } catch (Exception e) { System.out.println("Can't open icon file: " + iconFile); } jLabel7.setText(" "); GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.gridx = 1; gridBagConstraints12.anchor = GridBagConstraints.NORTH; gridBagConstraints12.fill = GridBagConstraints.NONE; gridBagConstraints12.gridy = 1; jLabel5 = new JLabel(); jLabel5.setText("Connect to Database"); jLabel4 = new JLabel(); jLabel4.setText("Dialect"); jLabel3 = new JLabel(); jLabel3.setText("Connection"); jLabel2 = new JLabel(); jLabel2.setText("Driver"); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.gridy = 2; jLabel1 = new JLabel(); jLabel1.setText("DBPassword"); jLabel = new JLabel(); jLabel.setText("Schema"); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(jLabel5, gridBagConstraints12); jPanel.add(jLabel7, gridBagConstraints61); jPanel.add(getJPanel1(), gridBagConstraints15); jPanel.add(getJTextFieldEmail(), gridBagConstraints16); jPanel.add(jLabel8, gridBagConstraints21); jPanel.add(jLabel9, gridBagConstraints31); jPanel.add(getJPasswordFieldUser(), gridBagConstraints41); jPanel.add(getJButton2(), gridBagConstraints51); jPanel.add(getJPanelAdvanced(), gridBagConstraints62); jPanel.add(jLabel6, gridBagConstraints17); } return jPanel; }
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);/* www .j a v a 2 s . co m*/ 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:net.java.sip.communicator.impl.gui.main.chat.ChatWritePanel.java
/** * Creates the center panel.//from ww w . j a va2s .co m * * @return the created center panel */ private Container createCenter() { JPanel centerPanel = new JPanel(new GridBagLayout()); centerPanel.setBackground(Color.WHITE); centerPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 3)); GridBagConstraints constraints = new GridBagConstraints(); initSmsLabel(centerPanel); initTextArea(centerPanel); smsCharCountLabel = new JLabel(String.valueOf(smsCharCount)); smsCharCountLabel.setForeground(Color.GRAY); smsCharCountLabel.setVisible(false); constraints.anchor = GridBagConstraints.NORTHEAST; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 3; constraints.gridy = 0; constraints.weightx = 0f; constraints.weighty = 0f; constraints.insets = new Insets(0, 2, 0, 2); constraints.gridheight = 1; constraints.gridwidth = 1; centerPanel.add(smsCharCountLabel, constraints); smsNumberLabel = new JLabel(String.valueOf(smsNumberCount)) { @Override public void paintComponent(Graphics g) { AntialiasingManager.activateAntialiasing(g); g.setColor(getBackground()); g.fillOval(0, 0, getWidth(), getHeight()); super.paintComponent(g); } }; smsNumberLabel.setHorizontalAlignment(JLabel.CENTER); smsNumberLabel.setPreferredSize(new Dimension(18, 18)); smsNumberLabel.setMinimumSize(new Dimension(18, 18)); smsNumberLabel.setForeground(Color.WHITE); smsNumberLabel.setBackground(Color.GRAY); smsNumberLabel.setVisible(false); constraints.anchor = GridBagConstraints.NORTHEAST; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 4; constraints.gridy = 0; constraints.weightx = 0f; constraints.weighty = 0f; constraints.insets = new Insets(0, 2, 0, 2); constraints.gridheight = 1; constraints.gridwidth = 1; centerPanel.add(smsNumberLabel, constraints); return centerPanel; }
From source file:org.nuclos.client.layout.wysiwyg.component.properties.PropertyChartPropertyDomainStep.java
@Override public void prepare() { super.prepare(); chart = model.getChart();/*from w w w.j a v a 2 s.c o m*/ wysiwygChart = model.getWYSIWYGChart(); String sPrefix = getChartProperty(Chart.PROPERTY_COMBINED_PREFIXES); combinedPrefixes = (sPrefix == null) ? new StringBuffer("") : new StringBuffer(sPrefix); panel = new JPanel(); panel.setLayout(new BorderLayout()); final ChartFunction chartFunction = getChartFunction(); if (!chartFunction.isCombinedChart()) { panel.add(getPanelComponent(chartFunction, ""), BorderLayout.CENTER); } else { JPanel editorType = new JPanel(); editorType.setLayout(new GridBagLayout()); JLabel propTypeValue = new JLabel( //SpringLocaleDelegate.getInstance().getMessage("wysiwyg.chart.wizard.domain.value", "Diagramm hinzufgen:"/*)*/); editorType.add(propTypeValue, new GridBagConstraints(0, 0, 0, 1, 1D, 1D, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 0), 0, 0)); final JComboBox propTypeComponent = new JComboBox(chartFunction.getCombinedChartFunctions()); editorType.add(propTypeComponent, new GridBagConstraints(0, 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 15, 0), 0, 0)); final JTabbedPane tabbedPane = new JTabbedPane(); JButton removeButton = new JButton(iconRemove); removeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (tabbedPane.getSelectedIndex() != -1) { PanelComponent panelComponent = (PanelComponent) tabbedPane.getSelectedComponent(); combinedPrefixes = new StringBuffer( combinedPrefixes.toString().replaceAll(panelComponent.prefix, "")); tabbedPane.remove(panelComponent); } } }); editorType.add(removeButton, new GridBagConstraints(1, 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0)); JButton addButton = new JButton(iconAdd); addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ChartFunction cFunction = (ChartFunction) propTypeComponent.getSelectedItem(); String prefix = cFunction.name() + "." + (Math.random() + "").replaceAll("\\.", "") + ":"; combinedPrefixes.append(prefix); tabbedPane.add(cFunction.name(), getPanelComponent(cFunction, prefix)); tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1); } }); editorType.add(addButton, new GridBagConstraints(2, 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0)); String[] prefixes = combinedPrefixes.toString().split(":"); for (String prefix : prefixes) { if (prefix.length() > 0) { try { ChartFunction cFunction = ChartFunction.valueOf(prefix.split("\\.")[0]); tabbedPane.add(cFunction.name(), getPanelComponent(cFunction, prefix + ":")); } catch (Exception e) { // ignore. } } } panel.add(editorType, BorderLayout.NORTH); panel.add(tabbedPane, BorderLayout.CENTER); } }
From source file:fxts.stations.ui.SideLayout.java
/** * Adjusts the x, y, width, and height fields to the correct * values depending on the constraint geometry and pads. * * @param aConstraints the constraints to be applied * @param aRectangle the <code>Rectangle</code> to be adjusted *//* w ww. j a va 2 s.c om*/ protected void adjustForGravity(SideConstraints aConstraints, Rectangle aRectangle) { int diffx, diffy; if (!mRightToLeft) { aRectangle.x += aConstraints.insets.left; } else { aRectangle.x -= aRectangle.width - aConstraints.insets.right; } aRectangle.width -= aConstraints.insets.left + aConstraints.insets.right; aRectangle.y += aConstraints.insets.top; aRectangle.height -= aConstraints.insets.top + aConstraints.insets.bottom; diffx = 0; if (aConstraints.fill != SideConstraints.HORIZONTAL && aConstraints.fill != SideConstraints.BOTH && aRectangle.width > aConstraints.minWidth + aConstraints.ipadx) { diffx = aRectangle.width - (aConstraints.minWidth + aConstraints.ipadx); aRectangle.width = aConstraints.minWidth + aConstraints.ipadx; } diffy = 0; if (aConstraints.fill != SideConstraints.VERTICAL && aConstraints.fill != SideConstraints.BOTH && aRectangle.height > aConstraints.minHeight + aConstraints.ipady) { diffy = aRectangle.height - (aConstraints.minHeight + aConstraints.ipady); aRectangle.height = aConstraints.minHeight + aConstraints.ipady; } switch (aConstraints.anchor) { case GridBagConstraints.CENTER: aRectangle.x += diffx / 2; aRectangle.y += diffy / 2; break; case SideConstraints.PAGE_START: case GridBagConstraints.NORTH: aRectangle.x += diffx / 2; break; case GridBagConstraints.NORTHEAST: aRectangle.x += diffx; break; case GridBagConstraints.EAST: aRectangle.x += diffx; aRectangle.y += diffy / 2; break; case GridBagConstraints.SOUTHEAST: aRectangle.x += diffx; aRectangle.y += diffy; break; case SideConstraints.PAGE_END: case GridBagConstraints.SOUTH: aRectangle.x += diffx / 2; aRectangle.y += diffy; break; case GridBagConstraints.SOUTHWEST: aRectangle.y += diffy; break; case GridBagConstraints.WEST: aRectangle.y += diffy / 2; break; case GridBagConstraints.NORTHWEST: break; case SideConstraints.LINE_START: if (mRightToLeft) { aRectangle.x += diffx; } aRectangle.y += diffy / 2; break; case SideConstraints.LINE_END: if (!mRightToLeft) { aRectangle.x += diffx; } aRectangle.y += diffy / 2; break; case SideConstraints.FIRST_LINE_START: if (mRightToLeft) { aRectangle.x += diffx; } break; case SideConstraints.FIRST_LINE_END: if (!mRightToLeft) { aRectangle.x += diffx; } break; case SideConstraints.LAST_LINE_START: if (mRightToLeft) { aRectangle.x += diffx; } aRectangle.y += diffy; break; case SideConstraints.LAST_LINE_END: if (!mRightToLeft) { aRectangle.x += diffx; } aRectangle.y += diffy; break; default: throw new IllegalArgumentException("illegal anchor value"); } }
From source file:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java
/** * This method initializes jPanel /*from w w w. jav a 2 s. c o m*/ * * @return javax.swing.JPanel */ public JPanel getJPanelBottom() { if (jPanelBottom == null) { GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints8.insets = new Insets(10, 0, 0, 0); gridBagConstraints8.gridx = 1; gridBagConstraints8.gridy = 2; gridBagConstraints8.weightx = 1.0; gridBagConstraints8.weighty = 1.0; gridBagConstraints8.fill = GridBagConstraints.NONE; GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.anchor = GridBagConstraints.WEST; gridBagConstraints7.insets = new Insets(10, 0, 0, 0); gridBagConstraints7.gridx = 1; gridBagConstraints7.gridy = 1; gridBagConstraints7.weightx = 0.0; gridBagConstraints7.fill = GridBagConstraints.VERTICAL; GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.anchor = GridBagConstraints.WEST; gridBagConstraints6.insets = new Insets(10, 0, 0, 15); gridBagConstraints6.gridx = 1; gridBagConstraints6.gridy = 0; gridBagConstraints6.fill = GridBagConstraints.NONE; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints5.gridx = 0; gridBagConstraints5.gridy = 2; gridBagConstraints5.weightx = 0.0; gridBagConstraints5.weighty = 0.0; gridBagConstraints5.insets = new Insets(13, 0, 0, 5); GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.anchor = GridBagConstraints.EAST; gridBagConstraints4.gridx = 0; gridBagConstraints4.gridy = 1; gridBagConstraints4.insets = new Insets(10, 0, 0, 5); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.anchor = GridBagConstraints.EAST; gridBagConstraints1.gridx = -1; gridBagConstraints1.gridy = -1; gridBagConstraints1.insets = new Insets(10, 15, 0, 5); jPanelBottom = new JPanel(); jPanelBottom.setLayout(new GridBagLayout()); jPanelBottom.add(jLabelBinding, gridBagConstraints1); jPanelBottom.add(jLabelComponent, gridBagConstraints4); jPanelBottom.add(jLabelLicense, gridBagConstraints5); jPanelBottom.add(getJComboBoxBinding(), gridBagConstraints6); jPanelBottom.add(getJComboBoxComponentForOpt3(), gridBagConstraints7); jPanelBottom.add(getJComboBoxLicenseForOpt3(), gridBagConstraints8); } return jPanelBottom; }
From source file:edu.harvard.mcz.imagecapture.PositionTemplateEditor.java
/** * This method initializes jPanel //from www .ja v a2s . co m * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { GridBagConstraints gridBagConstraints24 = new GridBagConstraints(); gridBagConstraints24.fill = GridBagConstraints.BOTH; gridBagConstraints24.gridy = 10; gridBagConstraints24.weightx = 1.0; gridBagConstraints24.anchor = GridBagConstraints.WEST; gridBagConstraints24.gridx = 1; GridBagConstraints gridBagConstraints113 = new GridBagConstraints(); gridBagConstraints113.gridx = 0; gridBagConstraints113.anchor = GridBagConstraints.EAST; gridBagConstraints113.gridy = 10; jLabel9 = new JLabel(); jLabel9.setText("Taxon Name Barcode"); GridBagConstraints gridBagConstraints23 = new GridBagConstraints(); gridBagConstraints23.fill = GridBagConstraints.BOTH; gridBagConstraints23.gridy = 13; gridBagConstraints23.weightx = 1.0; gridBagConstraints23.anchor = GridBagConstraints.WEST; gridBagConstraints23.gridx = 1; GridBagConstraints gridBagConstraints112 = new GridBagConstraints(); gridBagConstraints112.gridx = 0; gridBagConstraints112.gridy = 13; GridBagConstraints gridBagConstraints22 = new GridBagConstraints(); gridBagConstraints22.fill = GridBagConstraints.BOTH; gridBagConstraints22.gridy = 12; gridBagConstraints22.weightx = 1.0; gridBagConstraints22.anchor = GridBagConstraints.WEST; gridBagConstraints22.gridx = 1; GridBagConstraints gridBagConstraints111 = new GridBagConstraints(); gridBagConstraints111.gridx = 0; gridBagConstraints111.gridy = 12; GridBagConstraints gridBagConstraints110 = new GridBagConstraints(); gridBagConstraints110.gridx = 1; gridBagConstraints110.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints110.gridwidth = 1; gridBagConstraints110.anchor = GridBagConstraints.NORTH; gridBagConstraints110.gridy = 14; jLabelFeedback = new JLabel(); jLabelFeedback.setText(" "); GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.fill = GridBagConstraints.BOTH; gridBagConstraints21.gridy = 0; gridBagConstraints21.weightx = 2.0; gridBagConstraints21.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints21.gridx = 1; GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); gridBagConstraints13.gridx = 0; gridBagConstraints13.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints13.gridy = 0; jLabel8 = new JLabel(); jLabel8.setText("ImageFile"); GridBagConstraints gridBagConstraints18 = new GridBagConstraints(); gridBagConstraints18.fill = GridBagConstraints.BOTH; gridBagConstraints18.gridy = 9; gridBagConstraints18.weightx = 1.0; gridBagConstraints18.anchor = GridBagConstraints.WEST; gridBagConstraints18.gridx = 1; GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); gridBagConstraints17.fill = GridBagConstraints.BOTH; gridBagConstraints17.gridy = 8; gridBagConstraints17.weightx = 1.0; gridBagConstraints17.anchor = GridBagConstraints.WEST; gridBagConstraints17.gridx = 1; GridBagConstraints gridBagConstraints16 = new GridBagConstraints(); gridBagConstraints16.fill = GridBagConstraints.BOTH; gridBagConstraints16.gridy = 7; gridBagConstraints16.weightx = 1.0; gridBagConstraints16.anchor = GridBagConstraints.WEST; gridBagConstraints16.gridx = 1; GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); gridBagConstraints15.fill = GridBagConstraints.BOTH; gridBagConstraints15.gridy = 6; gridBagConstraints15.weightx = 1.0; gridBagConstraints15.anchor = GridBagConstraints.WEST; gridBagConstraints15.gridx = 1; GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); gridBagConstraints14.fill = GridBagConstraints.BOTH; gridBagConstraints14.gridy = 5; gridBagConstraints14.weightx = 1.0; gridBagConstraints14.anchor = GridBagConstraints.WEST; gridBagConstraints14.gridx = 1; GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.fill = GridBagConstraints.BOTH; gridBagConstraints12.gridy = 3; gridBagConstraints12.weightx = 1.0; gridBagConstraints12.anchor = GridBagConstraints.WEST; gridBagConstraints12.gridx = 1; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 0; gridBagConstraints11.anchor = GridBagConstraints.EAST; gridBagConstraints11.gridy = 9; jLabel7 = new JLabel(); jLabel7.setText("Specimen"); jLabel7.setForeground(Color.ORANGE); GridBagConstraints gridBagConstraints10 = new GridBagConstraints(); gridBagConstraints10.gridx = 0; gridBagConstraints10.anchor = GridBagConstraints.EAST; gridBagConstraints10.gridy = 8; jLabel6 = new JLabel(); jLabel6.setText("Tray Labels"); jLabel6.setForeground(Color.CYAN); GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.gridx = 0; gridBagConstraints9.anchor = GridBagConstraints.EAST; gridBagConstraints9.gridy = 7; jLabel5 = new JLabel(); jLabel5.setText("Pin Labels"); jLabel5.setForeground(Color.MAGENTA); GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.gridx = 0; gridBagConstraints8.anchor = GridBagConstraints.EAST; gridBagConstraints8.insets = new Insets(0, 3, 0, 0); gridBagConstraints8.gridy = 6; jLabel4 = new JLabel(); jLabel4.setText("Taxon Name Label"); jLabel4.setForeground(Color.BLUE); GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.gridx = 0; gridBagConstraints7.anchor = GridBagConstraints.EAST; gridBagConstraints7.gridy = 5; jLabel3 = new JLabel(); jLabel3.setText("Barcode"); jLabel3.setForeground(Color.RED); GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.gridx = 0; gridBagConstraints6.anchor = GridBagConstraints.EAST; gridBagConstraints6.gridy = 3; jLabel2 = new JLabel(); jLabel2.setText("Image Size"); GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.fill = GridBagConstraints.BOTH; gridBagConstraints5.gridy = 2; gridBagConstraints5.weightx = 1.0; gridBagConstraints5.anchor = GridBagConstraints.WEST; gridBagConstraints5.gridx = 1; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.fill = GridBagConstraints.BOTH; gridBagConstraints4.gridy = 1; gridBagConstraints4.weightx = 1.0; gridBagConstraints4.anchor = GridBagConstraints.WEST; gridBagConstraints4.gridx = 1; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.anchor = GridBagConstraints.EAST; gridBagConstraints2.gridy = 2; jLabel1 = new JLabel(); jLabel1.setText("Name"); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.anchor = GridBagConstraints.EAST; gridBagConstraints1.gridy = 1; jLabel = new JLabel(); jLabel.setText("Template ID"); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 11; jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.add(getJButtonSave(), gridBagConstraints); jPanel.add(jLabel, gridBagConstraints1); jPanel.add(jLabel1, gridBagConstraints2); jPanel.add(getJTextFieldTemplateId(), gridBagConstraints4); jPanel.add(getJTextFieldName(), gridBagConstraints5); jPanel.add(jLabel2, gridBagConstraints6); jPanel.add(jLabel3, gridBagConstraints7); jPanel.add(jLabel4, gridBagConstraints8); jPanel.add(jLabel5, gridBagConstraints9); jPanel.add(jLabel6, gridBagConstraints10); jPanel.add(jLabel7, gridBagConstraints11); jPanel.add(getJTextField2(), gridBagConstraints12); jPanel.add(getJTextField3(), gridBagConstraints14); jPanel.add(getJTextField4(), gridBagConstraints15); jPanel.add(getJTextField5(), gridBagConstraints16); jPanel.add(getJTextField6(), gridBagConstraints17); jPanel.add(getJTextField7(), gridBagConstraints18); jPanel.add(jLabel8, gridBagConstraints13); jPanel.add(getJTextField8(), gridBagConstraints21); jPanel.add(jLabelFeedback, gridBagConstraints110); jPanel.add(getJButton(), gridBagConstraints111); jPanel.add(getJTextFieldBarcodeScan(), gridBagConstraints22); jPanel.add(getJButton1(), gridBagConstraints112); jPanel.add(getJTextField(), gridBagConstraints23); jPanel.add(jLabel9, gridBagConstraints113); jPanel.add(getJTextField9(), gridBagConstraints24); } return jPanel; }
From source file:it.ventuland.ytd.ui.GUIClient.java
private void addComponentsToPane(final Container pane) { this.panel = new JPanel(); this.panel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; ActionManager lActionManager = new ActionManager(); dlm = new DefaultListModel<String>(); this.urllist = new JList<String>(dlm); // TODO maybe we add a button to remove added URLs from list? //this.userlist.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); this.urllist.setFocusable(false); textarea = new JTextArea(2, 2); textarea.setEditable(true);/* ww w . j a va 2s . c o m*/ textarea.setFocusable(false); JScrollPane leftscrollpane = new JScrollPane(this.urllist); JScrollPane rightscrollpane = new JScrollPane(textarea); this.middlepane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftscrollpane, rightscrollpane); this.middlepane.setOneTouchExpandable(true); this.middlepane.setDividerLocation(150); Dimension minimumSize = new Dimension(25, 25); leftscrollpane.setMinimumSize(minimumSize); rightscrollpane.setMinimumSize(minimumSize); this.directorybutton = new JButton("", createImageIcon("images/open.png", "")); gbc.gridx = 0; gbc.gridy = 0; this.directorybutton.addActionListener(lActionManager); this.panel.add(this.directorybutton, gbc); this.saveconfigcheckbox = new JCheckBox("Save config"); this.saveconfigcheckbox.setSelected(false); this.panel.add(this.saveconfigcheckbox); this.saveconfigcheckbox.setEnabled(false); // TODO check if initial download directory exists // assume that at least the users homedir exists String shomedir = System.getProperty("user.home").concat(File.separator); gbc.gridx = 0; gbc.gridy = 2; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.HORIZONTAL; this.directorytextfield = new JTextField(shomedir, 20 + (mIsDebug ? 48 : 0)); this.directorytextfield.setEnabled(false); this.directorytextfield.setFocusable(true); this.directorytextfield.addActionListener(lActionManager); this.panel.add(this.directorytextfield, gbc); JLabel dirhint = new JLabel("Download to folder:"); gbc.gridx = 0; gbc.gridy = 1; this.panel.add(dirhint, gbc); this.middlepane.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width / 3, Toolkit.getDefaultToolkit().getScreenSize().height / 4 + (mIsDebug ? 200 : 0))); gbc.gridx = 0; gbc.gridy = 3; gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 2; gbc.weightx = 2; gbc.gridwidth = 2; this.panel.add(this.middlepane, gbc); // radio buttons for resolution to download mVideoResolutionBtnGrp = new ButtonGroup(); JPanel lRadioPanel = new JPanel(new GridLayout(1, 0)); List<Object> lVidQ = mAppContext.getList("youtube-downloader.video-quality"); JRadioButton lRadioButton = null; for (Object obj : lVidQ) { String lQuality = (String) obj; String lToolTip = mAppContext.getString("youtube-downloader.video-quality." + lQuality + ".tooltip"); boolean lSelected = mAppContext .getBoolean("youtube-downloader.video-quality." + lQuality + ".selected"); boolean lEnabled = mAppContext.getBoolean("youtube-downloader.video-quality." + lQuality + ".enabled"); lRadioButton = new JRadioButton(lQuality); lRadioButton.setName(lQuality); lRadioButton.setActionCommand(lQuality.toLowerCase()); lRadioButton.addActionListener(lActionManager); lRadioButton.setToolTipText(lToolTip); lRadioButton.setSelected(lSelected); lRadioButton.setEnabled(lEnabled); mVideoResolutionBtnGrp.add(lRadioButton); lRadioPanel.add(lRadioButton); } gbc.gridx = 1; gbc.gridy = 0; gbc.gridheight = 0; gbc.gridwidth = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.NORTHEAST; this.panel.add(lRadioPanel, gbc); // radio buttons for video format to download mVideoQualityBtnGrp = new ButtonGroup(); lRadioPanel = new JPanel(new GridLayout(1, 0)); save3dcheckbox = new JCheckBox("3D"); save3dcheckbox.setToolTipText("stereoscopic video"); save3dcheckbox.setSelected(false); save3dcheckbox.setEnabled(true); lRadioPanel.add(save3dcheckbox); List<Object> lVidR = mAppContext.getList("youtube-downloader.video-resolution"); lRadioButton = null; for (Object obj : lVidR) { String lResolution = (String) obj; String lToolTip = mAppContext .getString("youtube-downloader.video-resolution." + lResolution + ".tooltip"); boolean lSelected = mAppContext .getBoolean("youtube-downloader.video-resolution." + lResolution + ".selected"); boolean lEnabled = mAppContext .getBoolean("youtube-downloader.video-resolution." + lResolution + ".enabled"); lRadioButton = new JRadioButton(lResolution); lRadioButton.setName(lResolution); lRadioButton.setActionCommand(lResolution.toLowerCase()); lRadioButton.addActionListener(lActionManager); lRadioButton.setToolTipText(lToolTip); lRadioButton.setSelected(lSelected); lRadioButton.setEnabled(lEnabled); mVideoQualityBtnGrp.add(lRadioButton); lRadioPanel.add(lRadioButton); } gbc.gridx = 1; gbc.gridy = 1; gbc.gridheight = 0; gbc.gridwidth = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.NORTHEAST; this.panel.add(lRadioPanel, gbc); JLabel hint = new JLabel("Type, paste or drag'n drop a YouTube video address:"); gbc.fill = 0; gbc.gridwidth = 0; gbc.gridheight = 1; gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 0; gbc.gridy = 4; gbc.anchor = GridBagConstraints.WEST; this.panel.add(hint, gbc); textinputfield = new JTextField(20); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 5; gbc.gridwidth = 2; textinputfield.setEnabled(true); textinputfield.setFocusable(true); textinputfield.addActionListener(lActionManager); textinputfield.getDocument().addDocumentListener(new UrlInsertListener()); this.panel.add(textinputfield, gbc); this.quitbutton = new JButton("", createImageIcon("images/exit.png", "")); gbc.gridx = 2; gbc.gridy = 5; gbc.gridwidth = 0; this.quitbutton.addActionListener(lActionManager); this.quitbutton.setActionCommand("quit"); this.quitbutton.setToolTipText("Exit."); this.panel.add(this.quitbutton, gbc); pane.add(this.panel); addWindowListener(new GUIWindowAdapter()); this.setDropTarget(new DropTarget(this, new DragDropListener())); textarea.setTransferHandler(null); // otherwise the dropped text would be inserted }