List of usage examples for java.awt Insets Insets
public Insets(int top, int left, int bottom, int right)
From source file:analysers.FilterValidatedDialog.java
/** * Create the dialog./*w w w .j a va 2 s .c o m*/ */ public FilterValidatedDialog() { setTitle("Validated Lineages: Export Filter"); setBounds(100, 100, 632, 348); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[] { 160, 440, 0 }; gbl_contentPanel.rowHeights = new int[] { 1, 28, 28, 28, 0, 0 }; gbl_contentPanel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE }; contentPanel.setLayout(gbl_contentPanel); { JLabel lblCriterion = new JLabel("Lineage Criterion"); lblCriterion.setFont(new Font("Lucida Grande", Font.BOLD, 13)); GridBagConstraints gbc_lblCriterion = new GridBagConstraints(); gbc_lblCriterion.insets = new Insets(0, 0, 5, 5); gbc_lblCriterion.gridx = 0; gbc_lblCriterion.gridy = 0; contentPanel.add(lblCriterion, gbc_lblCriterion); } { JLabel lblValue = new JLabel("Value"); lblValue.setFont(new Font("Lucida Grande", Font.BOLD, 13)); GridBagConstraints gbc_lblValue = new GridBagConstraints(); gbc_lblValue.insets = new Insets(0, 0, 5, 0); gbc_lblValue.gridx = 1; gbc_lblValue.gridy = 0; contentPanel.add(lblValue, gbc_lblValue); } { lblMinLineageLength = new JLabel("Min. Length (frames)"); GridBagConstraints gbc_lblMinLineageLength = new GridBagConstraints(); gbc_lblMinLineageLength.fill = GridBagConstraints.BOTH; gbc_lblMinLineageLength.insets = new Insets(0, 0, 5, 5); gbc_lblMinLineageLength.gridx = 0; gbc_lblMinLineageLength.gridy = 1; contentPanel.add(lblMinLineageLength, gbc_lblMinLineageLength); } { minLinLen = new JTextField(); GridBagConstraints gbc_minLinLen = new GridBagConstraints(); gbc_minLinLen.anchor = GridBagConstraints.NORTH; gbc_minLinLen.fill = GridBagConstraints.HORIZONTAL; gbc_minLinLen.insets = new Insets(0, 0, 5, 0); gbc_minLinLen.gridx = 1; gbc_minLinLen.gridy = 1; contentPanel.add(minLinLen, gbc_minLinLen); minLinLen.setText("1"); minLinLen.setColumns(3); } { lblStartFrameOf = new JLabel("Max. Start Frame"); GridBagConstraints gbc_lblStartFrameOf = new GridBagConstraints(); gbc_lblStartFrameOf.fill = GridBagConstraints.HORIZONTAL; gbc_lblStartFrameOf.insets = new Insets(0, 0, 5, 5); gbc_lblStartFrameOf.gridx = 0; gbc_lblStartFrameOf.gridy = 2; contentPanel.add(lblStartFrameOf, gbc_lblStartFrameOf); } { startLin = new JTextField(); GridBagConstraints gbc_startLin = new GridBagConstraints(); gbc_startLin.insets = new Insets(0, 0, 5, 0); gbc_startLin.fill = GridBagConstraints.HORIZONTAL; gbc_startLin.gridx = 1; gbc_startLin.gridy = 2; contentPanel.add(startLin, gbc_startLin); startLin.setText("-1"); startLin.setColumns(3); } { JButton btnPreview = new JButton("Preview"); btnPreview.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { preview.setText(makePreview()); } }); GridBagConstraints gbc_btnPreview = new GridBagConstraints(); gbc_btnPreview.insets = new Insets(0, 0, 5, 5); gbc_btnPreview.gridx = 0; gbc_btnPreview.gridy = 3; contentPanel.add(btnPreview, gbc_btnPreview); } { JScrollPane scrollPane = new JScrollPane(); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.insets = new Insets(0, 0, 5, 0); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 3; contentPanel.add(scrollPane, gbc_scrollPane); { preview = new JTextArea(); scrollPane.setViewportView(preview); preview.setEditable(false); preview.setColumns(10); preview.setTabSize(4); } } { JLabel lblOptions = new JLabel("Options"); GridBagConstraints gbc_lblOptions = new GridBagConstraints(); gbc_lblOptions.insets = new Insets(0, 0, 0, 5); gbc_lblOptions.gridx = 0; gbc_lblOptions.gridy = 4; contentPanel.add(lblOptions, gbc_lblOptions); } { JPanel panel = new JPanel(); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.anchor = GridBagConstraints.NORTH; gbc_panel.fill = GridBagConstraints.HORIZONTAL; gbc_panel.gridx = 1; gbc_panel.gridy = 4; contentPanel.add(panel, gbc_panel); GridBagLayout gbl_panel = new GridBagLayout(); gbl_panel.columnWidths = new int[] { 69, 169, 162, 0 }; gbl_panel.rowHeights = new int[] { 23, 23, 0 }; gbl_panel.columnWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_panel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; panel.setLayout(gbl_panel); { rdbtnExportMeanIntensity = new JRadioButton("Export Mean Intensity"); rdbtnExportMeanIntensity.setSelected(true); buttonGroup.add(rdbtnExportMeanIntensity); GridBagConstraints gbc_rdbtnExportMeanIntensity = new GridBagConstraints(); gbc_rdbtnExportMeanIntensity.anchor = GridBagConstraints.NORTHWEST; gbc_rdbtnExportMeanIntensity.insets = new Insets(0, 0, 5, 5); gbc_rdbtnExportMeanIntensity.gridx = 1; gbc_rdbtnExportMeanIntensity.gridy = 0; panel.add(rdbtnExportMeanIntensity, gbc_rdbtnExportMeanIntensity); } { rdbtnExportMaxIntensity = new JRadioButton("Export Max Intensity"); buttonGroup.add(rdbtnExportMaxIntensity); GridBagConstraints gbc_rdbtnExportMaxIntensity = new GridBagConstraints(); gbc_rdbtnExportMaxIntensity.anchor = GridBagConstraints.NORTHWEST; gbc_rdbtnExportMaxIntensity.insets = new Insets(0, 0, 5, 0); gbc_rdbtnExportMaxIntensity.gridx = 2; gbc_rdbtnExportMaxIntensity.gridy = 0; panel.add(rdbtnExportMaxIntensity, gbc_rdbtnExportMaxIntensity); } { chckbxExportPositions = new JCheckBox("Export Cell Positions and Areas in CSV"); GridBagConstraints gbc_chckbxExportPositions = new GridBagConstraints(); gbc_chckbxExportPositions.anchor = GridBagConstraints.NORTH; gbc_chckbxExportPositions.gridwidth = 2; gbc_chckbxExportPositions.gridx = 1; gbc_chckbxExportPositions.gridy = 1; panel.add(chckbxExportPositions, gbc_chckbxExportPositions); } } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (validateFields()) { Prefs.set("TrackApp.FilterValidatedDialog.startLin", valStartLin); Prefs.set("TrackApp.FilterValidatedDialog.minLinLen", valMinLinLen); Prefs.set("TrackApp.FilterValidatedDialog.exportMean", doExportMean); Prefs.set("TrackApp.FilterValidatedDialog.exportPositions", doExportPositions); Prefs.savePreferences(); dispose(); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
From source file:com.microsoft.alm.plugin.idea.ui.branch.CreateBranchForm.java
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL/* ww w. ja va 2s . co m*/ */ private void $$$setupUI$$$() { contentPanel = new JPanel(); contentPanel.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1)); nameLabel = new JLabel(); this.$$$loadLabelText$$$(nameLabel, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin") .getString("CreateBranchDialog.NameLabel")); contentPanel.add(nameLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); remoteBranchComboBox = new JComboBox(); contentPanel.add(remoteBranchComboBox, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); nameTextField = new JTextField(); contentPanel.add(nameTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); basedOn = new JLabel(); this.$$$loadLabelText$$$(basedOn, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin") .getString("CreateBranchDialog.BasedOn")); contentPanel.add(basedOn, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); }
From source file:Main.java
public Main() { super(new BorderLayout()); // Create the demo's UI. startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(this); progressBar = new JProgressBar(0, 100); progressBar.setValue(0);/*from www .j a v a2s . c om*/ // Call setStringPainted now so that the progress bar height // stays the same whether or not the string is shown. progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false); JPanel panel = new JPanel(); panel.add(startButton); panel.add(progressBar); add(panel, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:ProgressBarDemo2.java
public ProgressBarDemo2() { super(new BorderLayout()); // Create the demo's UI. startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(this); progressBar = new JProgressBar(0, 100); progressBar.setValue(0);/*from www . j a v a2 s .c o m*/ // Call setStringPainted now so that the progress bar height // stays the same whether or not the string is shown. progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false); JPanel panel = new JPanel(); panel.add(startButton); panel.add(progressBar); add(panel, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:TextComponentDemo.java
public TextComponentDemo() { super("TextComponentDemo"); // Create the text pane and configure it. textPane = new JTextPane(); textPane.setCaretPosition(0);/* w ww .java 2 s . c o m*/ textPane.setMargin(new Insets(5, 5, 5, 5)); StyledDocument styledDoc = textPane.getStyledDocument(); if (styledDoc instanceof AbstractDocument) { doc = (AbstractDocument) styledDoc; doc.setDocumentFilter(new DocumentSizeFilter(MAX_CHARACTERS)); } else { System.err.println("Text pane's document isn't an AbstractDocument!"); System.exit(-1); } JScrollPane scrollPane = new JScrollPane(textPane); scrollPane.setPreferredSize(new Dimension(200, 200)); // Create the text area for the status log and configure it. changeLog = new JTextArea(5, 30); changeLog.setEditable(false); JScrollPane scrollPaneForLog = new JScrollPane(changeLog); // Create a split pane for the change log and the text area. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, scrollPaneForLog); splitPane.setOneTouchExpandable(true); // Create the status area. JPanel statusPane = new JPanel(new GridLayout(1, 1)); CaretListenerLabel caretListenerLabel = new CaretListenerLabel("Caret Status"); statusPane.add(caretListenerLabel); // Add the components. getContentPane().add(splitPane, BorderLayout.CENTER); getContentPane().add(statusPane, BorderLayout.PAGE_END); // Set up the menu bar. actions = createActionTable(textPane); JMenu editMenu = createEditMenu(); JMenu styleMenu = createStyleMenu(); JMenuBar mb = new JMenuBar(); mb.add(editMenu); mb.add(styleMenu); setJMenuBar(mb); // Add some key bindings. addBindings(); // Put the initial text into the text pane. initDocument(); textPane.setCaretPosition(0); // Start watching for undoable edits and caret changes. doc.addUndoableEditListener(new MyUndoableEditListener()); textPane.addCaretListener(caretListenerLabel); doc.addDocumentListener(new MyDocumentListener()); }
From source file:gui.QTLResultsPanel.java
/** QTLResultsPanel(). * //from ww w . j av a2s. com * @param qtlResult = the QTL results to show. * @param order = the ordered result data this QTL was created from. */ public QTLResultsPanel(QTLResult qtlResult, OrderedResult order) { this.qtlResult = qtlResult; this.order = order; // Trait listbox traitModel = new DefaultListModel<Trait>(); for (Trait trait : qtlResult.getTraits()) { traitModel.addElement(trait); } traitList = new JList<Trait>(traitModel); traitList.addListSelectionListener(this); traitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane sp1 = new JScrollPane(traitList); sp1.setPreferredSize(new Dimension(125, 50)); // Details text box details = new JTextArea(); details.setFont(new Font("Monospaced", Font.PLAIN, 11)); details.setMargin(new Insets(2, 5, 2, 5)); details.setEditable(false); details.setTabSize(6); JScrollPane sp4; if (AppFrame.tpmmode == AppFrame.TPMMODE_QTL) { simpleDetails = new JScrollPane(); simpleDetails.setFont(new Font("Monospaced", Font.PLAIN, 11)); simplesplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); simpleright = new JTextArea(); simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11)); simpleright.setMargin(new Insets(2, 5, 2, 5)); simpleright.setEditable(false); simpleright.setTabSize(6); simplesplit.setRightComponent(new JScrollPane(simpleright)); simplesplit.setLeftComponent(simpleDetails); sp4 = new JScrollPane(simplesplit); } else { // TPM MODE NONSNP simpleright = new JTextArea(); simpleright.setFont(new Font("Monospaced", Font.PLAIN, 11)); simpleright.setMargin(new Insets(2, 5, 2, 5)); simpleright.setEditable(false); sp4 = new JScrollPane(simpleright); } lodDetails = new JTextArea(); lodDetails.setFont(new Font("Monospaced", Font.PLAIN, 11)); lodDetails.setMargin(new Insets(2, 5, 2, 5)); lodDetails.setEditable(false); lodDetails.setTabSize(6); JScrollPane sp3 = new JScrollPane(lodDetails); JTabbedPane tabs = new JTabbedPane(); JScrollPane sp2 = new JScrollPane(details); tabs.add(sp2, "Full Model"); tabs.add(sp4, "Simple Model"); tabs.add(sp3, "LOD Details"); // The splitpane splits = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splits.setTopComponent(new JPanel()); splits.setBottomComponent(tabs); splits.setResizeWeight(0.5); // pane2 JSplitPane splits2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splits2.setLeftComponent(sp1); splits2.setRightComponent(splits); setLayout(new BorderLayout()); add(new GradientPanel("QTL Analysis Results"), BorderLayout.NORTH); // add(sp1, BorderLayout.WEST); // add(splits); add(splits2); add(toolbar = new QTLResultsToolBar(this), BorderLayout.EAST); }
From source file:org.apache.taverna.activities.xpath.ui.contextualview.XPathActivityMainContextualView.java
@Override public JComponent getMainFrame() { jpMainPanel = new JPanel(new GridBagLayout()); jpMainPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 2, 4, 2), BorderFactory.createEmptyBorder())); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.weighty = 0;/*from w ww. j av a2s . c om*/ // --- XPath Expression --- c.gridx = 0; c.gridy = 0; c.insets = new Insets(5, 5, 5, 5); JLabel jlXPathExpression = new JLabel("XPath Expression:"); jlXPathExpression.setFont(jlXPathExpression.getFont().deriveFont(Font.BOLD)); jpMainPanel.add(jlXPathExpression, c); c.gridx++; c.weightx = 1.0; tfXPathExpression = new JTextField(); tfXPathExpression.setEditable(false); jpMainPanel.add(tfXPathExpression, c); // --- Label to Show/Hide Mapping Table --- final JLabel jlShowHideNamespaceMappings = new JLabel("Show namespace mappings..."); jlShowHideNamespaceMappings.setForeground(Color.BLUE); jlShowHideNamespaceMappings.setCursor(new Cursor(Cursor.HAND_CURSOR)); jlShowHideNamespaceMappings.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { spXPathNamespaceMappings.setVisible(!spXPathNamespaceMappings.isVisible()); jlShowHideNamespaceMappings.setText( (spXPathNamespaceMappings.isVisible() ? "Hide" : "Show") + " namespace mappings..."); thisContextualView.revalidate(); } }); c.gridx = 0; c.gridy++; c.gridwidth = 2; c.weightx = 1.0; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; jpMainPanel.add(jlShowHideNamespaceMappings, c); // --- Namespace Mapping Table --- xpathNamespaceMappingsTableModel = new DefaultTableModel() { /** * No cells should be editable */ public boolean isCellEditable(int rowIndex, int columnIndex) { return (false); } }; xpathNamespaceMappingsTableModel.addColumn("Namespace Prefix"); xpathNamespaceMappingsTableModel.addColumn("Namespace URI"); jtXPathNamespaceMappings = new JTable(); jtXPathNamespaceMappings.setModel(xpathNamespaceMappingsTableModel); jtXPathNamespaceMappings.setPreferredScrollableViewportSize(new Dimension(200, 90)); // TODO - next line is to be enabled when Taverna is migrated to Java // 1.6; for now it's fine to run without this // jtXPathNamespaceMappings.setFillsViewportHeight(true); // makes sure // that when the dedicated area is larger than the table, the latter is // stretched vertically to fill the empty space jtXPathNamespaceMappings.getColumnModel().getColumn(0).setPreferredWidth(20); // set // relative // sizes of // columns jtXPathNamespaceMappings.getColumnModel().getColumn(1).setPreferredWidth(300); c.gridy++; spXPathNamespaceMappings = new JScrollPane(jtXPathNamespaceMappings); spXPathNamespaceMappings.setVisible(false); jpMainPanel.add(spXPathNamespaceMappings, c); // populate the view with values refreshView(); return jpMainPanel; }
From source file:org.n52.oxf.ui.swing.ChartDialog.java
/** * This method initializes this/*from ww w .ja v a2 s . c om*/ * * @return void */ private void initialize() { this.setSize(dialogWidth, dialogHeight); MyGridBagLayout mainLayout = new MyGridBagLayout(this.getContentPane()); this.getContentPane().setLayout(mainLayout); mainLayout.addComponent(0, timePeriodPanel, 0, 1, 1, 1, 10, 10, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2)); mainLayout.addComponent(1, applyButton, 0, 2, 2, 1, 100, 10, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0)); mainLayout.addComponent(2, nowButton, 1, 1, 1, 1, 10, 10, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(32, 0, 0, 0)); }
From source file:dk.dma.epd.common.prototype.gui.voct.VOCTAdditionalInfoPanel.java
/** * Constructor// w w w . j av a2s . c o m * * @param compactLayout * if false, there will be message type selectors in the panel */ public VOCTAdditionalInfoPanel(boolean compactLayout) { super(new BorderLayout()); EPD.getInstance().getVoctHandler().addVoctSarInfoListener(this); // Prepare the title header titleHeader.setBackground(getBackground().darker()); titleHeader.setOpaque(true); titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titleHeader.setHorizontalAlignment(SwingConstants.CENTER); add(titleHeader, BorderLayout.NORTH); // Add messages panel scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); messagesPanel.setBackground(UIManager.getColor("List.background")); messagesPanel.setOpaque(false); messagesPanel.setLayout(new GridBagLayout()); messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(scrollPane, BorderLayout.CENTER); JPanel sendPanel = new JPanel(new GridBagLayout()); add(sendPanel, BorderLayout.SOUTH); Insets insets = new Insets(2, 2, 2, 2); // Add text area // if (false) { // messageText = new JTextField(); // ((JTextField) messageText).addActionListener(this); // sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); // // } else { messageText = new JTextArea(); JScrollPane scrollPane2 = new JScrollPane(messageText); scrollPane2.setPreferredSize(new Dimension(100, 50)); scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); // } // Add buttons // ButtonGroup group = new ButtonGroup(); if (!compactLayout) { JToolBar msgTypePanel = new JToolBar(); msgTypePanel.setBorderPainted(false); msgTypePanel.setOpaque(true); msgTypePanel.setFloatable(false); sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } if (compactLayout) { addBtn = new JButton("Add to Log"); sendPanel.add(addBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } // addBtn.setEnabled(false); // messageText.setEditable(false); addBtn.addActionListener(this); }
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()); }/*from w ww . j a va2 s .c o 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; } }